[Asterisk-cvs] asterisk utils.c,1.50,1.51
markster at lists.digium.com
markster at lists.digium.com
Sat Jun 18 07:53:29 CDT 2005
Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv5157
Modified Files:
utils.c
Log Message:
Fix up utils nonsense
Index: utils.c
===================================================================
RCS file: /usr/cvsroot/asterisk/utils.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- utils.c 17 Jun 2005 14:27:57 -0000 1.50
+++ utils.c 18 Jun 2005 11:54:38 -0000 1.51
@@ -37,6 +37,7 @@
static char base64[64];
static char b2a[256];
+#ifdef LOW_MEMORY
char *ast_skip_blanks(char *str)
{
while (*str && *str < 33)
@@ -48,13 +49,18 @@
{
char *work = str;
- if (work && !ast_strlen_zero(work)) {
+ if (work) {
work += strlen(work) - 1;
- while ((work >= str) && *work && *work < 33)
- work--;
- *(++work) = '\0'; /* terminate string */
+ /* It's tempting to only want to erase after we exit this loop,
+ but since ast_trim_blanks *could* receive a constant string
+ (which we presumably wouldn't have to touch), we shouldn't
+ actually set anything unless we must, and it's easier just
+ to set each position to \0 than to keep track of a variable
+ for it */
+ while ((work >= str) && *work < 33)
+ *(work--) = '\0';
}
- return work;
+ return str;
}
char *ast_skip_nonblanks(char *str)
@@ -71,6 +77,7 @@
ast_trim_blanks(s);
return s;
}
+#endif
char *ast_strip_quoted(char *s, const char *beg_quotes, const char *end_quotes)
{
More information about the svn-commits
mailing list