Merge pull request #96 from rouault/remove_strdnup

Remove redefinition of strndup() which is no longer used in the codebase
diff --git a/config.h.in b/config.h.in
index b8b2d17..a912bb0 100644
--- a/config.h.in
+++ b/config.h.in
@@ -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
 
diff --git a/configure.in b/configure.in
index c5494a9..64f9cbe 100644
--- a/configure.in
+++ b/configure.in
@@ -35,7 +35,7 @@
 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])
diff --git a/json_object.c b/json_object.c
index b63faa4..1b3fc76 100644
--- a/json_object.c
+++ b/json_object.c
@@ -34,10 +34,6 @@
 # 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
diff --git a/json_tokener.c b/json_tokener.c
index 8019d70..7e1fb68 100644
--- a/json_tokener.c
+++ b/json_tokener.c
@@ -170,29 +170,6 @@
     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