[asterisk-commits] murf: branch 1.6.1 r144578 - in /branches/1.6.1: ./ apps/ channels/ funcs/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 25 17:25:35 CDT 2008


Author: murf
Date: Thu Sep 25 17:25:34 2008
New Revision: 144578

URL: http://svn.digium.com/view/asterisk?view=rev&rev=144578
Log:
Merged revisions 144569 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r144569 | murf | 2008-09-25 16:21:28 -0600 (Thu, 25 Sep 2008) | 14 lines

(closes issue #13557)
Reported by: nickpeirson

The user attached a patch, but the license is not yet
recorded. I took the liberty of finding and replacing
ALL index() calls with strchr() calls, and that
involves more than just main/pbx.c;

chan_oss, app_playback, func_cut also had calls
to index(), and I changed them out. 1.4 had no
references to index() at all.



........

Modified:
    branches/1.6.1/   (props changed)
    branches/1.6.1/apps/app_playback.c
    branches/1.6.1/channels/chan_oss.c
    branches/1.6.1/funcs/func_cut.c
    branches/1.6.1/main/pbx.c

Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.1/apps/app_playback.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/apps/app_playback.c?view=diff&rev=144578&r1=144577&r2=144578
==============================================================================
--- branches/1.6.1/apps/app_playback.c (original)
+++ branches/1.6.1/apps/app_playback.c Thu Sep 25 17:25:34 2008
@@ -200,13 +200,13 @@
 		ast_debug(2, "doing [%s]\n", 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;
@@ -219,14 +219,14 @@
 			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;

Modified: branches/1.6.1/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/channels/chan_oss.c?view=diff&rev=144578&r1=144577&r2=144578
==============================================================================
--- branches/1.6.1/channels/chan_oss.c (original)
+++ branches/1.6.1/channels/chan_oss.c Thu Sep 25 17:25:34 2008
@@ -1299,7 +1299,7 @@
 	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;
 		}

Modified: branches/1.6.1/funcs/func_cut.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/funcs/func_cut.c?view=diff&rev=144578&r1=144577&r2=144578
==============================================================================
--- branches/1.6.1/funcs/func_cut.c (original)
+++ branches/1.6.1/funcs/func_cut.c Thu Sep 25 17:25:34 2008
@@ -82,7 +82,7 @@
 	/* Parse each into a struct */
 	count2 = 0;
 	while ((ptrkey = strsep(&strings, ","))) {
-		ptrvalue = index(ptrkey, ':');
+		ptrvalue = strchr(ptrkey, ':');
 		if (!ptrvalue) {
 			count--;
 			continue;
@@ -171,7 +171,7 @@
 				/* 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++;
 					}
 				}

Modified: branches/1.6.1/main/pbx.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/main/pbx.c?view=diff&rev=144578&r1=144577&r2=144578
==============================================================================
--- branches/1.6.1/main/pbx.c (original)
+++ branches/1.6.1/main/pbx.c Thu Sep 25 17:25:34 2008
@@ -1048,7 +1048,7 @@
  *     NULL
  *
  *   In the above, I could easily turn "N" into "23456789", but I think that a quick "if( *z >= '2' && *z <= '9' )" might take
- *   fewer CPU cycles than a call to index("23456789",*z), where *z is the char to match...
+ *   fewer CPU cycles than a call to strchr("23456789",*z), where *z is the char to match...
  *
  *   traversal is pretty simple: one routine merely traverses the alt list, and for each matching char in the pattern,  it calls itself
  *   on the corresponding next pointer, incrementing also the pointer of the string to be matched, and passing the total specificity and length.
@@ -1346,7 +1346,7 @@
 					return; /* the first match is all we need */
 				}
 			}
-		} else if (index(p->x, *str)) {
+		} else if (strchr(p->x, *str)) {
 			ast_debug(4, "Nothing strange about this match\n");
 			NEW_MATCHER_CHK_MATCH;
 			NEW_MATCHER_RECURSE;




More information about the asterisk-commits mailing list