This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
(perl #129000) create a safer utf8_hop()
[perl5.git] / proto.h
diff --git a/proto.h b/proto.h
index 6708016..0b10c0a 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -3512,6 +3512,24 @@ PERL_STATIC_INLINE U8*   Perl_utf8_hop(const U8 *s, SSize_t off)
 #define PERL_ARGS_ASSERT_UTF8_HOP      \
        assert(s)
 
+PERL_STATIC_INLINE U8* Perl_utf8_hop_back(const U8 *s, SSize_t off, const U8 *start)
+                       __attribute__warn_unused_result__
+                       __attribute__pure__;
+#define PERL_ARGS_ASSERT_UTF8_HOP_BACK \
+       assert(s); assert(start)
+
+PERL_STATIC_INLINE U8* Perl_utf8_hop_forward(const U8 *s, SSize_t off, const U8 *end)
+                       __attribute__warn_unused_result__
+                       __attribute__pure__;
+#define PERL_ARGS_ASSERT_UTF8_HOP_FORWARD      \
+       assert(s); assert(end)
+
+PERL_STATIC_INLINE U8* Perl_utf8_hop_safe(const U8 *s, SSize_t off, const U8 *start, const U8 *end)
+                       __attribute__warn_unused_result__
+                       __attribute__pure__;
+#define PERL_ARGS_ASSERT_UTF8_HOP_SAFE \
+       assert(s); assert(start); assert(end)
+
 PERL_CALLCONV STRLEN   Perl_utf8_length(pTHX_ const U8* s, const U8 *e)
                        __attribute__warn_unused_result__
                        __attribute__pure__;
@@ -5488,7 +5506,7 @@ STATIC int        S_intuit_method(pTHX_ char *s, SV *ioname, CV *cv);
 STATIC int     S_intuit_more(pTHX_ char *s);
 #define PERL_ARGS_ASSERT_INTUIT_MORE   \
        assert(s)
-STATIC I32     S_lop(pTHX_ I32 f, int x, char *s);
+STATIC I32     S_lop(pTHX_ I32 f, U8 x, char *s);
 #define PERL_ARGS_ASSERT_LOP   \
        assert(s)
 PERL_STATIC_NO_RET void        S_missingterm(pTHX_ char *s)