summaryrefslogtreecommitdiff
path: root/scope.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-11-18 15:47:35 +0000
committerNicholas Clark <nick@ccl4.org>2009-11-18 15:47:35 +0000
commita09dc31d1f5b871705115bdc1984ce8e4f4c22f5 (patch)
treef1741bce4ecc9467305c75925e999332b5c9f174 /scope.h
parentf2b88940d815760ad254d35a0ee1eb2ed8ce7762 (diff)
downloadperl-a09dc31d1f5b871705115bdc1984ce8e4f4c22f5.tar.gz
Skip the scope name checks if PL_scopestack_name is NULL.
It's possible that someone has built a module with -DDEBUGGING, but they're using it against a perl built non-DEBUGGING, in which case PL_scopestack_name will be NULL. Better to skip the checks than to SEGV.
Diffstat (limited to 'scope.h')
-rw-r--r--scope.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/scope.h b/scope.h
index 2f50398eab..64e7e279f1 100644
--- a/scope.h
+++ b/scope.h
@@ -134,15 +134,18 @@ scope has the given name. Name must be a literal string.
#define ENTER_with_name(name) \
STMT_START { \
push_scope(); \
- PL_scopestack_name[PL_scopestack_ix-1] = name; \
+ if (PL_scopestack_name) \
+ PL_scopestack_name[PL_scopestack_ix-1] = name; \
DEBUG_SCOPE("ENTER \"" name "\"") \
} STMT_END
#define LEAVE_with_name(name) \
STMT_START { \
DEBUG_SCOPE("LEAVE \"" name "\"") \
- assert(((char*)PL_scopestack_name[PL_scopestack_ix-1] \
- == (char*)name) \
- || strEQ(PL_scopestack_name[PL_scopestack_ix-1], name)); \
+ if (PL_scopestack_name) { \
+ assert(((char*)PL_scopestack_name[PL_scopestack_ix-1] \
+ == (char*)name) \
+ || strEQ(PL_scopestack_name[PL_scopestack_ix-1], name)); \
+ } \
pop_scope(); \
} STMT_END
#else