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
This commit is contained in:
Tilghman Lesher
2009-08-03 16:11:29 +00:00
parent f5a5763ee9
commit ca0f026f41
9 changed files with 10 additions and 26 deletions

View File

@@ -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)); pbx_substitute_variables_varshead(&head, x, fn, sizeof(fn));
/* locate prefix and data, if any */ /* locate prefix and data, if any */
fmt = index(fn, ':'); fmt = strchr(fn, ':');
if (!fmt || fmt == fn) { /* regular filename */ if (!fmt || fmt == fn) { /* regular filename */
ret = s_streamwait3(a, fn); ret = s_streamwait3(a, fn);
continue; continue;
} }
fmt++; fmt++;
data = index(fmt, ':'); /* colon before data */ data = strchr(fmt, ':'); /* colon before data */
if (!data || data == fmt) { /* simple prefix-fmt */ if (!data || data == fmt) { /* simple prefix-fmt */
ret = do_say(a, fn, options, depth); ret = do_say(a, fn, options, depth);
continue; 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 */ if (*p == '\'') {/* file name - we trim them */
char *y; char *y;
strcpy(fn2, ast_skip_blanks(p+1)); /* make a full copy */ strcpy(fn2, ast_skip_blanks(p+1)); /* make a full copy */
y = index(fn2, '\''); y = strchr(fn2, '\'');
if (!y) { if (!y) {
p = data; /* invalid. prepare to end */ p = data; /* invalid. prepare to end */
break; break;
} }
*y = '\0'; *y = '\0';
ast_trim_blanks(fn2); ast_trim_blanks(fn2);
p = index(p+1, '\''); p = strchr(p + 1, '\'');
ret = s_streamwait3(a, fn2); ret = s_streamwait3(a, fn2);
} else { } else {
int l = fmt-fn; int l = fmt-fn;

View File

@@ -1715,7 +1715,7 @@ static void store_mixer(struct chan_oss_pvt *o, char *s)
int i; int i;
for (i = 0; i < strlen(s); 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); ast_log(LOG_WARNING, "Suspect char %c in mixer cmd, ignoring:\n\t%s\n", s[i], s);
return; return;
} }

5
configure vendored
View File

@@ -1,5 +1,5 @@
#! /bin/sh #! /bin/sh
# From configure.ac Revision: 190092 . # From configure.ac Revision: 210064 .
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for asterisk 1.4. # 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 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 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
do do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_func" >&5 { echo "$as_me:$LINENO: checking for $ac_func" >&5

View File

@@ -273,7 +273,7 @@ AC_FUNC_STRNLEN
AC_FUNC_STRTOD AC_FUNC_STRTOD
AC_FUNC_UTIME_NULL AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF 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_MSG_CHECKING(for timersub in time.h)
AC_LINK_IFELSE( AC_LINK_IFELSE(

View File

@@ -89,7 +89,7 @@ static int sort_internal(struct ast_channel *chan, char *data, char *buffer, siz
/* Parse each into a struct */ /* Parse each into a struct */
count2 = 0; count2 = 0;
while ((ptrkey = strsep(&strings, "|"))) { while ((ptrkey = strsep(&strings, "|"))) {
ptrvalue = index(ptrkey, ':'); ptrvalue = strchr(ptrkey, ':');
if (!ptrvalue) { if (!ptrvalue) {
count--; count--;
continue; continue;
@@ -191,7 +191,7 @@ static int cut_internal(struct ast_channel *chan, char *data, char *buffer, size
/* Get to start, if any */ /* Get to start, if any */
if (num1 > 0) { if (num1 > 0) {
while (tmp2 != (char *)NULL + 1 && curfieldnum < num1) { while (tmp2 != (char *)NULL + 1 && curfieldnum < num1) {
tmp2 = index(tmp2, d) + 1; tmp2 = strchr(tmp2, d) + 1;
curfieldnum++; curfieldnum++;
} }
} }

View File

@@ -181,9 +181,6 @@
or greater. */ or greater. */
#undef HAVE_IMAP_TK2006 #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. */ /* Define to 1 if you have the `inet_ntoa' function. */
#undef HAVE_INET_NTOA #undef HAVE_INET_NTOA

View File

@@ -50,10 +50,6 @@ size_t strnlen(const char *, size_t);
char* strsep(char** str, const char* delims); char* strsep(char** str, const char* delims);
#endif #endif
#ifndef HAVE_INDEX
char *index(const char *haystack, int needle);
#endif
#ifndef HAVE_STRTOQ #ifndef HAVE_STRTOQ
uint64_t strtoq(const char *nptr, char **endptr, int base); uint64_t strtoq(const char *nptr, char **endptr, int base);
#endif #endif

View File

@@ -40,7 +40,6 @@
getloadavg; getloadavg;
strlcat; strlcat;
strlcpy; strlcpy;
index;
local: local:
*; *;
}; };

View File

@@ -84,13 +84,6 @@ int unsetenv(const char *name)
} }
#endif #endif
#ifndef HAVE_INDEX
char *index(const char *haystack, int needle)
{
return strchr(haystack, needle);
}
#endif
#ifndef HAVE_STRCASESTR #ifndef HAVE_STRCASESTR
static char *upper(const char *orig, char *buf, int bufsize) static char *upper(const char *orig, char *buf, int bufsize)
{ {