cvs: php4 /main main.c

From: Date: Sun, 12 May 2002 15:22:11 +0000
Subject: cvs: php4 /main main.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-11868@lists.php.net to get a copy of this message
sas Sun May 12 11:22:11 2002 EDT Modified files: /php4/main main.c Log: Simplify white space handling in php_html_puts. If we encounter a ' ', we will look for the next non-' ' and set p accordingly. Index: php4/main/main.c diff -u php4/main/main.c:1.453 php4/main/main.c:1.454 --- php4/main/main.c:1.453 Sun May 12 10:48:21 2002 +++ php4/main/main.c Sun May 12 11:22:11 2002 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.453 2002/05/12 14:48:21 sas Exp $ */ +/* $Id: main.c,v 1.454 2002/05/12 15:22:11 sas Exp $ */ /* {{{ includes */ @@ -401,15 +401,13 @@ smart_str_appendl(&s, "&amp;", sizeof("&amp;")-1); break; case ' ': { - const char *nextchar = p+1, *prevchar = p-1; + const char *nextchar = p; - /* series of spaces should be converted to &nbsp;'s */ - if (((nextchar < end) && *nextchar==' ') - || ((prevchar >= str) && *prevchar==' ')) { - smart_str_appendl(&s, "&nbsp;", sizeof("&nbsp;")-1); - } else { - smart_str_appendc(&s, ' '); - } + while (++nextchar < end && *nextchar == ' '); + + p = nextchar; + smart_str_appends(&s, "&nbsp;"); + continue; } break; case '\t':

« previous php.cvs (#11868) next »