Browse Source

manually merged 228_replace_g_strdup

Enrico Weigelt, metux IT service 16 years ago
parent
commit
035fa47c06
10 changed files with 81 additions and 74 deletions
  1. 1 0
      ChangeLog
  2. 5 2
      edit/choosesyntax.c
  3. 20 20
      edit/editcmd.c
  4. 4 3
      edit/editlock.c
  5. 20 20
      edit/syntax.c
  6. 2 2
      edit/usermap.c
  7. 13 12
      src/boxes.c
  8. 3 3
      src/charsets.c
  9. 6 7
      src/cmd.c
  10. 7 5
      src/color.c

+ 1 - 0
ChangeLog

@@ -20,6 +20,7 @@
 	* src/Makefile.am, edit/Makefile.am vfs/Makefile.am: fixed #208
 	* src/Makefile.am, edit/Makefile.am vfs/Makefile.am: fixed #208
 	  (out-of-tree builds)
 	  (out-of-tree builds)
 	* syntax/Syntax, syntax/Makefile.am, syntax/vhdl.syntax: added VHDL syntax (#193)
 	* syntax/Syntax, syntax/Makefile.am, syntax/vhdl.syntax: added VHDL syntax (#193)
+	* replaced calls to g_strdup() by mhl_str_dup()
 
 
 2009-01-29 Mikhail S. Pobolovets <styx.mp@gmail.com>
 2009-01-29 Mikhail S. Pobolovets <styx.mp@gmail.com>
 	* lib/mc.ext.in: update for OpenOffice and StarOffice viewer.
 	* lib/mc.ext.in: update for OpenOffice and StarOffice viewer.

+ 5 - 2
edit/choosesyntax.c

@@ -17,6 +17,9 @@
  */
  */
 
 
 #include <config.h>
 #include <config.h>
+
+#include <mhl/string.h>
+
 #include "edit.h"
 #include "edit.h"
 #include "../src/global.h"
 #include "../src/global.h"
 #include "../src/wtools.h"
 #include "../src/wtools.h"
@@ -77,7 +80,7 @@ edit_syntax_dialog (void) {
     }
     }
 
 
     old_auto_syntax = option_auto_syntax;
     old_auto_syntax = option_auto_syntax;
-    old_syntax_type = g_strdup (option_syntax_type);
+    old_syntax_type = mhl_str_dup (option_syntax_type);
 
 
     switch (syntax) {
     switch (syntax) {
 	case 0: /* auto syntax */
 	case 0: /* auto syntax */
@@ -89,7 +92,7 @@ edit_syntax_dialog (void) {
 	default:
 	default:
 	    option_auto_syntax = 0;
 	    option_auto_syntax = 0;
 	    g_free (option_syntax_type);
 	    g_free (option_syntax_type);
-	    option_syntax_type = g_strdup (names[syntax - N_DFLT_ENTRIES]);
+	    option_syntax_type = mhl_str_dup (names[syntax - N_DFLT_ENTRIES]);
     }
     }
 
 
     /* Load or unload syntax rules if the option has changed */
     /* Load or unload syntax rules if the option has changed */

+ 20 - 20
edit/editcmd.c

@@ -297,14 +297,14 @@ edit_save_file (WEdit *edit, const char *filename)
 	const char *slashpos;
 	const char *slashpos;
 	slashpos = strrchr (filename, PATH_SEP);
 	slashpos = strrchr (filename, PATH_SEP);
 	if (slashpos) {
 	if (slashpos) {
-	    savedir = g_strdup (filename);
+	    savedir = mhl_str_dup (filename);
 	    savedir[slashpos - filename + 1] = '\0';
 	    savedir[slashpos - filename + 1] = '\0';
 	} else
 	} else
-	    savedir = g_strdup (".");
+	    savedir = mhl_str_dup (".");
 	saveprefix = mhl_str_dir_plus_file (savedir, "cooledit");
 	saveprefix = mhl_str_dir_plus_file (savedir, "cooledit");
-	g_free (savedir);
+	mhl_mem_free (savedir);
 	fd = mc_mkstemps (&savename, saveprefix, NULL);
 	fd = mc_mkstemps (&savename, saveprefix, NULL);
-	g_free (saveprefix);
+	mhl_mem_free (saveprefix);
 	if (!savename)
 	if (!savename)
 	    return 0;
 	    return 0;
 	/* FIXME:
 	/* FIXME:
@@ -314,7 +314,7 @@ edit_save_file (WEdit *edit, const char *filename)
 	 */
 	 */
 	close (fd);
 	close (fd);
     } else
     } else
-	savename = g_strdup (filename);
+	savename = mhl_str_dup (filename);
 
 
     mc_chown (savename, edit->stat1.st_uid, edit->stat1.st_gid);
     mc_chown (savename, edit->stat1.st_uid, edit->stat1.st_gid);
     mc_chmod (savename, edit->stat1.st_mode);
     mc_chmod (savename, edit->stat1.st_mode);
@@ -503,10 +503,10 @@ edit_set_filename (WEdit *edit, const char *f)
     g_free (edit->filename);
     g_free (edit->filename);
     if (!f)
     if (!f)
 	f = "";
 	f = "";
-    edit->filename = g_strdup (f);
+    edit->filename = mhl_str_dup (f);
     if (edit->dir == NULL && *f != PATH_SEP)
     if (edit->dir == NULL && *f != PATH_SEP)
 #ifdef USE_VFS
 #ifdef USE_VFS
-	edit->dir = g_strdup (vfs_get_current_dir ());
+	edit->dir = mhl_str_dup (vfs_get_current_dir ());
 #else
 #else
 	edit->dir = g_get_current_dir ();
 	edit->dir = g_get_current_dir ();
 #endif
 #endif
@@ -877,7 +877,7 @@ static int
 edit_load_file_from_filename (WEdit * edit, char *exp)
 edit_load_file_from_filename (WEdit * edit, char *exp)
 {
 {
     int prev_locked = edit->locked;
     int prev_locked = edit->locked;
-    char *prev_filename = g_strdup (edit->filename);
+    char *prev_filename = mhl_str_dup (edit->filename);
 
 
     if (!edit_reload (edit, exp)) {
     if (!edit_reload (edit, exp)) {
 	g_free (prev_filename);
 	g_free (prev_filename);
@@ -1458,7 +1458,7 @@ string_regexp_search (char *pattern, char *string, int match_type,
 	    *found_len = 0;
 	    *found_len = 0;
 	    return -3;
 	    return -3;
 	}
 	}
-	old_pattern = g_strdup (pattern);
+	old_pattern = mhl_str_dup (pattern);
 	old_type = match_type;
 	old_type = match_type;
 	old_icase = icase;
 	old_icase = icase;
     }
     }
@@ -1840,13 +1840,13 @@ edit_replace_cmd (WEdit *edit, int again)
 	again = 0;
 	again = 0;
 
 
     if (again) {
     if (again) {
-	input1 = g_strdup (saved1 ? saved1 : "");
-	input2 = g_strdup (saved2 ? saved2 : "");
-	input3 = g_strdup (saved3 ? saved3 : "");
+	input1 = mhl_str_dup (saved1 ? saved1 : "");
+	input2 = mhl_str_dup (saved2 ? saved2 : "");
+	input3 = mhl_str_dup (saved3 ? saved3 : "");
     } else {
     } else {
-	char *disp1 = g_strdup (saved1 ? saved1 : "");
-	char *disp2 = g_strdup (saved2 ? saved2 : "");
-	char *disp3 = g_strdup (saved3 ? saved3 : "");
+	char *disp1 = mhl_str_dup (saved1 ? saved1 : "");
+	char *disp2 = mhl_str_dup (saved2 ? saved2 : "");
+	char *disp3 = mhl_str_dup (saved3 ? saved3 : "");
 
 
 	convert_to_display (disp1);
 	convert_to_display (disp1);
 	convert_to_display (disp2);
 	convert_to_display (disp2);
@@ -1870,9 +1870,9 @@ edit_replace_cmd (WEdit *edit, int again)
 	    goto cleanup;
 	    goto cleanup;
 	}
 	}
 
 
-	g_free (saved1), saved1 = g_strdup (input1);
-	g_free (saved2), saved2 = g_strdup (input2);
-	g_free (saved3), saved3 = g_strdup (input3);
+	g_free (saved1), saved1 = mhl_str_dup (input1);
+	g_free (saved2), saved2 = mhl_str_dup (input2);
+	g_free (saved3), saved3 = mhl_str_dup (input3);
 
 
     }
     }
 
 
@@ -2087,7 +2087,7 @@ void edit_search_cmd (WEdit * edit, int again)
     if (again) {		/*ctrl-hotkey for search again. */
     if (again) {		/*ctrl-hotkey for search again. */
 	if (!old)
 	if (!old)
 	    return;
 	    return;
-	exp = g_strdup (old);
+	exp = mhl_str_dup (old);
     } else {
     } else {
 
 
 #ifdef HAVE_CHARSET
 #ifdef HAVE_CHARSET
@@ -2109,7 +2109,7 @@ void edit_search_cmd (WEdit * edit, int again)
 	if (*exp) {
 	if (*exp) {
 	    int len = 0;
 	    int len = 0;
 	    g_free (old);
 	    g_free (old);
-	    old = g_strdup (exp);
+	    old = mhl_str_dup (exp);
 
 
 	    if (search_create_bookmark) {
 	    if (search_create_bookmark) {
 		int found = 0, books = 0;
 		int found = 0, books = 0;

+ 4 - 3
edit/editlock.c

@@ -22,8 +22,8 @@
 */
 */
 
 
 #include <config.h>
 #include <config.h>
-#include <signal.h>		/* kill() */
 
 
+#include <signal.h>		/* kill() */
 #include <stdio.h>
 #include <stdio.h>
 #include <stdarg.h>
 #include <stdarg.h>
 #include <sys/types.h>
 #include <sys/types.h>
@@ -34,9 +34,10 @@
 #include <ctype.h>
 #include <ctype.h>
 #include <errno.h>
 #include <errno.h>
 #include <sys/stat.h>
 #include <sys/stat.h>
-
 #include <stdlib.h>
 #include <stdlib.h>
 
 
+#include <mhl/string.h>
+
 #include "../src/global.h"
 #include "../src/global.h"
 
 
 #include "edit.h"
 #include "edit.h"
@@ -96,7 +97,7 @@ lock_build_symlink_name (const char *fname)
 	return NULL;
 	return NULL;
 
 
     fname = x_basename (absolute_fname);
     fname = x_basename (absolute_fname);
-    fname_copy = g_strdup (fname);
+    fname_copy = mhl_str_dup (fname);
     absolute_fname[fname - absolute_fname] = '\0';
     absolute_fname[fname - absolute_fname] = '\0';
     symlink_name = g_strconcat (absolute_fname, ".#", fname_copy, (char *) NULL);
     symlink_name = g_strconcat (absolute_fname, ".#", fname_copy, (char *) NULL);
     g_free (fname_copy);
     g_free (fname_copy);

+ 20 - 20
edit/syntax.c

@@ -668,7 +668,7 @@ static FILE *open_include_file (const char *filename)
     FILE *f;
     FILE *f;
 
 
     syntax_g_free (error_file_name);
     syntax_g_free (error_file_name);
-    error_file_name = g_strdup (filename);
+    error_file_name = mhl_str_dup (filename);
     if (*filename == PATH_SEP)
     if (*filename == PATH_SEP)
 	return fopen (filename, "r");
 	return fopen (filename, "r");
 
 
@@ -774,8 +774,8 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args, int args_size)
 		}
 		}
 		a++;
 		a++;
 		c = r[0] = g_malloc0 (sizeof (struct context_rule));
 		c = r[0] = g_malloc0 (sizeof (struct context_rule));
-		c->left = g_strdup (" ");
-		c->right = g_strdup (" ");
+		c->left = mhl_str_dup (" ");
+		c->right = mhl_str_dup (" ");
 		num_contexts = 0;
 		num_contexts = 0;
 	    } else {
 	    } else {
 		/* Terminate previous context.  */
 		/* Terminate previous context.  */
@@ -788,14 +788,14 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args, int args_size)
 		check_a;
 		check_a;
 		if (!strcmp (*a, "whole")) {
 		if (!strcmp (*a, "whole")) {
 		    a++;
 		    a++;
-		    c->whole_word_chars_left = g_strdup (whole_left);
-		    c->whole_word_chars_right = g_strdup (whole_right);
+		    c->whole_word_chars_left = mhl_str_dup (whole_left);
+		    c->whole_word_chars_right = mhl_str_dup (whole_right);
 		} else if (!strcmp (*a, "wholeleft")) {
 		} else if (!strcmp (*a, "wholeleft")) {
 		    a++;
 		    a++;
-		    c->whole_word_chars_left = g_strdup (whole_left);
+		    c->whole_word_chars_left = mhl_str_dup (whole_left);
 		} else if (!strcmp (*a, "wholeright")) {
 		} else if (!strcmp (*a, "wholeright")) {
 		    a++;
 		    a++;
-		    c->whole_word_chars_right = g_strdup (whole_right);
+		    c->whole_word_chars_right = mhl_str_dup (whole_right);
 		}
 		}
 		check_a;
 		check_a;
 		if (!strcmp (*a, "linestart")) {
 		if (!strcmp (*a, "linestart")) {
@@ -803,14 +803,14 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args, int args_size)
 		    c->line_start_left = 1;
 		    c->line_start_left = 1;
 		}
 		}
 		check_a;
 		check_a;
-		c->left = g_strdup (*a++);
+		c->left = mhl_str_dup (*a++);
 		check_a;
 		check_a;
 		if (!strcmp (*a, "linestart")) {
 		if (!strcmp (*a, "linestart")) {
 		    a++;
 		    a++;
 		    c->line_start_right = 1;
 		    c->line_start_right = 1;
 		}
 		}
 		check_a;
 		check_a;
-		c->right = g_strdup (*a++);
+		c->right = mhl_str_dup (*a++);
 		c->first_left = *c->left;
 		c->first_left = *c->left;
 		c->first_right = *c->right;
 		c->first_right = *c->right;
 	    }
 	    }
@@ -827,7 +827,7 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args, int args_size)
 	    g_strlcpy (last_fg, fg ? fg : "", sizeof (last_fg));
 	    g_strlcpy (last_fg, fg ? fg : "", sizeof (last_fg));
 	    g_strlcpy (last_bg, bg ? bg : "", sizeof (last_bg));
 	    g_strlcpy (last_bg, bg ? bg : "", sizeof (last_bg));
 	    c->keyword[0]->color = this_try_alloc_color_pair (fg, bg);
 	    c->keyword[0]->color = this_try_alloc_color_pair (fg, bg);
-	    c->keyword[0]->keyword = g_strdup (" ");
+	    c->keyword[0]->keyword = mhl_str_dup (" ");
 	    check_not_a;
 	    check_not_a;
 
 
 	    alloc_words_per_context = MAX_WORDS_PER_CONTEXT;
 	    alloc_words_per_context = MAX_WORDS_PER_CONTEXT;
@@ -853,14 +853,14 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args, int args_size)
 	    k = r[num_contexts - 1]->keyword[num_words] = g_malloc0 (sizeof (struct key_word));
 	    k = r[num_contexts - 1]->keyword[num_words] = g_malloc0 (sizeof (struct key_word));
 	    if (!strcmp (*a, "whole")) {
 	    if (!strcmp (*a, "whole")) {
 		a++;
 		a++;
-		k->whole_word_chars_left = g_strdup (whole_left);
-		k->whole_word_chars_right = g_strdup (whole_right);
+		k->whole_word_chars_left = mhl_str_dup (whole_left);
+		k->whole_word_chars_right = mhl_str_dup (whole_right);
 	    } else if (!strcmp (*a, "wholeleft")) {
 	    } else if (!strcmp (*a, "wholeleft")) {
 		a++;
 		a++;
-		k->whole_word_chars_left = g_strdup (whole_left);
+		k->whole_word_chars_left = mhl_str_dup (whole_left);
 	    } else if (!strcmp (*a, "wholeright")) {
 	    } else if (!strcmp (*a, "wholeright")) {
 		a++;
 		a++;
-		k->whole_word_chars_right = g_strdup (whole_right);
+		k->whole_word_chars_right = mhl_str_dup (whole_right);
 	    }
 	    }
 	    check_a;
 	    check_a;
 	    if (!strcmp (*a, "linestart")) {
 	    if (!strcmp (*a, "linestart")) {
@@ -871,7 +871,7 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args, int args_size)
 	    if (!strcmp (*a, "whole")) {
 	    if (!strcmp (*a, "whole")) {
 		break_a;
 		break_a;
 	    }
 	    }
-	    k->keyword = g_strdup (*a++);
+	    k->keyword = mhl_str_dup (*a++);
 	    k->first = *k->keyword;
 	    k->first = *k->keyword;
 	    subst_defines (edit->defines, a, &args[1024]);
 	    subst_defines (edit->defines, a, &args[1024]);
 	    fg = *a;
 	    fg = *a;
@@ -911,12 +911,12 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args, int args_size)
 	    if ((argv = g_tree_lookup (edit->defines, key))) {
 	    if ((argv = g_tree_lookup (edit->defines, key))) {
 		mc_defines_destroy (NULL, argv, NULL);
 		mc_defines_destroy (NULL, argv, NULL);
 	    } else {
 	    } else {
-		key = g_strdup (key);
+		key = mhl_str_dup (key);
 	    }
 	    }
 	    argv = g_new (char *, argc - 1);
 	    argv = g_new (char *, argc - 1);
 	    g_tree_insert (edit->defines, key, argv);
 	    g_tree_insert (edit->defines, key, argv);
 	    while (*a) {
 	    while (*a) {
-		*argv++ = g_strdup (*a++);
+		*argv++ = mhl_str_dup (*a++);
 	    };
 	    };
 	    *argv = NULL;
 	    *argv = NULL;
 	} else {		/* anything else is an error */
 	} else {		/* anything else is an error */
@@ -956,7 +956,7 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args, int args_size)
 	    for (j = 1; c->keyword[j]; j++)
 	    for (j = 1; c->keyword[j]; j++)
 		*p++ = c->keyword[j]->first;
 		*p++ = c->keyword[j]->first;
 	    *p = '\0';
 	    *p = '\0';
-	    c->keyword_first_chars = g_strdup (first_chars);
+	    c->keyword_first_chars = mhl_str_dup (first_chars);
 	}
 	}
 
 
 	g_free (first_chars);
 	g_free (first_chars);
@@ -1077,7 +1077,7 @@ edit_read_syntax_file (WEdit * edit, char ***pnames, const char *syntax_file,
 		else
 		else
 		    abort ();
 		    abort ();
 	    }
 	    }
-	    (*pnames)[count++] = g_strdup (args[2]);
+	    (*pnames)[count++] = mhl_str_dup (args[2]);
 	    (*pnames)[count] = NULL;
 	    (*pnames)[count] = NULL;
 	} else if (type) {
 	} else if (type) {
 
 
@@ -1119,7 +1119,7 @@ edit_read_syntax_file (WEdit * edit, char ***pnames, const char *syntax_file,
 			result = line_error;
 			result = line_error;
 		} else {
 		} else {
 		    syntax_g_free (edit->syntax_type);
 		    syntax_g_free (edit->syntax_type);
-		    edit->syntax_type = g_strdup (syntax_type);
+		    edit->syntax_type = mhl_str_dup (syntax_type);
 
 
 /* if there are no rules then turn off syntax highlighting for speed */
 /* if there are no rules then turn off syntax highlighting for speed */
 		    if (!g && !edit->rules[1])
 		    if (!g && !edit->rules[1])

+ 2 - 2
edit/usermap.c

@@ -504,7 +504,7 @@ cmd_label(config_t *cfg, int argc, char *argv[])
     }
     }
 
 
     keymap_add(cfg->keymap, KEY_F(fn), cmd->val);
     keymap_add(cfg->keymap, KEY_F(fn), cmd->val);
-    cfg->labels[fn - 1] = g_strdup(label);
+    cfg->labels[fn - 1] = mhl_str_dup(label);
 
 
     return true;
     return true;
 }
 }
@@ -552,7 +552,7 @@ parse_file(config_t *cfg, const char *file, const command_t *cmd)
 	}
 	}
 
 
 	if (!(c->handler(cfg, args->len, argv))) {
 	if (!(c->handler(cfg, args->len, argv))) {
-	    char *ss = g_strdup(error_msg);
+	    char *ss = mhl_str_dup(error_msg);
 	    snprintf(error_msg, sizeof(error_msg),
 	    snprintf(error_msg, sizeof(error_msg),
 			 _("%s:%d: %s"), file, line, ss);
 			 _("%s:%d: %s"), file, line, ss);
 	    g_free(ss);
 	    g_free(ss);

+ 13 - 12
src/boxes.c

@@ -27,10 +27,11 @@
 #include <stdio.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdlib.h>
 #include <string.h>
 #include <string.h>
-
 #include <sys/types.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/stat.h>
 
 
+#include <mhl/string.h>
+
 #include "global.h"
 #include "global.h"
 #include "tty.h"
 #include "tty.h"
 #include "win.h"		/* Our window tools */
 #include "win.h"		/* Our window tools */
@@ -227,14 +228,14 @@ display_box (WPanel *panel, char **userp, char **minip, int *use_msformat, int n
         p = get_nth_panel_name (num);
         p = get_nth_panel_name (num);
         panel = g_new (WPanel, 1);
         panel = g_new (WPanel, 1);
         panel->list_type = list_full;
         panel->list_type = list_full;
-        panel->user_format = g_strdup (DEFAULT_USER_FORMAT);
+        panel->user_format = mhl_str_dup (DEFAULT_USER_FORMAT);
         panel->user_mini_status = 0;
         panel->user_mini_status = 0;
 	for (i = 0; i < LIST_TYPES; i++)
 	for (i = 0; i < LIST_TYPES; i++)
-    	    panel->user_status_format[i] = g_strdup (DEFAULT_USER_FORMAT);
+    	    panel->user_status_format[i] = mhl_str_dup (DEFAULT_USER_FORMAT);
         section = g_strconcat ("Temporal:", p, (char *) NULL);
         section = g_strconcat ("Temporal:", p, (char *) NULL);
         if (!profile_has_section (section, profile_name)) {
         if (!profile_has_section (section, profile_name)) {
             g_free (section);
             g_free (section);
-            section = g_strdup (p);
+            section = mhl_str_dup (p);
         }
         }
         panel_load_setup (panel, section);
         panel_load_setup (panel, section);
         g_free (section);
         g_free (section);
@@ -257,8 +258,8 @@ display_box (WPanel *panel, char **userp, char **minip, int *use_msformat, int n
     
     
     if (dd->ret_value != B_CANCEL){
     if (dd->ret_value != B_CANCEL){
 	result = my_radio->sel;
 	result = my_radio->sel;
-	*userp = g_strdup (user->buffer);
-	*minip = g_strdup (status->buffer);
+	*userp = mhl_str_dup (user->buffer);
+	*minip = mhl_str_dup (status->buffer);
 	*use_msformat = check_status->state & C_BOOL;
 	*use_msformat = check_status->state & C_BOOL;
     }
     }
     destroy_dlg (dd);
     destroy_dlg (dd);
@@ -691,7 +692,7 @@ tree_box (const char *current_dir)
     
     
     run_dlg (dlg);
     run_dlg (dlg);
     if (dlg->ret_value == B_ENTER)
     if (dlg->ret_value == B_ENTER)
-	val = g_strdup (tree_selected_name (mytree));
+	val = mhl_str_dup (tree_selected_name (mytree));
     else
     else
 	val = 0;
 	val = 0;
     
     
@@ -1113,11 +1114,11 @@ vfs_smb_get_authinfo (const char *host, const char *share, const char *domain,
     default:
     default:
         return_value = g_new (struct smb_authinfo, 1);
         return_value = g_new (struct smb_authinfo, 1);
         if (return_value) {
         if (return_value) {
-            return_value->host = g_strdup (host);
-            return_value->share = g_strdup (share);
-            return_value->domain = g_strdup (in_domain->buffer);
-            return_value->user = g_strdup (in_user->buffer);
-            return_value->password = g_strdup (in_password->buffer);
+            return_value->host = mhl_str_dup (host);
+            return_value->share = mhl_str_dup (share);
+            return_value->domain = mhl_str_dup (in_domain->buffer);
+            return_value->user = mhl_str_dup (in_user->buffer);
+            return_value->password = mhl_str_dup (in_password->buffer);
         }
         }
     }
     }
 
 

+ 3 - 3
src/charsets.c

@@ -88,12 +88,12 @@ load_codepages_list (void)
 	    goto fail;
 	    goto fail;
 
 
 	if (strcmp (buf, "default") == 0) {
 	if (strcmp (buf, "default") == 0) {
-	    default_codepage = g_strdup (p);
+	    default_codepage = mhl_str_dup (p);
 	    continue;
 	    continue;
 	}
 	}
 
 
-	codepages[n_codepages].id = g_strdup (buf);
-	codepages[n_codepages].name = g_strdup (p);
+	codepages[n_codepages].id = mhl_str_dup (buf);
+	codepages[n_codepages].name = mhl_str_dup (p);
 	++n_codepages;
 	++n_codepages;
     }
     }
 
 

+ 6 - 7
src/cmd.c

@@ -23,7 +23,6 @@
 #include <errno.h>
 #include <errno.h>
 #include <stdio.h>
 #include <stdio.h>
 #include <string.h>
 #include <string.h>
-
 #include <sys/types.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/stat.h>
 #ifdef HAVE_MMAP
 #ifdef HAVE_MMAP
@@ -371,7 +370,7 @@ mkdir_cmd (void)
 	return;
 	return;
 
 
     if (dir[0] == '/' || dir[0] == '~')
     if (dir[0] == '/' || dir[0] == '~')
-	absdir = g_strdup (dir);
+	absdir = mhl_str_dup (dir);
     else
     else
 	absdir = mhl_str_dir_plus_file (current_panel->cwd, dir);
 	absdir = mhl_str_dir_plus_file (current_panel->cwd, dir);
 
 
@@ -613,7 +612,7 @@ menu_edit_cmd (int where)
 
 
     switch (dir) {
     switch (dir) {
 	case 0:
 	case 0:
-	    buffer = g_strdup (where ? CEDIT_LOCAL_MENU : MC_LOCAL_MENU);
+	    buffer = mhl_str_dup (where ? CEDIT_LOCAL_MENU : MC_LOCAL_MENU);
 	    check_for_default (menufile, buffer);
 	    check_for_default (menufile, buffer);
 	    break;
 	    break;
 
 
@@ -936,7 +935,7 @@ do_link (int symbolic_link, const char *fname)
 	if (get_other_type () == view_listing) {
 	if (get_other_type () == view_listing) {
 	    d = mhl_str_dir_plus_file (other_panel->cwd, fname);
 	    d = mhl_str_dir_plus_file (other_panel->cwd, fname);
 	} else {
 	} else {
-	    d = g_strdup (fname);
+	    d = mhl_str_dup (fname);
 	}
 	}
 
 
 	symlink_dialog (s, d, &dest, &src);
 	symlink_dialog (s, d, &dest, &src);
@@ -1055,7 +1054,7 @@ char *guess_message_value (void)
     if (locale == NULL)
     if (locale == NULL)
 	locale = "";
 	locale = "";
 
 
-    return g_strdup (locale);
+    return mhl_str_dup (locale);
 }
 }
 
 
 /*
 /*
@@ -1073,7 +1072,7 @@ get_random_hint (int force)
     /* Do not change hints more often than one minute */
     /* Do not change hints more often than one minute */
     gettimeofday (&tv, NULL);
     gettimeofday (&tv, NULL);
     if (!force && !(tv.tv_sec > last_sec + 60))
     if (!force && !(tv.tv_sec > last_sec + 60))
-	return g_strdup ("");
+	return mhl_str_dup ("");
     last_sec = tv.tv_sec;
     last_sec = tv.tv_sec;
 
 
     data = load_mc_home_file (MC_HINT, NULL);
     data = load_mc_home_file (MC_HINT, NULL);
@@ -1094,7 +1093,7 @@ get_random_hint (int force)
     eol = strchr (&data[start], '\n');
     eol = strchr (&data[start], '\n');
     if (eol)
     if (eol)
 	*eol = 0;
 	*eol = 0;
-    result = g_strdup (&data[start]);
+    result = mhl_str_dup (&data[start]);
     g_free (data);
     g_free (data);
     return result;
     return result;
 }
 }

+ 7 - 5
src/color.c

@@ -22,6 +22,8 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <string.h>
 #include <string.h>
 
 
+#include <mhl/string.h>
+
 #include "global.h"
 #include "global.h"
 #include "tty.h"
 #include "tty.h"
 #include "setup.h"		/* For the externs */
 #include "setup.h"		/* For the externs */
@@ -226,7 +228,7 @@ static void configure_colors_string (const char *the_color_string)
     if (!the_color_string)
     if (!the_color_string)
 	return;
 	return;
 
 
-    p = color_string = g_strdup (the_color_string);
+    p = color_string = mhl_str_dup (the_color_string);
     while (color_string && *color_string){
     while (color_string && *color_string){
 	while (*color_string == ' ' || *color_string == '\t')
 	while (*color_string == ' ' || *color_string == '\t')
 	    color_string++;
 	    color_string++;
@@ -395,8 +397,8 @@ try_alloc_color_pair (const char *fg, const char *bg)
     p->next = g_new (struct colors_avail, 1);
     p->next = g_new (struct colors_avail, 1);
     p = p->next;
     p = p->next;
     p->next = 0;
     p->next = 0;
-    p->fg = fg ? g_strdup (fg) : 0;
-    p->bg = bg ? g_strdup (bg) : 0;
+    p->fg = fg ? mhl_str_dup (fg) : 0;
+    p->bg = bg ? mhl_str_dup (bg) : 0;
     if (!fg)
     if (!fg)
         /* Index in color_map array = COLOR_INDEX - 1 */
         /* Index in color_map array = COLOR_INDEX - 1 */
 	fg = color_map[EDITOR_NORMAL_COLOR_INDEX - 1].fg;
 	fg = color_map[EDITOR_NORMAL_COLOR_INDEX - 1].fg;
@@ -434,8 +436,8 @@ try_alloc_color_pair (const char *fg, const char *bg)
     p->next = g_new (struct colors_avail, 1);
     p->next = g_new (struct colors_avail, 1);
     p = p->next;
     p = p->next;
     p->next = 0;
     p->next = 0;
-    p->fg = fg ? g_strdup (fg) : 0;
-    p->bg = bg ? g_strdup (bg) : 0;
+    p->fg = fg ? mhl_str_dup (fg) : 0;
+    p->bg = bg ? mhl_str_dup (bg) : 0;
     if (!fg)
     if (!fg)
         /* Index in color_map array = COLOR_INDEX - 1 */
         /* Index in color_map array = COLOR_INDEX - 1 */
 	fg_index = color_map[EDITOR_NORMAL_COLOR_INDEX - 1].fg;
 	fg_index = color_map[EDITOR_NORMAL_COLOR_INDEX - 1].fg;

Some files were not shown because too many files changed in this diff