From b9770941ae829ad2cb985efe809d6e3dd690648b Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 7 Oct 2011 18:02:34 -0700 Subject: Call strdup directly, instead of via copy macro Signed-off-by: Alan Coopersmith --- def.h | 1 - include.c | 6 +++--- main.c | 2 +- parse.c | 6 +++--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/def.h b/def.h index ce344a8..3f55a52 100644 --- a/def.h +++ b/def.h @@ -130,7 +130,6 @@ struct filepointer { #include -#define copy(s) strdup(s) int match(const char *str, const char * const *list); char *base_name(const char *file); char *getnextline(struct filepointer *fp); diff --git a/include.c b/include.c index ebbdacf..4455005 100644 --- a/include.c +++ b/include.c @@ -56,7 +56,7 @@ issymbolic(const char *dir, const char *component) return (TRUE); if (lstat(buf, &st) == 0 && (st.st_mode & S_IFMT) == S_IFLNK) { - *pp++ = copy(buf); + *pp++ = strdup(buf); if (pp >= ¬dotdot[ MAXDIRS ]) fatalerr("out of .. dirs, increase MAXDIRS\n"); return(TRUE); @@ -153,12 +153,12 @@ newinclude(const char *newfile, const char *incstring) ip = inclistp++; if (inclistp == inclist + MAXFILES - 1) fatalerr("out of space: increase MAXFILES\n"); - ip->i_file = copy(newfile); + ip->i_file = strdup(newfile); if (incstring == NULL) ip->i_incstring = ip->i_file; else - ip->i_incstring = copy(incstring); + ip->i_incstring = strdup(incstring); inclistnext = inclistp; return(ip); diff --git a/main.c b/main.c index f1a093a..bb66f82 100644 --- a/main.c +++ b/main.c @@ -742,7 +742,7 @@ done: char *base_name(const char *in_file) { char *p; - char *file = copy(in_file); + char *file = strdup(in_file); for(p=file+strlen(file); p>file && *p != '.'; p--) ; if (*p == '.') diff --git a/parse.c b/parse.c index 0496388..d14cbf8 100644 --- a/parse.c +++ b/parse.c @@ -376,7 +376,7 @@ define2(const char *name, const char *val, struct inclist *file) debug(1,("redefining %s from %s to %s in file %s\n", name, (*sp)->s_value, val, file->i_file)); free((*sp)->s_value); - (*sp)->s_value = copy(val); + (*sp)->s_value = strdup(val); return; } @@ -392,8 +392,8 @@ define2(const char *name, const char *val, struct inclist *file) fatalerr("malloc()/realloc() failure in insert_defn()\n"); debug(1,("defining %s to %s in file %s\n", name, val, file->i_file)); - stab->s_name = copy(name); - stab->s_value = copy(val); + stab->s_name = strdup(name); + stab->s_value = strdup(val); *sp = stab; } -- cgit v1.2.1