diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-05-19 16:31:35 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-05-19 16:31:35 +0000 |
commit | f8225f8afdb4886e3a792f44a7d91c93463cbb78 (patch) | |
tree | 2272a03502de2c05ba97991adc1d472a604f67b3 /perlio.c | |
parent | 7d2b122293d1fdebed97dd499efd7866991df533 (diff) | |
download | perl-f8225f8afdb4886e3a792f44a7d91c93463cbb78.tar.gz |
strlen(foo) rather than strchr(foo, 0) makes simpler code, and is
likely to be a more efficient implementation.
p4raw-id: //depot/perl@28236
Diffstat (limited to 'perlio.c')
-rw-r--r-- | perlio.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1423,11 +1423,11 @@ PerlIO_context_layers(pTHX_ const char *mode) type = SvPV_const(layers, len); if (type && mode[0] != 'r') { /* - * Skip to write part + * Skip to write part, which is separated by a '\0' */ - const char * const s = strchr(type, 0); - if (s && (STRLEN)(s - type) < len) { - type = s + 1; + STRLEN read_len = strlen(type); + if (read_len < len) { + type += read_len + 1; } } } |