Skip to content

Commit 653d617

Browse files
committed
regen/embed.pl/embed.fnc
Add and use ability to assert(s <= e) Some functions allow it string start parameter to be equal to the string end parameter. This exends the ability added in the previous two commits to accommodate this.
1 parent 36a6235 commit 653d617

File tree

3 files changed

+77
-61
lines changed

3 files changed

+77
-61
lines changed

embed.fnc

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,14 @@
177177
: supposed to. EPTR usually points to the next byte in memory past the final
178178
: one in the string, in keeping with typical practice. The code checks that
179179
: the first pointer is declared as NN.
180+
:
181+
: This ability can serve to not just check for the real end of string, but
182+
: to limit the called function, for whatever reason, to look at just a
183+
: segment of it. So, you can use EPTR to point to the end of the permissible
184+
: segment. And if so, you may want the function to be able to look at the
185+
: final byte that EPTR points to. There are functions that do that, and they
186+
: use EPTRQ to declare that the final byte is fair game.
187+
:
180188
: For a numeric argument, you may specify that it can't be 0 by using 'NZ'
181189
:
182190
: regen/embed.pl may automatically add further checking for any argument as
@@ -1032,16 +1040,16 @@ Rp |SV * |defelem_target |NN SV *sv \
10321040
: Used in op.c, perl.c
10331041
px |void |delete_eval_scope
10341042
ATdp |char * |delimcpy |NN char *to \
1035-
|NN const char *to_end \
1043+
|EPTRQ const char *to_end \
10361044
|NN const char *from \
1037-
|NN const char *from_end \
1045+
|EPTRQ const char *from_end \
10381046
|const int delim \
10391047
|NN I32 *retlen
10401048
ETXdp |char * |delimcpy_no_escape \
10411049
|NN char *to \
1042-
|NN const char *to_end \
1050+
|EPTRQ const char *to_end \
10431051
|NN const char *from \
1044-
|NN const char *from_end \
1052+
|EPTRQ const char *from_end \
10451053
|const int delim \
10461054
|NN I32 *retlen
10471055
Cp |void |despatch_signals
@@ -1228,7 +1236,7 @@ Adfp |void |fatal_warner |U32 err \
12281236
Adp |void |fbm_compile |NN SV *sv \
12291237
|U32 flags
12301238
ARdp |char * |fbm_instr |NN unsigned char *big \
1231-
|NN unsigned char *bigend \
1239+
|EPTRQ unsigned char *bigend \
12321240
|NN SV *littlestr \
12331241
|U32 flags
12341242
Adhp |SV * |filter_add |NULLOK filter_t funcp \
@@ -1293,7 +1301,7 @@ p |void |free_tied_hv_pool
12931301
Cp |void |free_tmps
12941302
ERXp |SV * |get_and_check_backslash_N_name \
12951303
|NN const char *s \
1296-
|NN const char *e \
1304+
|EPTRQ const char *e \
12971305
|const bool is_utf8 \
12981306
|NN const char **error_msg
12991307
AOdp |AV * |get_av |NN const char *name \
@@ -1350,7 +1358,7 @@ AMdp |UV |grok_hex |NN const char *start \
13501358
|NN I32 *flags \
13511359
|NULLOK NV *result
13521360
Adp |int |grok_infnan |NN const char **sp \
1353-
|NN const char *send
1361+
|EPTRQ const char *send
13541362
Adp |int |grok_number |NN const char *pv \
13551363
|STRLEN len \
13561364
|NULLOK UV *valuep
@@ -1361,7 +1369,7 @@ Adp |int |grok_number_flags \
13611369
|U32 flags
13621370
ARdp |bool |grok_numeric_radix \
13631371
|NN const char **sp \
1364-
|NN const char *send
1372+
|EPTRQ const char *send
13651373
AMdp |UV |grok_oct |NN const char *start \
13661374
|NN STRLEN *len_p \
13671375
|NN I32 *flags \
@@ -1691,7 +1699,7 @@ p |bool |io_close |NN IO *io \
16911699
|bool warn_on_fail
16921700
ARTdip |Size_t |isC9_STRICT_UTF8_CHAR \
16931701
|NN const U8 * const s0 \
1694-
|NN const U8 * const e
1702+
|EPTRQ const U8 * const e
16951703
ARTdmp |bool |is_c9strict_utf8_string \
16961704
|NN const U8 *s \
16971705
|STRLEN len
@@ -1718,7 +1726,7 @@ ARdip |bool |is_safe_syscall|NN const char *pv \
17181726
|NN const char *op_name
17191727
ARTdip |Size_t |isSTRICT_UTF8_CHAR \
17201728
|NN const U8 * const s0 \
1721-
|NN const U8 * const e
1729+
|EPTRQ const U8 * const e
17221730
ARTdmp |bool |is_strict_utf8_string \
17231731
|NN const U8 *s \
17241732
|STRLEN len
@@ -1738,13 +1746,13 @@ CRp |bool |is_uni_perl_idcont_ \
17381746
CRp |bool |is_uni_perl_idstart_ \
17391747
|UV c
17401748
ARTdip |Size_t |isUTF8_CHAR |NN const U8 * const s0 \
1741-
|NN const U8 * const e
1749+
|EPTRQ const U8 * const e
17421750
ATdmp |STRLEN |is_utf8_char_buf \
17431751
|NN const U8 *buf \
17441752
|EPTR const U8 *buf_end
17451753
ARTdip |Size_t |isUTF8_CHAR_flags \
17461754
|NN const U8 * const s0 \
1747-
|NN const U8 * const e \
1755+
|EPTRQ const U8 * const e \
17481756
|const U32 flags
17491757
CPRTp |STRLEN |is_utf8_char_helper_ \
17501758
|NN const U8 * const s \
@@ -2498,7 +2506,7 @@ p |void |package |NN OP *o
24982506
p |void |package_version|NN OP *v
24992507
Adp |void |packlist |NN SV *cat \
25002508
|NN const char *pat \
2501-
|NN const char *patend \
2509+
|EPTRQ const char *patend \
25022510
|NN SV **beglist \
25032511
|NN SV **endlist
25042512
Adp |PADOFFSET|pad_add_anon |NN CV *func \
@@ -2863,9 +2871,9 @@ Admp |void |resume_compcv_and_save \
28632871
Admp |void |resume_compcv_final \
28642872
|NN struct suspended_compcv *buffer
28652873
APTdp |char * |rninstr |NN const char *big \
2866-
|NN const char *bigend \
2874+
|EPTRQ const char *bigend \
28672875
|NN const char *little \
2868-
|NN const char *lend
2876+
|EPTRQ const char *lend
28692877
p |void |rpeep |NULLOK OP *o
28702878
Adipx |void |rpp_context |NN SV **mark \
28712879
|U8 gimme \
@@ -3729,9 +3737,9 @@ ARTdp |char * |uiv_2buf |NN char * const buf \
37293737
|const int is_uv \
37303738
|NN char ** const peob
37313739
Adp |SSize_t|unpackstring |NN const char *pat \
3732-
|NN const char *patend \
3740+
|EPTRQ const char *patend \
37333741
|NN const char *s \
3734-
|NN const char *strend \
3742+
|EPTRQ const char *strend \
37353743
|U32 flags
37363744
: Used in gv.c, hv.c
37373745
Cp |void |unshare_hek |NULLOK HEK *hek
@@ -3772,7 +3780,7 @@ ARTdmp |U8 * |utf8_hop_safe |NN const U8 *s \
37723780
|NN const U8 * const start \
37733781
|EPTR const U8 * const end
37743782
ARdp |STRLEN |utf8_length |NN const U8 *s0 \
3775-
|NN const U8 *e
3783+
|EPTRQ const U8 *e
37763784
ATdmp |UV |utf8n_to_uvchr |NN const U8 *s \
37773785
|STRLEN curlen \
37783786
|NULLOK STRLEN *retlen \
@@ -4215,7 +4223,7 @@ ep |void |Slab_to_rw |NN OPSLAB * const slab
42154223
#endif /* defined(PERL_CORE) */
42164224
#if defined(PERL_CORE) || defined(PERL_EXT)
42174225
ERXdp |bool |isSCRIPT_RUN |NN const U8 *s \
4218-
|NN const U8 *send \
4226+
|EPTRQ const U8 *send \
42194227
|const bool utf8_target
42204228
ERTXdip |bool |is_utf8_non_invariant_string \
42214229
|NN const U8 * const s \
@@ -4227,7 +4235,7 @@ Ei |STRLEN |sv_or_pv_pos_u2b \
42274235
|NULLOK STRLEN *lenp
42284236
ERTdi |Size_t |variant_under_utf8_count \
42294237
|NN const U8 * const s \
4230-
|NN const U8 * const e
4238+
|EPTRQ const U8 * const e
42314239
# if !defined(HAS_MEMRCHR)
42324240
ETei |void * |my_memrchr |NN const char *s \
42334241
|const char c \
@@ -5259,7 +5267,7 @@ RS |char * |sv_exp_grow |NN SV *sv \
52595267
S |SSize_t|unpack_rec |NN struct tempsym *symptr \
52605268
|NN const char *s \
52615269
|NN const char *strbeg \
5262-
|NN const char *strend \
5270+
|EPTRQ const char *strend \
52635271
|NULLOK const char **new_s
52645272
#endif /* defined(PERL_IN_PP_PACK_C) */
52655273
#if defined(PERL_IN_PP_SORT_C)
@@ -5761,19 +5769,19 @@ EWi |void |capture_clear |NN regexp *rex \
57615769
ERS |char * |find_byclass |NN regexp *prog \
57625770
|NN const regnode *c \
57635771
|NN char *s \
5764-
|NN const char *strend \
5772+
|EPTRQ const char *strend \
57655773
|NULLOK regmatch_info *reginfo
57665774
ERST |U8 * |find_next_masked \
57675775
|NN U8 *s \
5768-
|NN const U8 *send \
5776+
|EPTRQ const U8 *send \
57695777
|const U8 byte \
57705778
|const U8 mask
57715779
ERST |U8 * |find_span_end |NN U8 *s \
5772-
|NN const U8 *send \
5780+
|EPTR const U8 *send \
57735781
|const U8 span_byte
57745782
ERST |U8 * |find_span_end_mask \
57755783
|NN U8 *s \
5776-
|NN const U8 *send \
5784+
|EPTRQ const U8 *send \
57775785
|const U8 span_byte \
57785786
|const U8 mask
57795787
Ei |I32 |foldEQ_latin1_s2_folded \
@@ -5852,7 +5860,7 @@ ES |void |debug_start_match \
58525860
|NN const REGEXP *prog \
58535861
|const bool do_utf8 \
58545862
|NN const char *start \
5855-
|NN const char *end \
5863+
|EPTRQ const char *end \
58565864
|NN const char *blurb
58575865
ES |void |dump_exec_pos |NN const char *locinput \
58585866
|NN const regnode *scan \
@@ -5988,7 +5996,7 @@ S |bool |sv_2iuv_common |NN SV * const sv
59885996
S |STRLEN |sv_pos_b2u_midway \
59895997
|NN const U8 * const s \
59905998
|NN const U8 * const target \
5991-
|NN const U8 *end \
5999+
|EPTRQ const U8 *end \
59926000
|STRLEN endu
59936001
S |STRLEN |sv_pos_u2b_cached \
59946002
|NN SV * const sv \
@@ -6083,14 +6091,14 @@ S |char * |force_word |NN char *start \
60836091
|int allow_pack
60846092
RS |SV * |get_and_check_backslash_N_name_wrapper \
60856093
|NN const char *s \
6086-
|NN const char * const e
6094+
|EPTRQ const char * const e
60876095
S |void |incline |NN const char *s \
6088-
|NN const char *end
6096+
|EPTRQ const char *end
60896097
S |int |intuit_method |NN char *start \
60906098
|NULLOK SV *ioname \
60916099
|NULLOK NOCHECK CV *cv
60926100
S |int |intuit_more |NN char *s \
6093-
|NN char *e
6101+
|EPTRQ char *e
60946102
S |I32 |lop |enum yytokentype t \
60956103
|I32 f \
60966104
|U8 x \

0 commit comments

Comments
 (0)