Skip to content

Commit

Permalink
PL_infix_plugin functions should return STRLEN, not int
Browse files Browse the repository at this point in the history
  • Loading branch information
leonerd committed May 4, 2021
1 parent c3fc1d2 commit 56c6442
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion embed.fnc
Expand Up @@ -3611,7 +3611,7 @@ Apxd |void|cop_store_label \

epo |int |keyword_plugin_standard|NN char* keyword_ptr|STRLEN keyword_len|NN OP** op_ptr

epo |int |infix_plugin_standard|NN char* operator_ptr|STRLEN operator_len|NN struct Perl_custom_infix** def
epo |STRLEN |infix_plugin_standard|NN char* operator_ptr|STRLEN operator_len|NN struct Perl_custom_infix** def

#if defined(USE_ITHREADS)
# if defined(PERL_IN_SV_C)
Expand Down
2 changes: 1 addition & 1 deletion perl.h
Expand Up @@ -5609,7 +5609,7 @@ typedef OP* (*Perl_ppaddr_t)(pTHX);
typedef OP* (*Perl_check_t) (pTHX_ OP*);
typedef void(*Perl_ophook_t)(pTHX_ OP*);
typedef int (*Perl_keyword_plugin_t)(pTHX_ char*, STRLEN, OP**);
typedef int (*Perl_infix_plugin_t)(pTHX_ char*, STRLEN, struct Perl_custom_infix **);
typedef STRLEN (*Perl_infix_plugin_t)(pTHX_ char*, STRLEN, struct Perl_custom_infix **);
typedef void(*Perl_cpeep_t)(pTHX_ OP *, OP *);

typedef void(*globhook_t)(pTHX);
Expand Down
2 changes: 1 addition & 1 deletion proto.h
Expand Up @@ -1581,7 +1581,7 @@ PERL_CALLCONV void Perl_hv_undef_flags(pTHX_ HV *hv, U32 flags);

/* PERL_CALLCONV I32 ibcmp_utf8(pTHX_ const char *s1, char **pe1, UV l1, bool u1, const char *s2, char **pe2, UV l2, bool u2); */
#define PERL_ARGS_ASSERT_IBCMP_UTF8
PERL_CALLCONV int Perl_infix_plugin_standard(pTHX_ char* operator_ptr, STRLEN operator_len, struct Perl_custom_infix** def);
PERL_CALLCONV STRLEN Perl_infix_plugin_standard(pTHX_ char* operator_ptr, STRLEN operator_len, struct Perl_custom_infix** def);
#define PERL_ARGS_ASSERT_INFIX_PLUGIN_STANDARD \
assert(operator_ptr); assert(def)
PERL_CALLCONV void Perl_init_argv_symbols(pTHX_ int argc, char **argv);
Expand Down
10 changes: 5 additions & 5 deletions toke.c
Expand Up @@ -8652,11 +8652,11 @@ yyl_keylookup(pTHX_ char *s, GV *gv)
/* Check for plugged-in named operator */
if(PLUGINFIX_IS_ENABLED) {
struct Perl_custom_infix *def;
int result;
STRLEN result;
result = PL_infix_plugin(aTHX_ PL_tokenbuf, len, &def);
if(result) {
if((STRLEN)result != len)
Perl_croak(aTHX_ "Bad infix plugin result (%d) - did not consume entire identifier <%s>\n",
if(result != len)
Perl_croak(aTHX_ "Bad infix plugin result (%zd) - did not consume entire identifier <%s>\n",
result, PL_tokenbuf);
PL_bufptr = s = d;
pl_yylval.pval = (char *)def;
Expand Down Expand Up @@ -8747,7 +8747,7 @@ yyl_try(pTHX_ char *s)
if(PLUGINFIX_IS_ENABLED && isPLUGINFIX_FIRST(*s)) {
struct Perl_custom_infix *def;
char *s_end = s, *d = PL_tokenbuf;
int len;
STRLEN len;

/* Copy the longest sequence of isPLUGINFIX() chars into PL_tokenbuf */
while(s_end < PL_bufend && d < PL_tokenbuf+sizeof(PL_tokenbuf)-1 && isPLUGINFIX(*s_end))
Expand Down Expand Up @@ -12847,7 +12847,7 @@ Perl_keyword_plugin_standard(pTHX_
return KEYWORD_PLUGIN_DECLINE;
}

int
STRLEN
Perl_infix_plugin_standard(pTHX_
char *operator_ptr, STRLEN operator_len, struct Perl_custom_infix **def)
{
Expand Down

0 comments on commit 56c6442

Please sign in to comment.