[asterisk-commits] tilghman: trunk r197209 - in /trunk: ./ funcs/func_cut.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 27 14:21:03 CDT 2009


Author: tilghman
Date: Wed May 27 14:20:56 2009
New Revision: 197209

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=197209
Log:
Recorded merge of revisions 197194 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r197194 | tilghman | 2009-05-27 14:09:42 -0500 (Wed, 27 May 2009) | 5 lines
  
  Use a different determinator on whether to print the delimiter, since leading fields may be blank.
  (closes issue #15208)
   Reported by: ramonpeek
   Patch by me, though inspired in part by a patch from ramonpeek
........

Modified:
    trunk/   (props changed)
    trunk/funcs/func_cut.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/funcs/func_cut.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/funcs/func_cut.c?view=diff&rev=197209&r1=197208&r2=197209
==============================================================================
--- trunk/funcs/func_cut.c (original)
+++ trunk/funcs/func_cut.c Wed May 27 14:20:56 2009
@@ -186,6 +186,7 @@
 		if (ast_str_strlen(str)) {
 			int curfieldnum = 1;
 			char *tmp2 = ast_str_buffer(str);
+			int firstfield = 1;
 			while (tmp2 != NULL && args.field != NULL) {
 				char *nextgroup = strsep(&(args.field), "&");
 				int num1 = 0, num2 = INT_MAX;
@@ -222,7 +223,8 @@
 				/* Output fields until we either run out of fields or num2 is reached */
 				while (tmp2 != NULL && curfieldnum <= num2) {
 					char *tmp3 = strsep(&tmp2, ds);
-					ast_str_append(buf, buflen, "%s%s", ast_str_strlen(*buf) ? ds : "", tmp3);
+					ast_str_append(buf, buflen, "%s%s", firstfield ? "" : ds, tmp3);
+					firstfield = 0;
 					curfieldnum++;
 				}
 			}




More information about the asterisk-commits mailing list