summaryrefslogtreecommitdiff
path: root/ext/POSIX/POSIX.xs
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2015-03-08 21:16:16 -0600
committerKarl Williamson <khw@cpan.org>2015-03-09 09:37:08 -0600
commite3bf330496b342e1b2f35bb5de8f2f619b42f9aa (patch)
treebc3d8985ca5721aaaed823676ac348a9cb96ec71 /ext/POSIX/POSIX.xs
parent9b7098c1c609d4628b5baab6f2c82660c2f29aef (diff)
downloadperl-e3bf330496b342e1b2f35bb5de8f2f619b42f9aa.tar.gz
ext/POSIX/POSIX.xs: Convert do whiles into whiles
I don't know why these are do { ] while's, but with the correct combination of compile flags (such as -DNO_LOCALE), and/or perhaps platform, one or the other could be called the first time with nulls, so they need to be straight while{}s to avoid segfaults.
Diffstat (limited to 'ext/POSIX/POSIX.xs')
-rw-r--r--ext/POSIX/POSIX.xs12
1 files changed, 7 insertions, 5 deletions
diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs
index b1118bd013..26ca46415a 100644
--- a/ext/POSIX/POSIX.xs
+++ b/ext/POSIX/POSIX.xs
@@ -2011,7 +2011,7 @@ localeconv()
const struct lconv_offset *integers = lconv_integers;
const char *ptr = (const char *) lcbuf;
- do {
+ while (strings->name) {
/* This string may be controlled by either LC_NUMERIC, or
* LC_MONETARY */
bool is_utf8_locale
@@ -2042,16 +2042,18 @@ localeconv()
&& ! is_invariant_string((U8 *) value, 0)
&& is_utf8_string((U8 *) value, 0)),
0);
- }
- } while ((++strings)->name);
+ }
+ strings++;
+ }
- do {
+ while (integers->name) {
const char value = *((const char *)(ptr + integers->offset));
if (value != CHAR_MAX)
(void) hv_store(RETVAL, integers->name,
strlen(integers->name), newSViv(value), 0);
- } while ((++integers)->name);
+ integers++;
+ }
}
RESTORE_NUMERIC_STANDARD();
#endif /* HAS_LOCALECONV */