/* ... svt callbacks ....................................................... */
+#define VMG_CB_CALL_SET_RET(D) \
+ { \
+ SV *svr; \
+ SPAGAIN; \
+ svr = POPs; \
+ ret = SvOK(svr) ? SvIV(svr) : (D); \
+ PUTBACK; \
+ }
+
#define VMG_CB_CALL_ARGS_MASK 15
#define VMG_CB_CALL_ARGS_SHIFT 4
#define VMG_CB_CALL_OPINFO (VMG_OP_INFO_NAME|VMG_OP_INFO_OBJECT)
STATIC int vmg_cb_call(pTHX_ SV *cb, SV *sv, SV *data, unsigned int flags, ...){
va_list ap;
- SV *svr;
int ret;
unsigned int i, args, opinfo, eval, has_err = 0;
++PL_error_count;
}
- SPAGAIN;
- svr = POPs;
- ret = SvOK(svr) ? SvIV(svr) : 0;
- PUTBACK;
+ VMG_CB_CALL_SET_RET(0);
FREETMPS;
LEAVE;
}
STATIC U32 vmg_svt_len(pTHX_ SV *sv, MAGIC *mg) {
- SV *svr;
const MGWIZ *w = SV2MGWIZ(mg->mg_ptr);
unsigned int opinfo = w->opinfo;
U32 len, ret;
call_sv(w->cb_len, G_SCALAR);
- SPAGAIN;
- svr = POPs;
- ret = SvOK(svr) ? SvUV(svr) : len;
- PUTBACK;
+ VMG_CB_CALL_SET_RET(len);
FREETMPS;
LEAVE;