[PHP4BETA] some ?'s about reg.c
| From: | Andrey Zmievski | Date: | Fri, 14 May 1999 14:59:26 +0000 |
| Subject: | [PHP4BETA] some ?'s about reg.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-851@lists.php.net to get a copy of this message | ||
Can someone explain to me what the following piece of code from reg.c does? I
figured the rest of it out, but I don't know when subs[0].rm_so would be
equal to subs[0].rm_eo.
Line 408 in reg.c:
if (subs[0].rm_so == subs[0].rm_eo) {
if (subs[0].rm_so + pos >= string_len)
break;
new_l = strlen (buf) + 1;
if (new_l + 1 > buf_len) {
buf_len = 1 + buf_len + 2 * new_l;
nbuf = emalloc(buf_len *
sizeof(char));
strcpy(nbuf, buf);
efree(buf);
buf = nbuf;
}
pos += subs[0].rm_eo + 1;
buf [new_l-1] = string [pos-1];
buf [new_l] = '\0';
} else {
pos += subs[0].rm_eo;
}
Thanks,
-Andrey
* Only 19,999 lines of C++ to my next ski trip... *
--
PHP 4 Beta