diff options
author | Anil Madhavapeddy <avsm@cvs.openbsd.org> | 2003-04-05 18:02:33 +0000 |
---|---|---|
committer | Anil Madhavapeddy <avsm@cvs.openbsd.org> | 2003-04-05 18:02:33 +0000 |
commit | 1f0e81c53a4195d6f54cd0c8d4ba9d174bdb349e (patch) | |
tree | 538d40315f3edd7db4a34197f59bdf6b9c74b258 /usr.sbin | |
parent | e0189df64ad42bc11ea4ca37d91dd0113769a0b5 (diff) |
remove a dead function, simplify copy_string with strdup ; rohee@ ok
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_install/lib/str.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/usr.sbin/pkg_install/lib/str.c b/usr.sbin/pkg_install/lib/str.c index f6294699b7c..4a251eca5e4 100644 --- a/usr.sbin/pkg_install/lib/str.c +++ b/usr.sbin/pkg_install/lib/str.c @@ -1,7 +1,7 @@ -/* $OpenBSD: str.c,v 1.9 2003/04/05 16:06:01 avsm Exp $ */ +/* $OpenBSD: str.c,v 1.10 2003/04/05 18:02:32 avsm Exp $ */ #ifndef lint -static const char *rcsid = "$OpenBSD: str.c,v 1.9 2003/04/05 16:06:01 avsm Exp $"; +static const char *rcsid = "$OpenBSD: str.c,v 1.10 2003/04/05 18:02:32 avsm Exp $"; #endif /* @@ -94,9 +94,7 @@ copy_string(char *str) if (!str) ret = NULL; else { - int len = strlen(str) + 1; - ret = (char *)malloc(len); - strlcpy(ret, str, len); + ret = strdup(str); } return ret; } @@ -366,17 +364,3 @@ findbestmatchingname(const char *dir, const char *pattern) } return NULL; } - -/* bounds-checking strncpy */ -char * -strnncpy(char *to, size_t tosize, char *from, size_t cc) -{ - size_t len; - - if ((len = cc) >= tosize - 1) { - len = tosize - 1; - } - (void) strncpy(to, from, len); - to[len] = 0; - return to; -} |