Use ldap_pvt_strtok directly and unconditionally.

Implementation no longer uses strtok_r(), it may be broken
or have an odd prototype.
Update configure not to check for strtok/strtok_r nor require
strtok_r to LDAP_API_FEATURE_X_OPENLDAP_REENTRANT.
This commit is contained in:
Kurt Zeilenga 1999-02-20 20:12:03 +00:00
parent 9cc9a84527
commit aa17fdd0bd
7 changed files with 309 additions and 410 deletions

654
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -502,12 +502,11 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
dnl pthread_create() in -lc_r (FreeBSD)
dnl pthread_create() in -lpthreads (many)
dnl pthread_join() -Wl,-woff,85 -lpthreads (IRIX)
dnl pthread_create() in HP-UX -lpthread (HP-UX 11)
dnl
dnl Check pthread (draft4) flags (to be depreciated)
dnl Check pthread (draft4) flags (depreciated)
dnl pthread_create() with -threads (OSF/1)
dnl
dnl Check pthread (final) libraries (to be depreciated)
dnl Check pthread (final) libraries (depreciated)
dnl pthread_mutex_unlock() in -lpthreads -lmach -lexc -lc_r (OSF/1)
dnl pthread_mutex_lock() in -lpthreads -lmach -lexc (OSF/1)
dnl pthread_mutex_trylock() in -lpthreads -lexc (OSF/1)
@ -673,37 +672,6 @@ if test $ol_with_threads = auto -o $ol_with_threads = yes \
LIBS="$save_LIBS"
fi
dnl HP-UX 11 Pthread check
if test $ol_link_threads = no; then
save_LIBS="$LIBS"
LIBS="$LIBS -lpthread"
AC_MSG_CHECKING([for pthread_create() in HP-UX -lpthread])
ol_try_pthread_hpux_11=no
AC_CACHE_VAL(ol_cv_pthread_hpux_11,[
AC_TRY_LINK([
#include <pthread.h>
#include <elf.h>
#ifndef ELFABI_HPUX_REL11
die horribly
#endif
], [pthread_create(NULL, NULL, NULL, NULL);],
ol_try_pthread_hpux_11=yes
ol_cv_pthread_hpux_11=yes,
ol_cv_pthread_hpux_11=no)])
AC_MSG_RESULT(yes)
LIBS="$save_LIBS"
if test $ol_cv_pthread_hpux_11=yes ; then
ol_link_threads=posix
LTHREAD_LIBS="$LTHREAD_LIBS -lpthread"
if test $ol_try_pthread_hpux_11=yes ; then
dnl Some tests below may fail, cause we aint including
dnl pthread.h. Force appropriate ones to yes
ac_cv_func_pthread_attr_init=yes
fi
fi
fi
if test $ol_link_threads = no ; then
dnl try -threads
AC_CACHE_CHECK([for pthread_create with -threads],
@ -1133,7 +1101,6 @@ dnl save_CPPFLAGS="$CPPFLAGS"
dnl save_LIBS="$LIBS"
dnl LIBS="$LTHREAD_LIBS $LIBS"
dnl AC_CHECK_FUNCS( \
dnl strtok_r \
dnl gmtime_r \
dnl gethostbyaddr_r gethostbyname_r \
dnl feof_unlocked unlocked_feof \
@ -1507,7 +1474,6 @@ AC_CHECK_FUNCS( \
strrchr \
strsep \
strstr \
strtok \
strtol \
strtoul \
strspn \
@ -1517,7 +1483,6 @@ AC_CHECK_FUNCS( \
# these functions are required to build a thread_safe -lldap
AC_CHECK_FUNCS( \
strtok_r \
ctime_r \
gethostbyaddr_r \
gethostbyname_r \
@ -1529,8 +1494,7 @@ else
ol_cv_func_ctime_r=0
fi
if test "$ac_cv_func_strtok_r" = yes \
-a "$ac_cv_func_ctime_r" = yes \
if test "$ac_cv_func_ctime_r" = yes \
-a "$ol_cv_func_ctime_r_nargs" -ge 2 -a "$ol_cv_func_ctime_r_nargs" -le 3 \
-a "$ac_cv_func_gethostbyaddr_r" = yes \
-a "$ac_cv_func_gethostbyname_r" = yes \

View File

@ -46,11 +46,8 @@
# endif
#endif
/* use ldap_pvt_strtok instead of strtok or strtok_r! */
extern char *ldap_pvt_strtok( char *str, const char *delim, char **pos );
#ifndef HAVE_STRTOK_R
# undef strtok_r
# define strtok_r(s, d, p) ldap_pvt_strtok((s),(d),(p))
#endif
extern char *ldap_pvt_strdup( const char * s );
#ifndef HAVE_STRDUP

View File

@ -330,12 +330,6 @@
/* Define if you have the strstr function. */
#undef HAVE_STRSTR
/* Define if you have the strtok function. */
#undef HAVE_STRTOK
/* Define if you have the strtok_r function. */
#undef HAVE_STRTOK_R
/* Define if you have the strtol function. */
#undef HAVE_STRTOL

View File

@ -58,9 +58,6 @@ static char *(int_strpbrk)( const char *str, const char *accept )
char *(ldap_pvt_strtok)( char *str, const char *delim, char **pos )
{
#if defined( HAVE_STRTOK_R ) || defined( HAVE_REENTRANT_FUNCTIONS )
return strtok_r(str, delim, pos);
#else
char *p;
if (pos==NULL) {
@ -91,7 +88,6 @@ char *(ldap_pvt_strtok)( char *str, const char *delim, char **pos )
}
return str;
#endif
}
char *

View File

@ -130,9 +130,9 @@ str2charray( char *str, char *brkstr )
res = (char **) ch_malloc( (i + 1) * sizeof(char *) );
i = 0;
for ( s = strtok_r( str, brkstr, &lasts );
for ( s = ldap_pvt_strtok( str, brkstr, &lasts );
s != NULL;
s = strtok_r( NULL, brkstr, &lasts ) )
s = ldap_pvt_strtok( NULL, brkstr, &lasts ) )
{
res[i++] = ch_strdup( s );
}

View File

@ -520,9 +520,9 @@ generate_new_centroids(
/* generate a word-based centroid */
} else {
char *lasts;
for ( w = strtok_r( val[j], WORD_BREAKS, &lasts );
for ( w = ldap_pvt_strtok( val[j], WORD_BREAKS, &lasts );
w != NULL;
w = strtok_r( NULL, WORD_BREAKS, &lasts ) ) {
w = ldap_pvt_strtok( NULL, WORD_BREAKS, &lasts ) ) {
key.dptr = w;
key.dsize = strlen( key.dptr ) + 1;
(void) ldbm_store( ldbm[i], key, data, LDBM_INSERT );