[gjs/wip/js24: 4/11] don't use reserved keywords class, namespace and throw
- From: Tim Lunn <timl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/js24: 4/11] don't use reserved keywords class, namespace and throw
- Date: Wed, 25 Sep 2013 21:29:22 +0000 (UTC)
commit 174cc09c1d4826edd4e9e8eebab5ea6023325cdd
Author: Tim Lunn <tim feathertop org>
Date: Mon Sep 23 09:55:41 2013 +1000
don't use reserved keywords class, namespace and throw
gi/boxed.cpp | 8 ++++----
gi/boxed.h | 2 +-
gi/foreign.cpp | 14 +++++++-------
gi/foreign.h | 2 +-
gi/gerror.cpp | 4 ++--
gi/gerror.h | 2 +-
gi/gtype.cpp | 4 ++--
gi/gtype.h | 2 +-
gi/ns.cpp | 10 +++++-----
gi/object.cpp | 20 ++++++++++----------
gi/object.h | 2 +-
gi/param.cpp | 8 ++++----
gi/param.h | 2 +-
gi/repo.cpp | 18 +++++++++---------
gi/union.cpp | 8 ++++----
gi/union.h | 2 +-
gjs/byteArray.cpp | 4 ++--
gjs/byteArray.h | 2 +-
gjs/jsapi-dynamic-class.cpp | 4 ++--
gjs/jsapi-util.h | 8 ++++----
gjs/type-module.h | 4 ++--
21 files changed, 65 insertions(+), 65 deletions(-)
---
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index 65029cc..049451e 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -1273,18 +1273,18 @@ gjs_typecheck_boxed(JSContext *context,
JSObject *object,
GIStructInfo *expected_info,
GType expected_type,
- JSBool throw)
+ JSBool throw_error)
{
Boxed *priv;
JSBool result;
- if (!do_base_typecheck(context, object, throw))
+ if (!do_base_typecheck(context, object, throw_error))
return JS_FALSE;
priv = priv_from_js(context, object);
if (priv->gboxed == NULL) {
- if (throw) {
+ if (throw_error) {
gjs_throw_custom(context, "TypeError",
"Object is %s.%s.prototype, not an object instance - cannot convert to a boxed
instance",
g_base_info_get_namespace( (GIBaseInfo*) priv->info),
@@ -1301,7 +1301,7 @@ gjs_typecheck_boxed(JSContext *context,
else
result = JS_TRUE;
- if (!result && throw) {
+ if (!result && throw_error) {
if (expected_info != NULL) {
gjs_throw_custom(context, "TypeError",
"Object is of type %s.%s - cannot convert to %s.%s",
diff --git a/gi/boxed.h b/gi/boxed.h
index d113d97..65448f7 100644
--- a/gi/boxed.h
+++ b/gi/boxed.h
@@ -55,7 +55,7 @@ JSBool gjs_typecheck_boxed (JSContext *context,
JSObject *obj,
GIStructInfo *expected_info,
GType expected_type,
- JSBool throw);
+ JSBool throw_error);
G_END_DECLS
diff --git a/gi/foreign.cpp b/gi/foreign.cpp
index cb5e4c5..a81cf18 100644
--- a/gi/foreign.cpp
+++ b/gi/foreign.cpp
@@ -32,7 +32,7 @@
#include "foreign.h"
static struct {
- char *namespace;
+ char *gi_namespace;
char *module; // relative to "imports."
gboolean loaded;
} foreign_modules[] = {
@@ -57,16 +57,16 @@ get_foreign_structs(void)
static JSBool
gjs_foreign_load_foreign_module(JSContext *context,
- const gchar *namespace)
+ const gchar *gi_namespace)
{
int i;
- for (i = 0; foreign_modules[i].namespace; ++i) {
+ for (i = 0; foreign_modules[i].gi_namespace; ++i) {
int code;
GError *error = NULL;
char *script;
- if (strcmp(namespace, foreign_modules[i].namespace) != 0)
+ if (strcmp(gi_namespace, foreign_modules[i].gi_namespace) != 0)
continue;
if (foreign_modules[i].loaded) {
@@ -75,7 +75,7 @@ gjs_foreign_load_foreign_module(JSContext *context,
// FIXME: Find a way to check if a module is imported
// and only execute this statement if isn't
- script = g_strdup_printf("imports.%s;", namespace);
+ script = g_strdup_printf("imports.%s;", gi_namespace);
if (!gjs_context_eval(JS_GetContextPrivate(context), script, strlen(script),
"<internal>", &code,
&error)) {
@@ -92,7 +92,7 @@ gjs_foreign_load_foreign_module(JSContext *context,
}
JSBool
-gjs_struct_foreign_register(const char *namespace,
+gjs_struct_foreign_register(const char *gi_namespace,
const char *type_name,
GjsForeignInfo *info)
{
@@ -102,7 +102,7 @@ gjs_struct_foreign_register(const char *namespace,
g_return_val_if_fail(info->to_func != NULL, JS_FALSE);
g_return_val_if_fail(info->from_func != NULL, JS_FALSE);
- canonical_name = g_strdup_printf("%s.%s", namespace, type_name);
+ canonical_name = g_strdup_printf("%s.%s", gi_namespace, type_name);
g_hash_table_insert(get_foreign_structs(), canonical_name, info);
return JS_TRUE;
}
diff --git a/gi/foreign.h b/gi/foreign.h
index 2b38601..a4d3cf3 100644
--- a/gi/foreign.h
+++ b/gi/foreign.h
@@ -49,7 +49,7 @@ typedef struct {
GjsArgOverrideReleaseGArgumentFunc release_func;
} GjsForeignInfo;
-JSBool gjs_struct_foreign_register (const char *namespace,
+JSBool gjs_struct_foreign_register (const char *gi_namespace,
const char *type_name,
GjsForeignInfo *info);
diff --git a/gi/gerror.cpp b/gi/gerror.cpp
index 4bec86c..bd326cf 100644
--- a/gi/gerror.cpp
+++ b/gi/gerror.cpp
@@ -557,10 +557,10 @@ gjs_gerror_from_error(JSContext *context,
JSBool
gjs_typecheck_gerror (JSContext *context,
JSObject *obj,
- JSBool throw)
+ JSBool throw_error)
{
if (gjs_typecheck_boxed (context, obj, NULL, G_TYPE_ERROR, JS_FALSE))
return TRUE;
- return do_base_typecheck(context, obj, throw);
+ return do_base_typecheck(context, obj, throw_error);
}
diff --git a/gi/gerror.h b/gi/gerror.h
index dfd2a38..ce25477 100644
--- a/gi/gerror.h
+++ b/gi/gerror.h
@@ -41,7 +41,7 @@ JSObject* gjs_error_from_gerror (JSContext *context,
gboolean add_stack);
JSBool gjs_typecheck_gerror (JSContext *context,
JSObject *obj,
- JSBool throw);
+ JSBool throw_error);
G_END_DECLS
diff --git a/gi/gtype.cpp b/gi/gtype.cpp
index b5e1726..01c2e62 100644
--- a/gi/gtype.cpp
+++ b/gi/gtype.cpp
@@ -196,7 +196,7 @@ gjs_gtype_get_actual_gtype (JSContext *context,
JSBool
gjs_typecheck_gtype (JSContext *context,
JSObject *obj,
- JSBool throw)
+ JSBool throw_error)
{
- return do_base_typecheck(context, obj, throw);
+ return do_base_typecheck(context, obj, throw_error);
}
diff --git a/gi/gtype.h b/gi/gtype.h
index 88832b0..b2351e6 100644
--- a/gi/gtype.h
+++ b/gi/gtype.h
@@ -44,7 +44,7 @@ GType gjs_gtype_get_actual_gtype (JSContext *context,
JSBool gjs_typecheck_gtype (JSContext *context,
JSObject *obj,
- JSBool throw);
+ JSBool throw_error);
G_END_DECLS
diff --git a/gi/ns.cpp b/gi/ns.cpp
index 0bcd4b8..f567f43 100644
--- a/gi/ns.cpp
+++ b/gi/ns.cpp
@@ -36,7 +36,7 @@
typedef struct {
GIRepository *repo;
- char *namespace;
+ char *gi_namespace;
} Ns;
@@ -94,7 +94,7 @@ ns_new_resolve(JSContext *context,
repo = g_irepository_get_default();
- info = g_irepository_find_by_name(repo, priv->namespace, name);
+ info = g_irepository_find_by_name(repo, priv->gi_namespace, name);
if (info == NULL) {
/* No property defined, but no error either, so return TRUE */
JS_EndRequest(context);
@@ -140,8 +140,8 @@ ns_finalize(JSFreeOp *fop,
if (priv == NULL)
return; /* we are the prototype, not a real instance */
- if (priv->namespace)
- g_free(priv->namespace);
+ if (priv->gi_namespace)
+ g_free(priv->gi_namespace);
if (priv->repo)
g_object_unref(priv->repo);
@@ -237,7 +237,7 @@ ns_new(JSContext *context,
priv = priv_from_js(context, ns);
priv->repo = g_object_ref(repo);
- priv->namespace = g_strdup(ns_name);
+ priv->gi_namespace = g_strdup(ns_name);
return ns;
}
diff --git a/gi/object.cpp b/gi/object.cpp
index dd85fd4..9b22aa1 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -2052,18 +2052,18 @@ JSBool
gjs_typecheck_object(JSContext *context,
JSObject *object,
GType expected_type,
- JSBool throw)
+ JSBool throw_error)
{
ObjectInstance *priv;
JSBool result;
- if (!do_base_typecheck(context, object, throw))
+ if (!do_base_typecheck(context, object, throw_error))
return JS_FALSE;
priv = priv_from_js(context, object);
if (priv == NULL) {
- if (throw) {
+ if (throw_error) {
gjs_throw(context,
"Object instance or prototype has not been properly initialized yet. "
"Did you forget to chain-up from _init()?");
@@ -2073,7 +2073,7 @@ gjs_typecheck_object(JSContext *context,
}
if (priv->gobj == NULL) {
- if (throw) {
+ if (throw_error) {
gjs_throw(context,
"Object is %s.%s.prototype, not an object instance - cannot convert to GObject*",
priv->info ? g_base_info_get_namespace( (GIBaseInfo*) priv->info) : "",
@@ -2090,7 +2090,7 @@ gjs_typecheck_object(JSContext *context,
else
result = JS_TRUE;
- if (!result && throw) {
+ if (!result && throw_error) {
if (priv->info) {
gjs_throw_custom(context, "TypeError",
"Object is of type %s.%s - cannot convert to %s",
@@ -2356,17 +2356,17 @@ gjs_object_set_gproperty (GObject *object,
}
static void
-gjs_object_class_init(GObjectClass *class,
+gjs_object_class_init(GObjectClass *g_class,
gpointer user_data)
{
GPtrArray *properties;
GType gtype;
gint i;
- gtype = G_OBJECT_CLASS_TYPE (class);
+ gtype = G_OBJECT_CLASS_TYPE (g_class);
- class->set_property = gjs_object_set_gproperty;
- class->get_property = gjs_object_get_gproperty;
+ g_class->set_property = gjs_object_set_gproperty;
+ g_class->get_property = gjs_object_get_gproperty;
gjs_eval_thread = g_thread_self();
@@ -2375,7 +2375,7 @@ gjs_object_class_init(GObjectClass *class,
for (i = 0; i < properties->len; i++) {
GParamSpec *pspec = properties->pdata[i];
g_param_spec_set_qdata(pspec, gjs_is_custom_property_quark(), GINT_TO_POINTER(1));
- g_object_class_install_property (class, i+1, pspec);
+ g_object_class_install_property (g_class, i+1, pspec);
}
gjs_hash_table_for_gsize_remove (class_init_properties, gtype);
diff --git a/gi/object.h b/gi/object.h
index b1a8a1f..046a71a 100644
--- a/gi/object.h
+++ b/gi/object.h
@@ -42,7 +42,7 @@ GObject* gjs_g_object_from_object (JSContext *context,
JSBool gjs_typecheck_object (JSContext *context,
JSObject *obj,
GType expected_type,
- JSBool throw);
+ JSBool throw_error);
void gjs_object_process_pending_toggles (void);
diff --git a/gi/param.cpp b/gi/param.cpp
index e4a8ecf..9efca4c 100644
--- a/gi/param.cpp
+++ b/gi/param.cpp
@@ -581,18 +581,18 @@ JSBool
gjs_typecheck_param(JSContext *context,
JSObject *object,
GType expected_type,
- JSBool throw)
+ JSBool throw_error)
{
Param *priv;
JSBool result;
- if (!do_base_typecheck(context, object, throw))
+ if (!do_base_typecheck(context, object, throw_error))
return JS_FALSE;
priv = priv_from_js(context, object);
if (priv->gparam == NULL) {
- if (throw) {
+ if (throw_error) {
gjs_throw_custom(context, "TypeError",
"Object is GObject.ParamSpec.prototype, not an object instance - "
"cannot convert to a GObject.ParamSpec instance");
@@ -606,7 +606,7 @@ gjs_typecheck_param(JSContext *context,
else
result = JS_TRUE;
- if (!result && throw) {
+ if (!result && throw_error) {
gjs_throw_custom(context, "TypeError",
"Object is of type %s - cannot convert to %s",
g_type_name(G_TYPE_FROM_INSTANCE (priv->gparam)),
diff --git a/gi/param.h b/gi/param.h
index cb3e69c..3de1bb4 100644
--- a/gi/param.h
+++ b/gi/param.h
@@ -39,7 +39,7 @@ JSObject* gjs_param_from_g_param (JSContext *context,
JSBool gjs_typecheck_param (JSContext *context,
JSObject *obj,
GType expected_type,
- JSBool throw);
+ JSBool throw_error);
G_END_DECLS
diff --git a/gi/repo.cpp b/gi/repo.cpp
index 1153667..42909dd 100644
--- a/gi/repo.cpp
+++ b/gi/repo.cpp
@@ -69,7 +69,7 @@ resolve_namespace_object(JSContext *context,
JSObject *versions;
jsval version_val;
char *version;
- JSObject *namespace;
+ JSObject *gi_namespace;
JSObject *override;
jsval result;
@@ -113,35 +113,35 @@ resolve_namespace_object(JSContext *context,
* with the given namespace name, pointing to that namespace
* in the repo.
*/
- namespace = gjs_create_ns(context, ns_name, repo);
- JS_AddObjectRoot(context, &namespace);
+ gi_namespace = gjs_create_ns(context, ns_name, repo);
+ JS_AddObjectRoot(context, &gi_namespace);
/* Define the property early, to avoid reentrancy issues if
the override module looks for namespaces that import this */
if (!JS_DefineProperty(context, repo_obj,
- ns_name, OBJECT_TO_JSVAL(namespace),
+ ns_name, OBJECT_TO_JSVAL(gi_namespace),
NULL, NULL,
GJS_MODULE_PROP_FLAGS))
g_error("no memory to define ns property");
override = lookup_override_function(context, ns_id);
if (override && !JS_CallFunctionValue (context,
- namespace, /* thisp */
+ gi_namespace, /* thisp */
OBJECT_TO_JSVAL(override), /* callee */
0, /* argc */
NULL, /* argv */
&result)) {
- JS_RemoveObjectRoot(context, &namespace);
+ JS_RemoveObjectRoot(context, &gi_namespace);
JS_EndRequest(context);
return NULL;
}
gjs_debug(GJS_DEBUG_GNAMESPACE,
- "Defined namespace '%s' %p in GIRepository %p", ns_name, namespace, repo_obj);
+ "Defined namespace '%s' %p in GIRepository %p", ns_name, gi_namespace, repo_obj);
- JS_RemoveObjectRoot(context, &namespace);
+ JS_RemoveObjectRoot(context, &gi_namespace);
JS_EndRequest(context);
- return namespace;
+ return gi_namespace;
}
/*
diff --git a/gi/union.cpp b/gi/union.cpp
index b8ea650..46c57cc 100644
--- a/gi/union.cpp
+++ b/gi/union.cpp
@@ -459,18 +459,18 @@ gjs_typecheck_union(JSContext *context,
JSObject *object,
GIStructInfo *expected_info,
GType expected_type,
- JSBool throw)
+ JSBool throw_error)
{
Union *priv;
JSBool result;
- if (!do_base_typecheck(context, object, throw))
+ if (!do_base_typecheck(context, object, throw_error))
return JS_FALSE;
priv = priv_from_js(context, object);
if (priv->gboxed == NULL) {
- if (throw) {
+ if (throw_error) {
gjs_throw_custom(context, "TypeError",
"Object is %s.%s.prototype, not an object instance - cannot convert to a union
instance",
g_base_info_get_namespace( (GIBaseInfo*) priv->info),
@@ -487,7 +487,7 @@ gjs_typecheck_union(JSContext *context,
else
result = JS_TRUE;
- if (!result && throw) {
+ if (!result && throw_error) {
if (expected_info != NULL) {
gjs_throw_custom(context, "TypeError",
"Object is of type %s.%s - cannot convert to %s.%s",
diff --git a/gi/union.h b/gi/union.h
index cf5157a..bf97ef4 100644
--- a/gi/union.h
+++ b/gi/union.h
@@ -42,7 +42,7 @@ JSBool gjs_typecheck_union (JSContext *context,
JSObject *obj,
GIStructInfo *expected_info,
GType expected_type,
- JSBool throw);
+ JSBool throw_error);
G_END_DECLS
diff --git a/gjs/byteArray.cpp b/gjs/byteArray.cpp
index 9bd1e04..7ec2412 100644
--- a/gjs/byteArray.cpp
+++ b/gjs/byteArray.cpp
@@ -73,9 +73,9 @@ struct JSClass gjs_byte_array_class = {
JSBool
gjs_typecheck_bytearray(JSContext *context,
JSObject *object,
- JSBool throw)
+ JSBool throw_error)
{
- return do_base_typecheck(context, object, throw);
+ return do_base_typecheck(context, object, throw_error);
}
static JSBool
diff --git a/gjs/byteArray.h b/gjs/byteArray.h
index 2d0dadc..57eed7a 100644
--- a/gjs/byteArray.h
+++ b/gjs/byteArray.h
@@ -35,7 +35,7 @@ G_BEGIN_DECLS
JSBool gjs_typecheck_bytearray (JSContext *context,
JSObject *obj,
- JSBool throw);
+ JSBool throw_error);
JSBool gjs_define_byte_array_stuff (JSContext *context,
JSObject *in_object);
diff --git a/gjs/jsapi-dynamic-class.cpp b/gjs/jsapi-dynamic-class.cpp
index 30fe98a..536701d 100644
--- a/gjs/jsapi-dynamic-class.cpp
+++ b/gjs/jsapi-dynamic-class.cpp
@@ -180,10 +180,10 @@ JSBool
gjs_typecheck_instance(JSContext *context,
JSObject *obj,
JSClass *static_clasp,
- JSBool throw)
+ JSBool throw_error)
{
if (!JS_InstanceOf(context, obj, static_clasp, NULL)) {
- if (throw) {
+ if (throw_error) {
JSClass *obj_class = JS_GetClass(obj);
gjs_throw_custom(context, "TypeError",
diff --git a/gjs/jsapi-util.h b/gjs/jsapi-util.h
index 62cffed..1a4e05d 100644
--- a/gjs/jsapi-util.h
+++ b/gjs/jsapi-util.h
@@ -74,13 +74,13 @@ typedef struct GjsRootedArray GjsRootedArray;
* priv_from_js_with_typecheck: a convenience function to call
* do_base_typecheck and priv_from_js
*/
-#define GJS_DEFINE_PRIV_FROM_JS(type, class) \
+#define GJS_DEFINE_PRIV_FROM_JS(type, g_class) \
__attribute__((unused)) static inline JSBool \
do_base_typecheck(JSContext *context, \
JSObject *object, \
- JSBool throw) \
+ JSBool throw_error) \
{ \
- return gjs_typecheck_instance(context, object, &class, throw); \
+ return gjs_typecheck_instance(context, object, &g_class, throw_error); \
} \
static inline type * \
priv_from_js(JSContext *context, \
@@ -88,7 +88,7 @@ typedef struct GjsRootedArray GjsRootedArray;
{ \
type *priv; \
JS_BeginRequest(context); \
- priv = JS_GetInstancePrivate(context, object, &class, NULL); \
+ priv = JS_GetInstancePrivate(context, object, &g_class, NULL); \
JS_EndRequest(context); \
return priv; \
} \
diff --git a/gjs/type-module.h b/gjs/type-module.h
index a4ea514..543bfce 100644
--- a/gjs/type-module.h
+++ b/gjs/type-module.h
@@ -31,9 +31,9 @@ typedef struct _GjsTypeModuleClass GjsTypeModuleClass;
#define GJS_TYPE_TYPE_MODULE (gjs_type_module_get_type ())
#define GJS_TYPE_MODULE(module) (G_TYPE_CHECK_INSTANCE_CAST ((module), GJS_TYPE_TYPE_MODULE,
GjsTypeModule))
-#define GJS_TYPE_MODULE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), GJS_TYPE_TYPE_MODULE,
GjsTypeModuleClass))
+#define GJS_TYPE_MODULE_CLASS(g_class) (G_TYPE_CHECK_CLASS_CAST ((g_class), GJS_TYPE_TYPE_MODULE,
GjsTypeModuleClass))
#define GJS_IS_TYPE_MODULE(module) (G_TYPE_CHECK_INSTANCE_TYPE ((module), GJS_TYPE_TYPE_MODULE))
-#define GJS_IS_TYPE_MODULE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), GJS_TYPE_TYPE_MODULE))
+#define GJS_IS_TYPE_MODULE_CLASS(g_class) (G_TYPE_CHECK_CLASS_TYPE ((g_class), GJS_TYPE_TYPE_MODULE))
#define GJS_TYPE_MODULE_GET_CLASS(module) (G_TYPE_INSTANCE_GET_CLASS ((module), GJS_TYPE_TYPE_MODULE,
GjsTypeModuleClass))
GType gjs_type_module_get_type (void) G_GNUC_CONST;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]