diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2014-05-29 10:17:51 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2014-05-29 10:19:54 -0400 |
commit | b7d878615197b333d2e3724e68d3504cb6c26106 (patch) | |
tree | 4b0992dff8e7e04ecbdc5d4e9b9129f406ff4898 /util.c | |
parent | 99e8c55599d54e8fb759b97f846ee0b0aac91f50 (diff) | |
download | perl-b7d878615197b333d2e3724e68d3504cb6c26106.tar.gz |
Reindent the block. Whitespace-only change.
Followup to 99e8c5.
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 92 |
1 files changed, 46 insertions, 46 deletions
@@ -1992,54 +1992,54 @@ Perl_my_setenv(pTHX_ const char *nam, const char *val) { #ifndef PERL_USE_SAFE_PUTENV if (!PL_use_safe_putenv) { - /* most putenv()s leak, so we manipulate environ directly */ - I32 i; - const I32 len = strlen(nam); - int nlen, vlen; - - /* where does it go? */ - for (i = 0; environ[i]; i++) { - if (strnEQ(environ[i],nam,len) && environ[i][len] == '=') - break; - } + /* most putenv()s leak, so we manipulate environ directly */ + I32 i; + const I32 len = strlen(nam); + int nlen, vlen; + + /* where does it go? */ + for (i = 0; environ[i]; i++) { + if (strnEQ(environ[i],nam,len) && environ[i][len] == '=') + break; + } - if (environ == PL_origenviron) { /* need we copy environment? */ - I32 j; - I32 max; - char **tmpenv; - - 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]); - tmpenv[j] = (char*)safesysmalloc((len+1)*sizeof(char)); - Copy(environ[j], tmpenv[j], len+1, char); - } - tmpenv[max] = NULL; - environ = tmpenv; /* tell exec where it is now */ - } - if (!val) { - safesysfree(environ[i]); - while (environ[i]) { - environ[i] = environ[i+1]; - i++; - } - return; - } - if (!environ[i]) { /* does not exist yet */ - environ = (char**)safesysrealloc(environ, (i+2) * sizeof(char*)); - environ[i+1] = NULL; /* make sure it's null terminated */ - } - else - safesysfree(environ[i]); - nlen = strlen(nam); - vlen = strlen(val); + if (environ == PL_origenviron) { /* need we copy environment? */ + I32 j; + I32 max; + char **tmpenv; + + 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]); + tmpenv[j] = (char*)safesysmalloc((len+1)*sizeof(char)); + Copy(environ[j], tmpenv[j], len+1, char); + } + tmpenv[max] = NULL; + environ = tmpenv; /* tell exec where it is now */ + } + if (!val) { + safesysfree(environ[i]); + while (environ[i]) { + environ[i] = environ[i+1]; + i++; + } + return; + } + if (!environ[i]) { /* does not exist yet */ + environ = (char**)safesysrealloc(environ, (i+2) * sizeof(char*)); + environ[i+1] = NULL; /* make sure it's null terminated */ + } + else + safesysfree(environ[i]); + nlen = strlen(nam); + vlen = strlen(val); - environ[i] = (char*)safesysmalloc((nlen+vlen+2) * sizeof(char)); - /* all that work just for this */ - my_setenv_format(environ[i], nam, nlen, val, vlen); + environ[i] = (char*)safesysmalloc((nlen+vlen+2) * sizeof(char)); + /* all that work just for this */ + my_setenv_format(environ[i], nam, nlen, val, vlen); } else { # endif # if defined(__CYGWIN__)|| defined(__SYMBIAN32__) || defined(__riscos__) |