summaryrefslogtreecommitdiff
path: root/embed.fnc
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2016-10-31 14:28:34 +1100
committerTony Cook <tony@develop-help.com>2016-11-09 13:29:46 +1100
commit65df57a84b55413fcde1e64b86e3d740485536d3 (patch)
tree848c157d38e8a30b2ccf0bf95d4865174daf28ca /embed.fnc
parenta7ea90b1451006596c4574b1e65894f0bda1bafc (diff)
downloadperl-65df57a84b55413fcde1e64b86e3d740485536d3.tar.gz
(perl #129000) create a safer utf8_hop()
Unlike utf8_hop(), utf8_hop_safe() won't navigate before the beginning or after the end of the supplied buffer. The original version of this put all of the logic into utf8_hop_safe(), but in many cases a caller specifically needs to go forward or backward, and supplying the other limit made the function less usable, so I split the function into forward and backward cases. This split may also make inlining these functions more efficient or more likely.
Diffstat (limited to 'embed.fnc')
-rw-r--r--embed.fnc3
1 files changed, 3 insertions, 0 deletions
diff --git a/embed.fnc b/embed.fnc
index a83372f9a3..9d4094084c 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -1734,6 +1734,9 @@ Ap |U8* |utf16_to_utf8_reversed|NN U8* p|NN U8 *d|I32 bytelen|NN I32 *newlen
AdpPR |STRLEN |utf8_length |NN const U8* s|NN const U8 *e
AipdPR |IV |utf8_distance |NN const U8 *a|NN const U8 *b
AipdPRn |U8* |utf8_hop |NN const U8 *s|SSize_t off
+AipdPRn |U8* |utf8_hop_back|NN const U8 *s|SSize_t off|NN const U8 *start
+AipdPRn |U8* |utf8_hop_forward|NN const U8 *s|SSize_t off|NN const U8 *end
+AipdPRn |U8* |utf8_hop_safe |NN const U8 *s|SSize_t off|NN const U8 *start|NN const U8 *end
ApMd |U8* |utf8_to_bytes |NN U8 *s|NN STRLEN *len
Apd |int |bytes_cmp_utf8 |NN const U8 *b|STRLEN blen|NN const U8 *u \
|STRLEN ulen