summaryrefslogtreecommitdiff
path: root/src/pacman/util.c
diff options
context:
space:
mode:
authorSimon Gomizelj <simongmzlj@gmail.com>2013-03-07 01:24:15 -0500
committerAllan McRae <allan@archlinux.org>2013-03-10 09:01:56 +1000
commit51276f1ac5fd337a8bffbda3099c0bd86b6503cf (patch)
tree5ab20dbb244ba215265819b0ee0bf61986e7eb07 /src/pacman/util.c
parent08a1244f4ef952be0c4897b9c5fee12a214be3f9 (diff)
remove the duplicate strnlen and strndup
Signed-off-by: Simon Gomizelj <simongmzlj@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src/pacman/util.c')
-rw-r--r--src/pacman/util.c22
1 files changed, 0 insertions, 22 deletions
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: */