summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorAndy Lester <andy@petdance.com>2006-06-05 19:25:01 -0500
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-06-06 11:27:19 +0000
commit35da51f7f2e09d38719c2d96d9f3eacd4f9f796a (patch)
tree15de30780af62b466629ebae2a61b3cb79e49ebf /util.c
parentc35e046af5b841e9249aec6438e14aabc52c284a (diff)
downloadperl-35da51f7f2e09d38719c2d96d9f3eacd4f9f796a.tar.gz
more accumulated cleanups
Message-ID: <20060606052501.GA30469@petdance.com> p4raw-id: //depot/perl@28358
Diffstat (limited to 'util.c')
-rw-r--r--util.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/util.c b/util.c
index 407d86f441..e4832deb5a 100644
--- a/util.c
+++ b/util.c
@@ -341,16 +341,15 @@ Perl_delimcpy(pTHX_ register char *to, register const char *toend, register cons
{
register I32 tolen;
PERL_UNUSED_CONTEXT;
+
for (tolen = 0; from < fromend; from++, tolen++) {
if (*from == '\\') {
- if (from[1] == delim)
- from++;
- else {
+ if (from[1] != delim) {
if (to < toend)
*to++ = *from;
tolen++;
- from++;
}
+ from++;
}
else if (*from == delim)
break;
@@ -1536,6 +1535,7 @@ STRLEN *
Perl_new_warnings_bitfield(pTHX_ STRLEN *buffer, const char *const bits,
STRLEN size) {
const MEM_SIZE len_wanted = sizeof(STRLEN) + size;
+ PERL_UNUSED_CONTEXT;
buffer = specialWARN(buffer) ? PerlMemShared_malloc(len_wanted)
: PerlMemShared_realloc(buffer, len_wanted);
@@ -1577,7 +1577,9 @@ Perl_my_setenv(pTHX_ const char *nam, const char *val)
I32 max;
char **tmpenv;
- for (max = i; environ[max]; max++) ;
+ max = i;
+ while (environ[max])
+ max++;
tmpenv = (char**)safesysmalloc((max+2) * sizeof(char*));
for (j=0; j<max; j++) { /* copy environment */
const int len = strlen(environ[j]);
@@ -1701,10 +1703,11 @@ Perl_setenv_getix(pTHX_ const char *nam)
I32
Perl_unlnk(pTHX_ const char *f) /* unlink all versions of a file */
{
- I32 i;
+ I32 retries = 0;
- for (i = 0; PerlLIO_unlink(f) >= 0; i++) ;
- return i ? 0 : -1;
+ while (PerlLIO_unlink(f) >= 0)
+ retries++;
+ return retries ? 0 : -1;
}
#endif
@@ -4906,7 +4909,8 @@ Perl_parse_unicode_opts(pTHX_ const char **popt)
if (*p) {
if (isDIGIT(*p)) {
opt = (U32) atoi(p);
- while (isDIGIT(*p)) p++;
+ while (isDIGIT(*p))
+ p++;
if (*p && *p != '\n' && *p != '\r')
Perl_croak(aTHX_ "Unknown Unicode option letter '%c'", *p);
}
@@ -5043,7 +5047,8 @@ Perl_get_hash_seed(pTHX)
UV myseed = 0;
if (s)
- while (isSPACE(*s)) s++;
+ while (isSPACE(*s))
+ s++;
if (s && isDIGIT(*s))
myseed = (UV)Atoul(s);
else