diff options
author | markj <markj@FreeBSD.org> | 2013-08-16 03:41:41 +0000 |
---|---|---|
committer | markj <markj@FreeBSD.org> | 2013-08-16 03:41:41 +0000 |
commit | e46116864019a4bea0415b802b1e07a53e0b4577 (patch) | |
tree | 567ed6e9bfc02b8cbeddb7e42a45a8a54f9623f3 | |
parent | fe073d00ee5f424ed78c27d790357e9a09dc6849 (diff) | |
download | FreeBSD-src-e46116864019a4bea0415b802b1e07a53e0b4577.zip FreeBSD-src-e46116864019a4bea0415b802b1e07a53e0b4577.tar.gz |
Use strdup(9) instead of reimplementing it.
-rw-r--r-- | sys/kern/kern_linker.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c index 3e500f3..b05ae3b 100644 --- a/sys/kern/kern_linker.c +++ b/sys/kern/kern_linker.c @@ -153,16 +153,6 @@ static int linker_load_module(const char *kldname, struct mod_depend *verinfo, struct linker_file **lfpp); static modlist_t modlist_lookup2(const char *name, struct mod_depend *verinfo); -static char * -linker_strdup(const char *str) -{ - char *result; - - if ((result = malloc((strlen(str) + 1), M_LINKER, M_WAITOK)) != NULL) - strcpy(result, str); - return (result); -} - static void linker_init(void *arg) { @@ -577,8 +567,8 @@ linker_make_file(const char *pathname, linker_class_t lc) lf->refs = 1; lf->userrefs = 0; lf->flags = 0; - lf->filename = linker_strdup(filename); - lf->pathname = linker_strdup(pathname); + lf->filename = strdup(filename, M_LINKER); + lf->pathname = strdup(pathname, M_LINKER); LINKER_GET_NEXT_FILE_ID(lf->id); lf->ndeps = 0; lf->deps = NULL; @@ -1918,7 +1908,7 @@ linker_search_kld(const char *name) /* qualified at all? */ if (strchr(name, '/')) - return (linker_strdup(name)); + return (strdup(name, M_LINKER)); /* traverse the linker path */ len = strlen(name); @@ -2011,7 +2001,7 @@ linker_load_module(const char *kldname, const char *modname, if (modlist_lookup2(modname, verinfo) != NULL) return (EEXIST); if (kldname != NULL) - pathname = linker_strdup(kldname); + pathname = strdup(kldname, M_LINKER); else if (rootvnode == NULL) pathname = NULL; else |