diff --git a/src/files.c b/src/files.c index 9c56d311..6445ef69 100644 --- a/src/files.c +++ b/src/files.c @@ -2303,7 +2303,7 @@ char *real_dir_from_tilde(const char *path) if (userdata != NULL) tilded = mallocstrcpy(tilded, userdata->pw_dir); #else - tilded = strdup(""); + tilded = copy_of(""); #endif } diff --git a/src/help.c b/src/help.c index a78cfe8d..6c16da5c 100644 --- a/src/help.c +++ b/src/help.c @@ -103,7 +103,7 @@ void do_help(void) #ifdef ENABLE_COLOR char *was_syntax = syntaxstr; #endif - char *saved_answer = (answer != NULL) ? strdup(answer) : NULL; + char *saved_answer = (answer != NULL) ? copy_of(answer) : NULL; /* The current answer when the user invokes help at the prompt. */ unsigned stash[sizeof(flags) / sizeof(flags[0])]; /* A storage place for the current flag settings. */ diff --git a/src/rcfile.c b/src/rcfile.c index afbf2d0f..5f2c01fe 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -175,7 +175,7 @@ void jot_error(const char *msg, ...) errors_tail = error; if (rcfile_with_errors == NULL) - rcfile_with_errors = strdup(nanorc); + rcfile_with_errors = copy_of(nanorc); if (lineno > 0) length = snprintf(textbuf, MAXSIZE, _("Error in %s on line %zu: "), @@ -326,7 +326,7 @@ void begin_new_syntax(char *ptr) /* Initialize a new syntax struct. */ live_syntax = (syntaxtype *)nmalloc(sizeof(syntaxtype)); live_syntax->name = copy_of(nameptr); - live_syntax->filename = strdup(nanorc); + live_syntax->filename = copy_of(nanorc); live_syntax->lineno = lineno; live_syntax->augmentations = NULL; live_syntax->extensions = NULL; @@ -1050,8 +1050,8 @@ void parse_rcfile(FILE *rcstream, bool just_syntax, bool intros_only) continue; } - argument = strdup(ptr); keyword = ptr; + argument = copy_of(ptr); ptr = parse_next_word(ptr); /* File-matching commands need to be processed immediately; @@ -1064,7 +1064,7 @@ void parse_rcfile(FILE *rcstream, bool just_syntax, bool intros_only) } else { newitem = nmalloc(sizeof(augmentstruct));; - newitem->filename = strdup(nanorc); + newitem->filename = copy_of(nanorc); newitem->lineno = lineno; newitem->data = argument; newitem->next = NULL;