]> git.vpit.fr Git - perl/modules/Scope-Upper.git/blobdiff - Upper.xs
Merge perl 5.24 fixes from davem
[perl/modules/Scope-Upper.git] / Upper.xs
index 114161a4879cd4ddfe7f13162360f09ecd0ce89e..450945a184be2cc46baad9598cbd4bb5d47eccc1 100644 (file)
--- a/Upper.xs
+++ b/Upper.xs
@@ -653,9 +653,9 @@ static void su_save_helem(pTHX_ HV *hv, SV *keysv, SV *val) {
   return;
  }
 
- if (preeminent)
+ if (preeminent) {
   save_helem(hv, keysv, svp);
- else {
else {
   STRLEN keylen;
   const char * const key = SvPV_const(keysv, keylen);
   SAVEDELETE(hv, savepvn(key, keylen),
@@ -938,15 +938,17 @@ static void su_localize(pTHX_ void *ud_) {
    if (elem) {
     su_save_aelem(GvAV(gv), elem, val);
     return;
-   } else
+   } else {
     save_ary(gv);
+   }
    break;
   case SVt_PVHV:
    if (elem) {
     su_save_helem(GvHV(gv), elem, val);
     return;
-   } else
+   } else {
     save_hash(gv);
+   }
    break;
   case SVt_PVGV:
    save_gp(gv, 1); /* hide previous entry in symtab */
@@ -1076,6 +1078,7 @@ static const int su_cxt_enter_count[] = {
 /* push at least 'size' slots worth of padding onto the savestack */
 
 static void su_ss_push_padding(pTHX_ void *ud, I32 size) {
+#define su_ss_push_padding(U, S) su_ss_push_padding(aTHX_ (U), (S))
  if (size <= 0)
   return;
  if (size < SU_SAVE_ALLOC_SIZE + 1) /* minimum possible SAVEt_ALLOC */
@@ -1092,10 +1095,11 @@ static void su_pop(pTHX_ void *ud);
  * first indicates that this is the first push of a destructor */
 
 static void su_ss_push_destructor(pTHX_ void *ud, I32 depth, bool first) {
+#define su_ss_push_destructor(U, D, F) su_ss_push_destructor(aTHX_ (U), (D), (F))
  su_ud_origin_elem *origin = SU_UD_ORIGIN(ud);
 
  assert(first || origin[depth+1].orig_ix == PL_savestack_ix);
- su_ss_push_padding(aTHX_ ud,
+ su_ss_push_padding(ud,
     (origin[depth].orig_ix + origin[depth].offset) - PL_savestack_ix);
  XSH_D(su_debug_log(
         "%p:     push destructor at save_ix=%d depth=%d scope_ix=%d\n",
@@ -1133,7 +1137,7 @@ static void su_pop(pTHX_ void *ud) {
  SU_UD_DEPTH(ud) = depth;
 
  if (depth > 0) {
-  su_ss_push_destructor(aTHX_ ud, depth-1, 0);
+  su_ss_push_destructor(ud, depth-1, 0);
  } else {
   I32 offset = origin[0].offset; /* grab value before origin is freed */
   switch (SU_UD_TYPE(ud)) {
@@ -1157,7 +1161,7 @@ static void su_pop(pTHX_ void *ud) {
   if (PL_savestack_ix < base + offset) {
    I32 gap = (base + offset) - PL_savestack_ix;
    assert(gap >= SU_SAVE_ALLOC_SIZE + 1);
-   su_ss_push_padding(aTHX_ ud, gap);
+   su_ss_push_padding(ud, gap);
   }
   assert(PL_savestack_ix == base + offset);
  }
@@ -1267,9 +1271,9 @@ static void su_init(pTHX_ void *ud, I32 cxix, I32 size) {
 
 #endif
 
-  if (i == 0)
+  if (i == 0) {
    offset = size;
-  else {
+  else {
    /* we have three constraints to satisfy:
     * 1) Each adjusted offset must be at least SU_SAVE_DESTRUCTOR_SIZE
     *    above its unadjusted boundary, so that there is space to inject a
@@ -1322,7 +1326,7 @@ static void su_init(pTHX_ void *ud, I32 cxix, I32 size) {
  SU_UD_DEPTH(ud)  = depth;
  SU_UD_ORIGIN(ud) = origin;
 
- su_ss_push_destructor(aTHX_ ud, depth-1, 1);
+ su_ss_push_destructor(ud, depth-1, 1);
 }
 
 /* --- Unwind stack -------------------------------------------------------- */
@@ -1392,8 +1396,6 @@ static void su_yield(pTHX_ void *ud_) {
  U8      flags = 0;
  OP     *next;
 
- PERL_UNUSED_VAR(ud_);
-
  cx = cxstack + cxix;
  switch (CxTYPE(cx)) {
   case CXt_BLOCK: {
@@ -2020,6 +2022,7 @@ static int su_uplevel_runops_hook_entersub(pTHX) {
 }
 
 static I32 su_uplevel_new(pTHX_ CV *callback, I32 cxix, I32 args) {
+#define su_uplevel_new(CB, CX, A) su_uplevel_new(aTHX_ (CB), (CX), (A))
  su_uplevel_ud *sud;
  U8 *saved_cxtypes;
  I32 i, ret;
@@ -2089,6 +2092,7 @@ static I32 su_uplevel_new(pTHX_ CV *callback, I32 cxix, I32 args) {
 #else
 
 static I32 su_uplevel_old(pTHX_ CV *callback, I32 cxix, I32 args) {
+#define su_uplevel_old(CB, CX, A) su_uplevel_old(aTHX_ (CB), (CX), (A))
  su_uplevel_ud *sud;
  const PERL_CONTEXT *cx = cxstack + cxix;
  PERL_SI *si;
@@ -3247,9 +3251,9 @@ PPCODE:
     }
     /* su_uplevel() takes care of extending the stack if needed. */
 #if SU_HAS_NEW_CXT
-    ret = su_uplevel_new(aTHX_ (CV *) code, cxix, args);
+    ret = su_uplevel_new((CV *) code, cxix, args);
 #else
-    ret = su_uplevel_old(aTHX_ (CV *) code, cxix, args);
+    ret = su_uplevel_old((CV *) code, cxix, args);
 #endif
     XSRETURN(ret);
    default: