lib: use Curl_str_* instead of strtok_r()

Helps avoid extra mallocs. Gets rid of the private strtok_r
implementation.

Closes #16360
This commit is contained in:
Daniel Stenberg 2025-02-17 09:43:45 +01:00
parent 076444ec46
commit 676de7f580
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
26 changed files with 102 additions and 397 deletions

View file

@ -184,40 +184,6 @@ AC_DEFUN([CURL_CHECK_NEED_REENTRANT_STRERROR_R], [
fi
])
dnl CURL_CHECK_NEED_REENTRANT_STRTOK_R
dnl -------------------------------------------------
dnl Checks if the preprocessor _REENTRANT definition
dnl makes function strtok_r compiler visible.
AC_DEFUN([CURL_CHECK_NEED_REENTRANT_STRTOK_R], [
AC_LINK_IFELSE([
AC_LANG_FUNC_LINK_TRY([strtok_r])
],[
tmp_strtok_r="yes"
],[
tmp_strtok_r="no"
])
if test "$tmp_strtok_r" = "yes"; then
AC_EGREP_CPP([strtok_r],[
#include <sys/types.h>
#include <string.h>
],[
tmp_strtok_r="proto_declared"
],[
AC_EGREP_CPP([strtok_r],[
#define _REENTRANT
#include <sys/types.h>
#include <string.h>
],[
tmp_strtok_r="proto_needs_reentrant"
tmp_need_reentrant="yes"
])
])
fi
])
dnl CURL_CHECK_NEED_REENTRANT_GETHOSTBYNAME_R
dnl -------------------------------------------------
dnl Checks if the preprocessor _REENTRANT definition
@ -300,9 +266,6 @@ AC_DEFUN([CURL_CHECK_NEED_REENTRANT_FUNCTIONS_R], [
if test "$tmp_need_reentrant" = "no"; then
CURL_CHECK_NEED_REENTRANT_STRERROR_R
fi
if test "$tmp_need_reentrant" = "no"; then
CURL_CHECK_NEED_REENTRANT_STRTOK_R
fi
if test "$tmp_need_reentrant" = "no"; then
CURL_CHECK_NEED_REENTRANT_GETHOSTBYNAME_R
fi