Re: [PHP4BETA] cvs: php4 /ext/standard/ string.c
[email protected] Thu, 1 Jun 2000 17:22:33 +0300 (EEST)
| Newsgroups | php.version4 |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 1 Jun 2000, Andrei Zmievski wrote:
> On Thu, 01 Jun 2000, Jouni Ahto wrote:
> > jah Thu Jun 1 06:38:23 2000 EDT
> >
> > Modified files:
> > /php4/ext/standard string.c
> > Log:
> >
> > (ucwords) Fixed fix for fix for fix for #4748.
> > # Today's most fixed bug.
> >
> > r=return_value->value.str.val;
> > *r=toupper((unsigned char)*r);
> > - for(r_end = r + return_value->value.str.len -1 ; r < r_end ; r++ ) {
> > + for(r_end = r + return_value->value.str.len -1 ; r < r_end ; ) {
> > if(isspace(*r)) {
> > - *++r=toupper((unsigned char)*r);
> > + *r=toupper((unsigned char)*++r);
>
> Are you sure about this? It seems that you're replacing space character
> with the uppercased next one.
Didn't happen for me. At what point of the line does r actually get
incremented? I read the first version as 'uppercase the char r points to
and assign it to incremented r', the second 'increment r, uppercase the
char it points to, and assign it to r (ie. itself)'. But in fact, both
versions did work for me. I was in fact fixing something else, skipping
over when there are an even number of space chars.
-- Jouni Ahto