]> git.ipfire.org Git - thirdparty/json-c.git/commitdiff
Remove redefinition of strndup() which is no longer used in the codebase 96/head
authorEven Rouault <even.rouault@mines-paris.org>
Mon, 12 Aug 2013 18:49:19 +0000 (20:49 +0200)
committerEven Rouault <even.rouault@mines-paris.org>
Mon, 12 Aug 2013 18:49:19 +0000 (20:49 +0200)
config.h.in
configure.in
json_object.c
json_tokener.c

index b8b2d17ef09580a2ae50b75649e69bb856a14fae..a912bb0ca602c48c1d788da2af7ab310c2a6b7d2 100644 (file)
@@ -68,9 +68,6 @@
 /* Define to 1 if you have the `strncasecmp' function. */
 #undef HAVE_STRNCASECMP
 
-/* Define to 1 if you have the `strndup' function. */
-#undef HAVE_STRNDUP
-
 /* Define to 1 if you have the <syslog.h> header file. */
 #undef HAVE_SYSLOG_H
 
index c5494a9d4654e7bb5c8daacbcb21483ec2213105..64f9cbe57a96ae6b720569fa55c7c0f7f06ce56b 100644 (file)
@@ -35,7 +35,7 @@ AC_FUNC_VPRINTF
 AC_FUNC_MEMCMP
 AC_FUNC_MALLOC
 AC_FUNC_REALLOC
-AC_CHECK_FUNCS(strcasecmp strdup strndup strerror snprintf vsnprintf vasprintf open vsyslog strncasecmp setlocale)
+AC_CHECK_FUNCS(strcasecmp strdup strerror snprintf vsnprintf vasprintf open vsyslog strncasecmp setlocale)
 
 #check if .section.gnu.warning accepts long strings (for __warn_references)
 AC_LANG_PUSH([C])
index e12c4407cbc1cb52bb3c81449957fdefa8403e31..df1a62e25ad8157809d24f72277fd36aedde9d5c 100644 (file)
 # error You do not have strdup on your system.
 #endif /* HAVE_STRDUP */
 
-#if !defined(HAVE_STRNDUP)
-  char* strndup(const char* str, size_t n);
-#endif /* !HAVE_STRNDUP */
-
 #if !defined(HAVE_SNPRINTF) && defined(_MSC_VER)
   /* MSC has the version as _snprintf */
 # define snprintf _snprintf
index a6924a1f579d7506a9e1bc84dc60fd463e574624..24eddb2620635c5d2e835e08036935fadde57b53 100644 (file)
@@ -170,29 +170,6 @@ struct json_object* json_tokener_parse_verbose(const char *str, enum json_tokene
     return obj;
 }
 
-
-#if !HAVE_STRNDUP
-/* CAW: compliant version of strndup() */
-char* strndup(const char* str, size_t n)
-{
-  if(str) {
-    size_t len = strlen(str);
-    size_t nn = json_min(len,n);
-    char* s = (char*)malloc(sizeof(char) * (nn + 1));
-
-    if(s) {
-      memcpy(s, str, nn);
-      s[nn] = '\0';
-    }
-
-    return s;
-  }
-
-  return NULL;
-}
-#endif
-
-
 #define state  tok->stack[tok->depth].state
 #define saved_state  tok->stack[tok->depth].saved_state
 #define current tok->stack[tok->depth].current