diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2016-11-15 13:37:14 +0900 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2016-11-15 14:23:17 +0900 |
| commit | 24f5e2fc62606c25c4b43e2dd77aea9aa721acba (patch) | |
| tree | 3aa5ce435a7fef3f8a7b568e5ac808b851664db1 /lib/str.c | |
| parent | a89b1641fd23740daf9a7331417b1373aa3d5932 (diff) | |
build: massively remove needless checks
Since we have autoconf results from a wide swath of target platforms, we
can go remove checks that have the same result on all systems.
This also removes several "fallback" implementations of functions that,
at some point in the history, weren't available on all target platforms.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/str.c')
| -rw-r--r-- | lib/str.c | 40 |
1 files changed, 0 insertions, 40 deletions
@@ -37,22 +37,6 @@ #include <zebra.h> -#ifndef HAVE_SNPRINTF -/* - * snprint() is a real basic wrapper around the standard sprintf() - * without any bounds checking - */ -int -snprintf(char *str, size_t size, const char *format, ...) -{ - va_list args; - - va_start (args, format); - - return vsprintf (str, format, args); -} -#endif - #ifndef HAVE_STRLCPY /* * Copy string src to buffer dst of size dsize. At most dsize-1 @@ -109,27 +93,3 @@ strlcat(char *d, const char *s, size_t bufsize) return ret; } #endif - -#ifndef HAVE_STRNLEN -size_t -strnlen(const char *s, size_t maxlen) -{ - const char *p; - return (p = (const char *)memchr(s, '\0', maxlen)) ? (size_t)(p-s) : maxlen; -} -#endif - -#ifndef HAVE_STRNDUP -char * -strndup (const char *s, size_t maxlen) -{ - size_t len = strnlen (s, maxlen); - char *new = (char *) malloc (len + 1); - - if (new == NULL) - return NULL; - - new[len] = '\0'; - return (char *) memcpy (new, s, len); -} -#endif |
