From 51276f1ac5fd337a8bffbda3099c0bd86b6503cf Mon Sep 17 00:00:00 2001 From: Simon Gomizelj Date: Thu, 7 Mar 2013 01:24:15 -0500 Subject: remove the duplicate strnlen and strndup Signed-off-by: Simon Gomizelj Signed-off-by: Allan McRae --- src/pacman/util.c | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'src') diff --git a/src/pacman/util.c b/src/pacman/util.c index 57968a49..cce1a185 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -1692,26 +1692,4 @@ int pm_vfprintf(FILE *stream, alpm_loglevel_t level, const char *format, va_list return ret; } -#ifndef HAVE_STRNDUP -/* A quick and dirty implementation derived from glibc */ -static size_t strnlen(const char *s, size_t max) -{ - register const char *p; - for(p = s; *p && max--; ++p); - return (p - s); -} - -char *strndup(const char *s, size_t n) -{ - size_t len = strnlen(s, n); - char *new = (char *) malloc(len + 1); - - if(new == NULL) - return NULL; - - new[len] = '\0'; - return (char *)memcpy(new, s, len); -} -#endif - /* vim: set ts=2 sw=2 noet: */ -- cgit v1.2.3-70-g09d2