Skip to content
This repository has been archived by the owner on Aug 18, 2018. It is now read-only.

Commit

Permalink
Fixed __jroot_tmpname lifetime, and removed forced-GC used while debu…
Browse files Browse the repository at this point in the history
…gging.
  • Loading branch information
matthewd committed Apr 28, 2008
1 parent 98b8ebb commit 5b621ef
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ext/spidermonkey/jroot.h
Expand Up @@ -15,7 +15,6 @@
#define _PREPARE_JROOTS(rb, context, name, maxcount) \
const bool __jroot_ruby = rb; \
const char* const MAYBE_UNUSED(__jroot_basename) = name; \
char MAYBE_UNUSED(__jroot_tmpname[_JROOT_NAMESIZE]); \
int MAYBE_UNUSED(__jroot_max) = maxcount - 1; \
void* __jroot_map[maxcount]; \
OurContext* __jroot_context = context; \
Expand All @@ -30,12 +29,12 @@
#define _JROOT(ptr, name) \
do \
{ \
char __jroot_tmpname[_JROOT_NAMESIZE]; \
assert(__jroot_idx <= __jroot_max); \
__jroot_map[__jroot_idx] = ptr; \
snprintf(__jroot_tmpname, _JROOT_NAMESIZE, "%s[%d]:%s: %s", __FILE__, __LINE__, __jroot_basename, name); \
JCHECK(JS_AddNamedRoot(__jroot_context->js, __jroot_map[__jroot_idx], __jroot_tmpname)); \
__jroot_idx++; \
JS_GC(__jroot_context->js); \
} while(0)

#define JROOT(var) _JROOT(&(var), #var)
Expand Down Expand Up @@ -80,13 +79,15 @@
#define JRETURN \
do \
{ \
assert(!__jroot_ruby); \
REMOVE_JROOTS; \
return JS_TRUE; \
} while(0)

#define JRETURN_RUBY(value) \
do \
{ \
assert(__jroot_ruby); \
typeof(value) __jroot_result = value; \
REMOVE_JROOTS; \
return __jroot_result; \
Expand Down

0 comments on commit 5b621ef

Please sign in to comment.