[asterisk-commits] eliel: branch group/appdocsxml r151505 - in /team/group/appdocsxml: include/a...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Oct 22 05:39:11 CDT 2008


Author: eliel
Date: Wed Oct 22 05:39:10 2008
New Revision: 151505

URL: http://svn.digium.com/view/asterisk?view=rev&rev=151505
Log:
Don't expose ast_str internals, just create a ast_str_trim_blanks() function for doing the job.

Modified:
    team/group/appdocsxml/include/asterisk/strings.h
    team/group/appdocsxml/main/pbx.c

Modified: team/group/appdocsxml/include/asterisk/strings.h
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/include/asterisk/strings.h?view=diff&rev=151505&r1=151504&r2=151505
==============================================================================
--- team/group/appdocsxml/include/asterisk/strings.h (original)
+++ team/group/appdocsxml/include/asterisk/strings.h Wed Oct 22 05:39:10 2008
@@ -383,6 +383,20 @@
 		buf->used = 0;
 		if (buf->len)
 			buf->str[0] = '\0';
+	}
+}
+)
+
+/*! \brief Trims trailing whitespace characters from an ast_str string.
+ *  \param buf A pointer to the ast_str string.
+ */
+AST_INLINE_API(
+void ast_str_trim_blanks(struct ast_str *buf),
+{
+	if (buf) {
+		while (buf->used && buf->str[buf->used - 1] < 33) {
+			buf->str[--(buf->used)] = '\0';
+		}
 	}
 }
 )

Modified: team/group/appdocsxml/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/main/pbx.c?view=diff&rev=151505&r1=151504&r2=151505
==============================================================================
--- team/group/appdocsxml/main/pbx.c (original)
+++ team/group/appdocsxml/main/pbx.c Wed Oct 22 05:39:10 2008
@@ -3443,10 +3443,7 @@
 	}
 	/* remove last spaces (we dont want always to remove the trailing spaces). */
 	if (lastspaces) {
-		while ((*output)->used && (*output)->str[(*output)->used - 1] == ' ') {
-			(*output)->str[(*output)->used - 1] = '\0';
-			(*output)->used--;
-		}
+		ast_str_trim_blanks(*output);
 	}
 }
 




More information about the asterisk-commits mailing list