summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-05-19 16:31:35 +0000
committerNicholas Clark <nick@ccl4.org>2006-05-19 16:31:35 +0000
commitf8225f8afdb4886e3a792f44a7d91c93463cbb78 (patch)
tree2272a03502de2c05ba97991adc1d472a604f67b3 /perlio.c
parent7d2b122293d1fdebed97dd499efd7866991df533 (diff)
downloadperl-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.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/perlio.c b/perlio.c
index a0cb4a4d05..a4b7bb4cf9 100644
--- a/perlio.c
+++ b/perlio.c
@@ -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;
}
}
}