summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@mines-paris.org>2013-08-12 20:49:19 +0200
committerEven Rouault <even.rouault@mines-paris.org>2013-08-12 20:49:19 +0200
commit1a957c2edc4df1ae3ac5396209e19ba8355a624b (patch)
tree86063bd85c1569b770a72f1e8a9cdf3ffff7deee
parentb3bce4d5943774b59d7fa653da89f48db70d013e (diff)
downloadjson-c-1a957c2edc4df1ae3ac5396209e19ba8355a624b.tar.gz
Remove redefinition of strndup() which is no longer used in the codebase
-rw-r--r--config.h.in3
-rw-r--r--configure.in2
-rw-r--r--json_object.c4
-rw-r--r--json_tokener.c23
4 files changed, 1 insertions, 31 deletions
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_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])
diff --git a/json_object.c b/json_object.c
index e12c440..df1a62e 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 a6924a1..24eddb2 100644
--- a/json_tokener.c
+++ b/json_tokener.c
@@ -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