summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorMoriyoshi Koizumi <moriyoshi@php.net>2003-02-24 16:13:13 +0000
committerMoriyoshi Koizumi <moriyoshi@php.net>2003-02-24 16:13:13 +0000
commit171fd9384056eeaf2248dd2f303dd2d42277481f (patch)
tree1f28028bc99f91ab6fd18f0102772d66c8615e46 /ext
parent75d6810d2c08ce1891236e1562cc53b6c06c19ae (diff)
downloadphp-git-171fd9384056eeaf2248dd2f303dd2d42277481f.tar.gz
Style fix
Diffstat (limited to 'ext')
-rw-r--r--ext/ereg/ereg.c18
-rw-r--r--ext/standard/reg.c18
2 files changed, 22 insertions, 14 deletions
diff --git a/ext/ereg/ereg.c b/ext/ereg/ereg.c
index 791b215d2f..d641cf9cfd 100644
--- a/ext/ereg/ereg.c
+++ b/ext/ereg/ereg.c
@@ -278,10 +278,12 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
string_len = strlen(string);
- if (icase)
+ if (icase) {
copts = REG_ICASE;
- if (extended)
+ }
+ if (extended) {
copts |= REG_EXTENDED;
+ }
err = regcomp(&re, pattern, copts);
if (err) {
@@ -321,7 +323,7 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
new_l = strlen(buf) + subs[0].rm_so; /* part before the match */
walk = replace;
- while (*walk)
+ while (*walk) {
if ('\\' == *walk && isdigit(walk[1]) && walk[1] - '0' <= ((char) re.re_nsub)) {
if (subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1) {
new_l += subs[walk[1] - '0'].rm_eo - subs[walk[1] - '0'].rm_so;
@@ -331,7 +333,7 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
new_l++;
walk++;
}
-
+ }
if (new_l + 1 > buf_len) {
buf_len = 1 + buf_len + 2 * new_l;
nbuf = emalloc(buf_len);
@@ -346,7 +348,7 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
/* copy replacement and backrefs */
walkbuf = &buf[tmp + subs[0].rm_so];
walk = replace;
- while (*walk)
+ while (*walk) {
if ('\\' == *walk && isdigit(walk[1]) && walk[1] - '0' <= (int)re.re_nsub) {
if (subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1
/* this next case shouldn't happen. it does. */
@@ -359,13 +361,15 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
walk += 2;
} else {
*walkbuf++ = *walk++;
- }
+ }
+ }
*walkbuf = '\0';
/* and get ready to keep looking for replacements */
if (subs[0].rm_so == subs[0].rm_eo) {
- if (subs[0].rm_so + pos >= string_len)
+ 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;
diff --git a/ext/standard/reg.c b/ext/standard/reg.c
index 791b215d2f..d641cf9cfd 100644
--- a/ext/standard/reg.c
+++ b/ext/standard/reg.c
@@ -278,10 +278,12 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
string_len = strlen(string);
- if (icase)
+ if (icase) {
copts = REG_ICASE;
- if (extended)
+ }
+ if (extended) {
copts |= REG_EXTENDED;
+ }
err = regcomp(&re, pattern, copts);
if (err) {
@@ -321,7 +323,7 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
new_l = strlen(buf) + subs[0].rm_so; /* part before the match */
walk = replace;
- while (*walk)
+ while (*walk) {
if ('\\' == *walk && isdigit(walk[1]) && walk[1] - '0' <= ((char) re.re_nsub)) {
if (subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1) {
new_l += subs[walk[1] - '0'].rm_eo - subs[walk[1] - '0'].rm_so;
@@ -331,7 +333,7 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
new_l++;
walk++;
}
-
+ }
if (new_l + 1 > buf_len) {
buf_len = 1 + buf_len + 2 * new_l;
nbuf = emalloc(buf_len);
@@ -346,7 +348,7 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
/* copy replacement and backrefs */
walkbuf = &buf[tmp + subs[0].rm_so];
walk = replace;
- while (*walk)
+ while (*walk) {
if ('\\' == *walk && isdigit(walk[1]) && walk[1] - '0' <= (int)re.re_nsub) {
if (subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1
/* this next case shouldn't happen. it does. */
@@ -359,13 +361,15 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
walk += 2;
} else {
*walkbuf++ = *walk++;
- }
+ }
+ }
*walkbuf = '\0';
/* and get ready to keep looking for replacements */
if (subs[0].rm_so == subs[0].rm_eo) {
- if (subs[0].rm_so + pos >= string_len)
+ 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;