summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2011-03-10 16:40:48 -0500
committerColin Walters <walters@verbum.org>2011-03-10 16:46:51 -0500
commitf4b6d472853fe863f8ea082bd02e9b24384947b8 (patch)
treee7fa1479ab00cb54ca84947470170ae34a76dca0
parent8185ddd8cfbf818cbcea668f3ce99afde614cb6c (diff)
downloadgjs-f4b6d472853fe863f8ea082bd02e9b24384947b8.tar.gz
Revert "Drop the GJS_NATIVE_CONSTRUCTOR_VARIABLES macro"
This reverts commit e4ce5947b00cd73436d2a5e2305f919e8466b695. It didn't actually work because in the old xulrunner 1.9 case, JSObject * comes from the prototype.
-rw-r--r--gi/boxed.c3
-rw-r--r--gi/keep-alive.c2
-rw-r--r--gi/ns.c2
-rw-r--r--gi/object.c3
-rw-r--r--gi/param.c2
-rw-r--r--gi/repo.c2
-rw-r--r--gi/union.c2
-rw-r--r--gjs/byteArray.c3
-rw-r--r--gjs/compat.h11
-rw-r--r--gjs/importer.c2
-rw-r--r--modules/cairo-context.c3
-rw-r--r--modules/cairo-image-surface.c3
-rw-r--r--modules/cairo-linear-gradient.c3
-rw-r--r--modules/cairo-pdf-surface.c3
-rw-r--r--modules/cairo-ps-surface.c3
-rw-r--r--modules/cairo-radial-gradient.c3
-rw-r--r--modules/cairo-surface-pattern.c3
-rw-r--r--modules/cairo-svg-surface.c3
-rw-r--r--modules/dbus-exports.c2
19 files changed, 29 insertions, 29 deletions
diff --git a/gi/boxed.c b/gi/boxed.c
index faff71e9..268d6294 100644
--- a/gi/boxed.c
+++ b/gi/boxed.c
@@ -416,8 +416,7 @@ boxed_init(JSContext *context,
*/
GJS_NATIVE_CONSTRUCTOR_DECLARE(boxed)
{
- JSObject *object = NULL; \
- jsval *argv = JS_ARGV(context, vp);
+ GJS_NATIVE_CONSTRUCTOR_VARIABLES(boxed)
Boxed *priv;
Boxed *proto_priv;
JSClass *obj_class;
diff --git a/gi/keep-alive.c b/gi/keep-alive.c
index dd59d17d..028f9008 100644
--- a/gi/keep-alive.c
+++ b/gi/keep-alive.c
@@ -90,7 +90,7 @@ child_free(void *data)
*/
GJS_NATIVE_CONSTRUCTOR_DECLARE(keep_alive)
{
- JSObject *object = NULL; \
+ GJS_NATIVE_CONSTRUCTOR_VARIABLES(keep_alive)
KeepAlive *priv;
GJS_NATIVE_CONSTRUCTOR_PRELUDE(keep_alive);
diff --git a/gi/ns.c b/gi/ns.c
index 945b5d0d..665af8a2 100644
--- a/gi/ns.c
+++ b/gi/ns.c
@@ -156,7 +156,7 @@ ns_new_resolve(JSContext *context,
*/
GJS_NATIVE_CONSTRUCTOR_DECLARE(ns)
{
- JSObject *object = NULL; \
+ GJS_NATIVE_CONSTRUCTOR_VARIABLES(ns)
Ns *priv;
GJS_NATIVE_CONSTRUCTOR_PRELUDE(ns);
diff --git a/gi/object.c b/gi/object.c
index 18afa796..e0592283 100644
--- a/gi/object.c
+++ b/gi/object.c
@@ -620,8 +620,7 @@ wrapped_gobj_toggle_notify(gpointer data,
*/
GJS_NATIVE_CONSTRUCTOR_DECLARE(object_instance)
{
- JSObject *object = NULL; \
- jsval *argv = JS_ARGV(context, vp);
+ GJS_NATIVE_CONSTRUCTOR_VARIABLES(object_instance)
ObjectInstance *priv;
ObjectInstance *proto_priv;
JSObject *proto;
diff --git a/gi/param.c b/gi/param.c
index 6bbdad94..77b83afd 100644
--- a/gi/param.c
+++ b/gi/param.c
@@ -150,7 +150,7 @@ param_new_resolve(JSContext *context,
*/
GJS_NATIVE_CONSTRUCTOR_DECLARE(param)
{
- JSObject *object = NULL; \
+ GJS_NATIVE_CONSTRUCTOR_VARIABLES(param)
Param *priv;
Param *proto_priv;
JSClass *obj_class;
diff --git a/gi/repo.c b/gi/repo.c
index db6905e6..097ca673 100644
--- a/gi/repo.c
+++ b/gi/repo.c
@@ -169,7 +169,7 @@ repo_new_resolve(JSContext *context,
*/
GJS_NATIVE_CONSTRUCTOR_DECLARE(repo)
{
- JSObject *object = NULL; \
+ GJS_NATIVE_CONSTRUCTOR_VARIABLES(repo)
Repo *priv;
GJS_NATIVE_CONSTRUCTOR_PRELUDE(repo);
diff --git a/gi/union.c b/gi/union.c
index cdf93dd5..8d1ee6e6 100644
--- a/gi/union.c
+++ b/gi/union.c
@@ -209,7 +209,7 @@ union_new(JSContext *context,
*/
GJS_NATIVE_CONSTRUCTOR_DECLARE(union)
{
- JSObject *object = NULL; \
+ GJS_NATIVE_CONSTRUCTOR_VARIABLES(union)
Union *priv;
Union *proto_priv;
JSClass *obj_class;
diff --git a/gjs/byteArray.c b/gjs/byteArray.c
index 70a42030..02c627f9 100644
--- a/gjs/byteArray.c
+++ b/gjs/byteArray.c
@@ -439,8 +439,7 @@ gjs_g_byte_array_new(int preallocated_length)
*/
GJS_NATIVE_CONSTRUCTOR_DECLARE(byte_array)
{
- JSObject *object = NULL; \
- jsval *argv = JS_ARGV(context, vp);
+ GJS_NATIVE_CONSTRUCTOR_VARIABLES(byte_array)
ByteArrayInstance *priv;
JSObject *proto;
gboolean is_proto;
diff --git a/gjs/compat.h b/gjs/compat.h
index c3599b29..3ceeb1d4 100644
--- a/gjs/compat.h
+++ b/gjs/compat.h
@@ -81,6 +81,15 @@ gjs_##name##_constructor(JSContext *context, \
jsval *vp)
/**
+ * GJS_NATIVE_CONSTRUCTOR_VARIABLES:
+ * Declare variables necessary for the constructor; should
+ * be at the very top.
+ */
+#define GJS_NATIVE_CONSTRUCTOR_VARIABLES(name) \
+ JSObject *object = NULL; \
+ jsval *argv = JS_ARGV(context, vp);
+
+/**
* GJS_NATIVE_CONSTRUCTOR_PRELUDE:
* Call after the initial variable declaration.
*/
@@ -114,6 +123,8 @@ gjs_##name##_constructor(JSContext *context, \
jsval *argv, \
jsval *retval)
+#define GJS_NATIVE_CONSTRUCTOR_VARIABLES(name)
+
#define GJS_NATIVE_CONSTRUCTOR_PRELUDE(name) \
if (!JS_IsConstructing(context)) { \
gjs_throw_constructor_error(context); \
diff --git a/gjs/importer.c b/gjs/importer.c
index 571d51fc..7aa674ef 100644
--- a/gjs/importer.c
+++ b/gjs/importer.c
@@ -967,7 +967,7 @@ importer_new_resolve(JSContext *context,
*/
GJS_NATIVE_CONSTRUCTOR_DECLARE(importer)
{
- JSObject *object = NULL; \
+ GJS_NATIVE_CONSTRUCTOR_VARIABLES(importer)
Importer *priv;
GJS_NATIVE_CONSTRUCTOR_PRELUDE(importer);
diff --git a/modules/cairo-context.c b/modules/cairo-context.c
index bdb89acf..7b9575fa 100644
--- a/modules/cairo-context.c
+++ b/modules/cairo-context.c
@@ -274,8 +274,7 @@ _gjs_cairo_context_construct_internal(JSContext *context,
GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_context)
{
- JSObject *object = NULL; \
- jsval *argv = JS_ARGV(context, vp);
+ GJS_NATIVE_CONSTRUCTOR_VARIABLES(cairo_context)
JSObject *surface_wrapper;
cairo_surface_t *surface;
cairo_t *cr;
diff --git a/modules/cairo-image-surface.c b/modules/cairo-image-surface.c
index 30b0df29..c2e587fc 100644
--- a/modules/cairo-image-surface.c
+++ b/modules/cairo-image-surface.c
@@ -31,8 +31,7 @@ GJS_DEFINE_PROTO("CairoImageSurface", cairo_image_surface)
GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_image_surface)
{
- JSObject *object = NULL; \
- jsval *argv = JS_ARGV(context, vp);
+ GJS_NATIVE_CONSTRUCTOR_VARIABLES(cairo_image_surface)
int format, width, height;
cairo_surface_t *surface;
diff --git a/modules/cairo-linear-gradient.c b/modules/cairo-linear-gradient.c
index 4132c960..74efc90c 100644
--- a/modules/cairo-linear-gradient.c
+++ b/modules/cairo-linear-gradient.c
@@ -31,8 +31,7 @@ GJS_DEFINE_PROTO("CairoLinearGradient", cairo_linear_gradient)
GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_linear_gradient)
{
- JSObject *object = NULL; \
- jsval *argv = JS_ARGV(context, vp);
+ GJS_NATIVE_CONSTRUCTOR_VARIABLES(cairo_linear_gradient)
double x0, y0, x1, y1;
cairo_pattern_t *pattern;
diff --git a/modules/cairo-pdf-surface.c b/modules/cairo-pdf-surface.c
index 144d53bf..6aca6134 100644
--- a/modules/cairo-pdf-surface.c
+++ b/modules/cairo-pdf-surface.c
@@ -34,8 +34,7 @@ GJS_DEFINE_PROTO("CairoPDFSurface", cairo_pdf_surface)
GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_pdf_surface)
{
- JSObject *object = NULL; \
- jsval *argv = JS_ARGV(context, vp);
+ GJS_NATIVE_CONSTRUCTOR_VARIABLES(cairo_pdf_surface)
char *filename;
double width, height;
cairo_surface_t *surface;
diff --git a/modules/cairo-ps-surface.c b/modules/cairo-ps-surface.c
index 6e86c1a4..ca0fad45 100644
--- a/modules/cairo-ps-surface.c
+++ b/modules/cairo-ps-surface.c
@@ -34,8 +34,7 @@ GJS_DEFINE_PROTO("CairoPSSurface", cairo_ps_surface)
GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_ps_surface)
{
- JSObject *object = NULL; \
- jsval *argv = JS_ARGV(context, vp);
+ GJS_NATIVE_CONSTRUCTOR_VARIABLES(cairo_ps_surface)
char *filename;
double width, height;
cairo_surface_t *surface;
diff --git a/modules/cairo-radial-gradient.c b/modules/cairo-radial-gradient.c
index 6b9a20c4..48f8b0b4 100644
--- a/modules/cairo-radial-gradient.c
+++ b/modules/cairo-radial-gradient.c
@@ -31,8 +31,7 @@ GJS_DEFINE_PROTO("CairoRadialGradient", cairo_radial_gradient)
GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_radial_gradient)
{
- JSObject *object = NULL; \
- jsval *argv = JS_ARGV(context, vp);
+ GJS_NATIVE_CONSTRUCTOR_VARIABLES(cairo_radial_gradient)
double cx0, cy0, radius0, cx1, cy1, radius1;
cairo_pattern_t *pattern;
diff --git a/modules/cairo-surface-pattern.c b/modules/cairo-surface-pattern.c
index 3f9cf3db..8791e320 100644
--- a/modules/cairo-surface-pattern.c
+++ b/modules/cairo-surface-pattern.c
@@ -31,8 +31,7 @@ GJS_DEFINE_PROTO("CairoSurfacePattern", cairo_surface_pattern)
GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_surface_pattern)
{
- JSObject *object = NULL; \
- jsval *argv = JS_ARGV(context, vp);
+ GJS_NATIVE_CONSTRUCTOR_VARIABLES(cairo_surface_pattern)
JSObject *surface_wrapper;
cairo_surface_t *surface;
cairo_pattern_t *pattern;
diff --git a/modules/cairo-svg-surface.c b/modules/cairo-svg-surface.c
index 03880a4c..6acc26c5 100644
--- a/modules/cairo-svg-surface.c
+++ b/modules/cairo-svg-surface.c
@@ -34,8 +34,7 @@ GJS_DEFINE_PROTO("CairoSVGSurface", cairo_svg_surface)
GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_svg_surface)
{
- JSObject *object = NULL; \
- jsval *argv = JS_ARGV(context, vp);
+ GJS_NATIVE_CONSTRUCTOR_VARIABLES(cairo_svg_surface)
char *filename;
double width, height;
cairo_surface_t *surface;
diff --git a/modules/dbus-exports.c b/modules/dbus-exports.c
index 3c1d8b40..d5c71987 100644
--- a/modules/dbus-exports.c
+++ b/modules/dbus-exports.c
@@ -1708,7 +1708,7 @@ exports_new_resolve(JSContext *context,
*/
GJS_NATIVE_CONSTRUCTOR_DECLARE(js_exports)
{
- JSObject *object = NULL; \
+ GJS_NATIVE_CONSTRUCTOR_VARIABLES(js_exports)
Exports *priv;
GJS_NATIVE_CONSTRUCTOR_PRELUDE(js_exports);