return (wchar_t *)curlx_memdup(src, (length + 1) * sizeof(wchar_t));
}
-#elif !defined(HAVE_STRDUP)
-char *curlx_strdup_low(const char *str)
-{
- size_t len;
- char *newstr;
-
- if(!str)
- return NULL;
-
- len = strlen(str) + 1;
-
- newstr = curlx_malloc(len);
- if(!newstr)
- return NULL;
-
- memcpy(newstr, str, len);
- return newstr;
-}
#endif
/***************************************************************************
])
-dnl CURL_CHECK_FUNC_STRDUP
-dnl -------------------------------------------------
-dnl Verify if strdup is available, prototyped, and
-dnl can be compiled. If all of these are true, and
-dnl usage has not been previously disallowed with
-dnl shell variable curl_disallow_strdup, then
-dnl HAVE_STRDUP will be defined.
-
-AC_DEFUN([CURL_CHECK_FUNC_STRDUP], [
- AC_REQUIRE([CURL_INCLUDES_STRING])dnl
- AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
- #
- tst_links_strdup="unknown"
- tst_proto_strdup="unknown"
- tst_compi_strdup="unknown"
- tst_allow_strdup="unknown"
- #
- AC_MSG_CHECKING([if strdup can be linked])
- AC_LINK_IFELSE([
- AC_LANG_FUNC_LINK_TRY([strdup])
- ],[
- AC_MSG_RESULT([yes])
- tst_links_strdup="yes"
- ],[
- AC_MSG_RESULT([no])
- tst_links_strdup="no"
- ])
- #
- if test "$tst_links_strdup" = "yes"; then
- AC_MSG_CHECKING([if strdup is prototyped])
- AC_EGREP_CPP([strdup],[
- $curl_includes_string
- ],[
- AC_MSG_RESULT([yes])
- tst_proto_strdup="yes"
- ],[
- AC_MSG_RESULT([no])
- tst_proto_strdup="no"
- ])
- fi
- #
- if test "$tst_proto_strdup" = "yes"; then
- AC_MSG_CHECKING([if strdup is compilable])
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([[
- $curl_includes_string
- $curl_includes_stdlib
- ]],[[
- free(strdup(""));
- ]])
- ],[
- AC_MSG_RESULT([yes])
- tst_compi_strdup="yes"
- ],[
- AC_MSG_RESULT([no])
- tst_compi_strdup="no"
- ])
- fi
- #
- if test "$tst_compi_strdup" = "yes"; then
- AC_MSG_CHECKING([if strdup usage allowed])
- if test "x$curl_disallow_strdup" != "xyes"; then
- AC_MSG_RESULT([yes])
- tst_allow_strdup="yes"
- else
- AC_MSG_RESULT([no])
- tst_allow_strdup="no"
- fi
- fi
- #
- AC_MSG_CHECKING([if strdup might be used])
- if test "$tst_links_strdup" = "yes" &&
- test "$tst_proto_strdup" = "yes" &&
- test "$tst_compi_strdup" = "yes" &&
- test "$tst_allow_strdup" = "yes"; then
- AC_MSG_RESULT([yes])
- AC_DEFINE_UNQUOTED(HAVE_STRDUP, 1,
- [Define to 1 if you have the strdup function.])
- curl_cv_func_strdup="yes"
- else
- AC_MSG_RESULT([no])
- curl_cv_func_strdup="no"
- fi
-])
-
-
dnl CURL_CHECK_FUNC_STRERROR_R
dnl -------------------------------------------------
dnl Verify if strerror_r is available, prototyped, can be compiled and