diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-06-13 12:38:16 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-06-13 12:38:16 +0200 |
commit | 0240605ecd7a040cc6058409c65a3ebc6b7d489b (patch) | |
tree | a9d802be94044e57899412a19af1c8860e2ef55c | |
parent | bc0c81caab3813b2d61b70f94e5075bbf3a3ef69 (diff) | |
download | perl-0240605ecd7a040cc6058409c65a3ebc6b7d489b.tar.gz |
Add a gimme parameter to S_tied_handle_method().
This allows "GETC" to use it.
-rw-r--r-- | embed.fnc | 2 | ||||
-rw-r--r-- | pp_sys.c | 29 | ||||
-rw-r--r-- | proto.h | 2 |
3 files changed, 15 insertions, 18 deletions
@@ -1718,7 +1718,7 @@ sR |int |dooneliner |NN const char *cmd|NN const char *filename s |SV * |space_join_names_mortal|NN char *const *array so |OP * |tied_handle_method|NN const char *const methname|NN SV **sp \ |NN IO *const io|NN MAGIC *const mg \ - |unsigned int argc|... + |const U32 gimme|unsigned int argc|... #endif #if defined(PERL_IN_REGCOMP_C) || defined(PERL_DECL_PROT) @@ -554,7 +554,8 @@ PP(pp_open) static OP * S_tied_handle_method(pTHX_ const char *const methname, SV **sp, - IO *const io, MAGIC *const mg, unsigned int argc, ...) + IO *const io, MAGIC *const mg, const U32 gimme, + unsigned int argc, ...) { PERL_ARGS_ASSERT_TIED_HANDLE_METHOD; @@ -572,17 +573,17 @@ S_tied_handle_method(pTHX_ const char *const methname, SV **sp, PUTBACK; ENTER_with_name("call_tied_handle_method"); - call_method(methname, G_SCALAR); + call_method(methname, gimme); LEAVE_with_name("call_tied_handle_method"); return NORMAL; } #define tied_handle_method(a,b,c,d) \ - S_tied_handle_method(aTHX_ a,b,c,d,0) + S_tied_handle_method(aTHX_ a,b,c,d,G_SCALAR,0) #define tied_handle_method1(a,b,c,d,e) \ - S_tied_handle_method(aTHX_ a,b,c,d,1,e) + S_tied_handle_method(aTHX_ a,b,c,d,G_SCALAR,1,e) #define tied_handle_method2(a,b,c,d,e,f) \ - S_tied_handle_method(aTHX_ a,b,c,d,2,e,f) + S_tied_handle_method(aTHX_ a,b,c,d,G_SCALAR,2,e,f) PP(pp_close) { @@ -750,7 +751,7 @@ PP(pp_binmode) function, which I don't think that the optimiser will be able to figure out. Although, as it's a static function, in theory it could. */ - return S_tied_handle_method(aTHX_ "BINMODE", SP, io, mg, + return S_tied_handle_method(aTHX_ "BINMODE", SP, io, mg, G_SCALAR, discp ? 1 : 0, discp); } } @@ -1215,17 +1216,13 @@ PP(pp_getc) if (gv && (io = GvIO(gv))) { MAGIC * const mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar); if (mg) { - const I32 gimme = GIMME_V; - PUSHMARK(SP); - PUSHs(SvTIED_obj(MUTABLE_SV(io), mg)); - PUTBACK; - ENTER; - call_method("GETC", gimme); - LEAVE; - SPAGAIN; - if (gimme == G_SCALAR) + const U32 gimme = GIMME_V; + S_tied_handle_method(aTHX_ "GETC", SP, io, mg, gimme, 0); + if (gimme == G_SCALAR) { + SPAGAIN; SvSetMagicSV_nosteal(TARG, TOPs); - RETURN; + } + return NORMAL; } } if (!gv || do_eof(gv)) { /* make sure we have fp with something */ @@ -5350,7 +5350,7 @@ STATIC SV * S_space_join_names_mortal(pTHX_ char *const *array) #define PERL_ARGS_ASSERT_SPACE_JOIN_NAMES_MORTAL \ assert(array) -STATIC OP * S_tied_handle_method(pTHX_ const char *const methname, SV **sp, IO *const io, MAGIC *const mg, unsigned int argc, ...) +STATIC OP * S_tied_handle_method(pTHX_ const char *const methname, SV **sp, IO *const io, MAGIC *const mg, const U32 gimme, unsigned int argc, ...) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3) |