From c5fd006bf802bf6ccfd1e7a0c6422b71ea1fb9b1 Mon Sep 17 00:00:00 2001 From: Jim Rees Date: Thu, 26 Oct 2006 17:34:31 +0000 Subject: [PATCH] use-strdup-20061026 use strdup instead of rolling our own --- src/aklog/aklog_main.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/aklog/aklog_main.c b/src/aklog/aklog_main.c index 33e181b..0200fc0 100644 --- a/src/aklog/aklog_main.c +++ b/src/aklog/aklog_main.c @@ -247,17 +247,6 @@ static char *copy_cellinfo(cellinfo_t *cellinfo) } -static char *copy_string(char *string) -{ - char *new_string; - - if ((new_string = (char *)calloc(strlen(string) + 1, sizeof(char)))) - (void) strcpy(new_string, string); - - return (new_string); -} - - static int get_cellconfig(char *cell, struct afsconf_cell *cellconfig, char *local_cell, char *linkedcell) { int status = AKLOG_SUCCESS; @@ -1358,8 +1347,8 @@ void aklog(int argc, char *argv[]) else if (pmode) { /* Add this path to list of paths */ if ((cur_node = ll_add_node(&paths, ll_tail))) { - char *new_path; - if ((new_path = copy_string(path))) + char *new_path; + if ((new_path = strdup(path))) ll_add_data(cur_node, new_path); else { fprintf(stderr, "%s: failure copying path name.\n", -- 1.9.4