summaryrefslogtreecommitdiff
path: root/handy.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2017-04-24 20:27:24 -0600
committerKarl Williamson <khw@cpan.org>2017-11-06 12:50:06 -0700
commitde62715824b6848c0aabf63dab4e7bcdc9945f9f (patch)
tree31c0022d32bb88c5d89ed9c39560d6525cf0ce52 /handy.h
parent8a0832a10f1561764283c17de01fc2ebf3097e09 (diff)
downloadperl-de62715824b6848c0aabf63dab4e7bcdc9945f9f.tar.gz
Add memBEGINPs() to core and use it
This macro is like memBEGINs(), but the 'P' signifies we want a proper substring, meaning that the 2nd string parameter must not be the entire first parameter.
Diffstat (limited to 'handy.h')
-rw-r--r--handy.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/handy.h b/handy.h
index 06db1e25a6..7b5aeb84fe 100644
--- a/handy.h
+++ b/handy.h
@@ -495,6 +495,9 @@ Returns zero if non-equal, or non-zero if equal.
#define memBEGINs(s1, l, s2) \
( (l) >= sizeof(s2) - 1 \
&& memEQ(s1, "" s2 "", sizeof(s2)-1))
+#define memBEGINPs(s1, l, s2) \
+ ( (l) > sizeof(s2) - 1 \
+ && memEQ(s1, "" s2 "", sizeof(s2)-1))
#define memENDs(s1, l, s2) \
( (l) >= sizeof(s2) - 1 \
&& memEQ(s1 + (l) - (sizeof(s2) - 1), "" s2 "", sizeof(s2)-1))