From: Vincent Pit Date: Mon, 19 Apr 2010 22:13:23 +0000 (+0200) Subject: Add a "flags" parameter to sub_op_register() X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=b9c3a456f75424383f35cb83000965d76e56d4ed;p=perl%2Fmodules%2FSub-Op.git Add a "flags" parameter to sub_op_register() If we're gonna break the API, let's do it with a BANG. --- diff --git a/Op.xs b/Op.xs index ecdac3a..c5be45b 100644 --- a/Op.xs +++ b/Op.xs @@ -123,7 +123,7 @@ void sub_op_init(sub_op_config_t *c) { return; } -void sub_op_register(pTHX_ const sub_op_config_t *c) { +void sub_op_register(pTHX_ const sub_op_config_t *c, U32 flags) { SV *key = newSViv(PTR2IV(c->pp)); if (!PL_custom_op_names) diff --git a/lib/Sub/Op.pm b/lib/Sub/Op.pm index cf67eac..20cc912 100644 --- a/lib/Sub/Op.pm +++ b/lib/Sub/Op.pm @@ -56,7 +56,7 @@ In your XS file : c.pp = scalar_util_reftype; c.check = 0; c.ud = NULL; - sub_op_register(aTHX_ &c); + sub_op_register(aTHX_ &c, 0); } In your Perl module file : @@ -253,7 +253,7 @@ Initializes the fields of the C object. For future compatibility, it is required to call this function with your config object before storing your actual values. It will store safe defaults for members you won't set. -=head2 C +=head2 C Registers a name and its configuration into L. The caller is responsible for allocating and freeing the C object. diff --git a/sub_op.h b/sub_op.h index c594f03..5dbb320 100644 --- a/sub_op.h +++ b/sub_op.h @@ -15,7 +15,7 @@ typedef struct { } sub_op_config_t; void sub_op_init (sub_op_config_t *c); -void sub_op_register(pTHX_ const sub_op_config_t *c); +void sub_op_register(pTHX_ const sub_op_config_t *c, U32 flags); sub_op_config_t *sub_op_dup (pTHX_ const sub_op_config_t *c); void sub_op_free (pTHX_ sub_op_config_t *c); diff --git a/t/Sub-Op-LexicalSub/LexicalSub.xs b/t/Sub-Op-LexicalSub/LexicalSub.xs index c2b7002..a9b1344 100644 --- a/t/Sub-Op-LexicalSub/LexicalSub.xs +++ b/t/Sub-Op-LexicalSub/LexicalSub.xs @@ -67,7 +67,7 @@ PPCODE: c.check = sols_check; c.ud = SvREFCNT_inc(cb); c.pp = sols_pp; - sub_op_register(aTHX_ &c); + sub_op_register(aTHX_ &c, 0); } } XSRETURN(0);