diff options
author | Max Kellermann <max@duempel.org> | 2013-04-09 01:03:44 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-04-09 01:03:44 +0200 |
commit | 14df240f5b16822da0901b35f7d0cb053c895129 (patch) | |
tree | a7f3be85b1bbf8f98c42ec34cba91c2fad8ccd0d /src/string_util.c | |
parent | 2090911363a131b2a38d39d3b8458eae02889e57 (diff) | |
download | mpd-14df240f5b16822da0901b35f7d0cb053c895129.tar.gz mpd-14df240f5b16822da0901b35f7d0cb053c895129.tar.xz mpd-14df240f5b16822da0901b35f7d0cb053c895129.zip |
OpusReader: don't use strndup()
Eliminate the fallback strndup() and strnlen() implementations.
Diffstat (limited to 'src/string_util.c')
-rw-r--r-- | src/string_util.c | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/src/string_util.c b/src/string_util.c index 5d9feccf9..00c36892b 100644 --- a/src/string_util.c +++ b/src/string_util.c @@ -17,11 +17,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "config.h" #include "string_util.h" -#include <stdlib.h> /* for malloc() */ -#include <string.h> /* for strnlen() */ #include <glib.h> #include <assert.h> @@ -47,37 +44,3 @@ string_array_contains(const char *const* haystack, const char *needle) return false; } - -#ifndef HAVE_STRNLEN - -size_t -strnlen(const char *s, size_t max) -{ - assert(s != NULL); - - const char *t = memchr(s, 0, max); - return t != NULL - ? (size_t)(t - s) - : max; -} - -#endif - -#if !defined(HAVE_STRNDUP) - -char * -strndup(const char *str, size_t n) -{ - assert(str != NULL); - - size_t len = strnlen(str, n); - char* ret = (char *) malloc(len + 1); - if (ret == NULL) - return NULL; - - memcpy(ret, str, len); - ret[len] = '\0'; - return ret; -} - -#endif |