From: Vincent Pit Date: Fri, 5 Sep 2008 16:39:50 +0000 (+0200) Subject: Only enable turn the MGf_* flags on when the corresponding callback has been specified X-Git-Tag: v0.20~20 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=ffcfa317935c3d62fc81a061d5d97505779c17f8;p=perl%2Fmodules%2FVariable-Magic.git Only enable turn the MGf_* flags on when the corresponding callback has been specified --- diff --git a/Magic.xs b/Magic.xs index bfc75c9..82bf5dd 100644 --- a/Magic.xs +++ b/Magic.xs @@ -266,17 +266,18 @@ STATIC UV vmg_cast(pTHX_ SV *sv, SV *wiz, AV *args) { data = (w->cb_data) ? vmg_data_new(w->cb_data, sv, args) : NULL; mg = sv_magicext(sv, data, PERL_MAGIC_ext, w->vtbl, (const char *) wiz, HEf_SVKEY); mg->mg_private = w->sig; - mg->mg_flags = mg->mg_flags #if MGf_COPY - | MGf_COPY + if (w->cb_copy) + mg->mg_flags |= MGf_COPY; #endif /* MGf_COPY */ #if MGf_DUP - | MGf_DUP + if (w->cb_dup) + mg->mg_flags |= MGf_DUP; #endif /* MGf_DUP */ #if MGf_LOCAL - | MGf_LOCAL + if (w->cb_local) + mg->mg_flags |= MGf_LOCAL; #endif /* MGf_LOCAL */ - ; #if VMG_UVAR if (w->uvar && SvTYPE(sv) >= SVt_PVHV) {