From: Tilghman Lesher Date: Mon, 3 Aug 2009 16:11:29 +0000 (+0000) Subject: Reverting index() fix, applying a different methodology, based upon developer discuss... X-Git-Tag: 1.4.26.2~4^2~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca0f026f41af47d10c2f01ebb816c72c494dc467;p=thirdparty%2Fasterisk.git Reverting index() fix, applying a different methodology, based upon developer discussions. (related to issue #15639) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@210066 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_playback.c b/apps/app_playback.c index 8f78bef786..6763bd917f 100644 --- a/apps/app_playback.c +++ b/apps/app_playback.c @@ -207,13 +207,13 @@ static int do_say(say_args_t *a, const char *s, const char *options, int depth) pbx_substitute_variables_varshead(&head, x, fn, sizeof(fn)); /* locate prefix and data, if any */ - fmt = index(fn, ':'); + fmt = strchr(fn, ':'); if (!fmt || fmt == fn) { /* regular filename */ ret = s_streamwait3(a, fn); continue; } fmt++; - data = index(fmt, ':'); /* colon before data */ + data = strchr(fmt, ':'); /* colon before data */ if (!data || data == fmt) { /* simple prefix-fmt */ ret = do_say(a, fn, options, depth); continue; @@ -226,14 +226,14 @@ static int do_say(say_args_t *a, const char *s, const char *options, int depth) if (*p == '\'') {/* file name - we trim them */ char *y; strcpy(fn2, ast_skip_blanks(p+1)); /* make a full copy */ - y = index(fn2, '\''); + y = strchr(fn2, '\''); if (!y) { p = data; /* invalid. prepare to end */ break; } *y = '\0'; ast_trim_blanks(fn2); - p = index(p+1, '\''); + p = strchr(p + 1, '\''); ret = s_streamwait3(a, fn2); } else { int l = fmt-fn; diff --git a/channels/chan_oss.c b/channels/chan_oss.c index 73297f4efd..d3730eb489 100644 --- a/channels/chan_oss.c +++ b/channels/chan_oss.c @@ -1715,7 +1715,7 @@ static void store_mixer(struct chan_oss_pvt *o, char *s) int i; for (i = 0; i < strlen(s); i++) { - if (!isalnum(s[i]) && index(" \t-/", s[i]) == NULL) { + if (!isalnum(s[i]) && strchr(" \t-/", s[i]) == NULL) { ast_log(LOG_WARNING, "Suspect char %c in mixer cmd, ignoring:\n\t%s\n", s[i], s); return; } diff --git a/configure b/configure index c69a7b1df5..51e75d214a 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 190092 . +# From configure.ac Revision: 210064 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for asterisk 1.4. # @@ -14633,8 +14633,7 @@ done - -for ac_func in asprintf atexit bzero dup2 endpwent floor ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday index inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap pow putenv re_comp regcomp rint select setenv socket sqrt strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtol strtoq unsetenv utime vasprintf ioperm +for ac_func in asprintf atexit bzero dup2 endpwent floor ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap pow putenv re_comp regcomp rint select setenv socket sqrt strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtol strtoq unsetenv utime vasprintf ioperm do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 diff --git a/configure.ac b/configure.ac index 55def26075..48fbb72b9c 100644 --- a/configure.ac +++ b/configure.ac @@ -273,7 +273,7 @@ AC_FUNC_STRNLEN AC_FUNC_STRTOD AC_FUNC_UTIME_NULL AC_FUNC_VPRINTF -AC_CHECK_FUNCS([asprintf atexit bzero dup2 endpwent floor ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday index inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap pow putenv re_comp regcomp rint select setenv socket sqrt strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtol strtoq unsetenv utime vasprintf ioperm]) +AC_CHECK_FUNCS([asprintf atexit bzero dup2 endpwent floor ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday inet_ntoa isascii localtime_r memchr memmove memset mkdir munmap pow putenv re_comp regcomp rint select setenv socket sqrt strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtol strtoq unsetenv utime vasprintf ioperm]) AC_MSG_CHECKING(for timersub in time.h) AC_LINK_IFELSE( diff --git a/funcs/func_cut.c b/funcs/func_cut.c index 1bafbd6695..66f464dd6d 100644 --- a/funcs/func_cut.c +++ b/funcs/func_cut.c @@ -89,7 +89,7 @@ static int sort_internal(struct ast_channel *chan, char *data, char *buffer, siz /* Parse each into a struct */ count2 = 0; while ((ptrkey = strsep(&strings, "|"))) { - ptrvalue = index(ptrkey, ':'); + ptrvalue = strchr(ptrkey, ':'); if (!ptrvalue) { count--; continue; @@ -191,7 +191,7 @@ static int cut_internal(struct ast_channel *chan, char *data, char *buffer, size /* Get to start, if any */ if (num1 > 0) { while (tmp2 != (char *)NULL + 1 && curfieldnum < num1) { - tmp2 = index(tmp2, d) + 1; + tmp2 = strchr(tmp2, d) + 1; curfieldnum++; } } diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in index 8f043b7b6e..9fddef692a 100644 --- a/include/asterisk/autoconfig.h.in +++ b/include/asterisk/autoconfig.h.in @@ -181,9 +181,6 @@ or greater. */ #undef HAVE_IMAP_TK2006 -/* Define to 1 if you have the `index' function. */ -#undef HAVE_INDEX - /* Define to 1 if you have the `inet_ntoa' function. */ #undef HAVE_INET_NTOA diff --git a/include/asterisk/compat.h b/include/asterisk/compat.h index f321665cd9..d91ce4a1ac 100644 --- a/include/asterisk/compat.h +++ b/include/asterisk/compat.h @@ -50,10 +50,6 @@ size_t strnlen(const char *, size_t); char* strsep(char** str, const char* delims); #endif -#ifndef HAVE_INDEX -char *index(const char *haystack, int needle); -#endif - #ifndef HAVE_STRTOQ uint64_t strtoq(const char *nptr, char **endptr, int base); #endif diff --git a/main/asterisk.exports b/main/asterisk.exports index fa9b33192b..b503506068 100644 --- a/main/asterisk.exports +++ b/main/asterisk.exports @@ -40,7 +40,6 @@ getloadavg; strlcat; strlcpy; - index; local: *; }; diff --git a/main/strcompat.c b/main/strcompat.c index 52347db175..243ef76cb0 100644 --- a/main/strcompat.c +++ b/main/strcompat.c @@ -84,13 +84,6 @@ int unsetenv(const char *name) } #endif -#ifndef HAVE_INDEX -char *index(const char *haystack, int needle) -{ - return strchr(haystack, needle); -} -#endif - #ifndef HAVE_STRCASESTR static char *upper(const char *orig, char *buf, int bufsize) {