[gjs] Backport of patch required for JSObject compare to nullptr
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] Backport of patch required for JSObject compare to nullptr
- Date: Sun, 30 Jul 2017 15:48:13 +0000 (UTC)
commit c1bc5095c398220d435c84a9d99491a36eb4bc2d
Author: luke nukem jones gmail com <luke nukem jones gmail com>
Date: Sun Jul 30 01:54:00 2017 -0700
Backport of patch required for JSObject compare to nullptr
https://bugzilla.gnome.org/show_bug.cgi?id=785424
gi/arg.cpp | 14 +++++++-------
gi/boxed.cpp | 4 ++--
gi/closure.cpp | 4 ++--
gi/enumeration.cpp | 2 +-
gi/function.cpp | 4 ++--
gi/fundamental.cpp | 6 +++---
gi/gerror.cpp | 2 +-
gi/ns.cpp | 2 +-
gi/object.cpp | 16 ++++++++--------
gi/param.cpp | 4 ++--
gi/repo.cpp | 2 +-
gi/union.cpp | 2 +-
gjs/byteArray.cpp | 20 ++++++++++----------
gjs/coverage.cpp | 6 +++---
gjs/global.cpp | 4 ++--
gjs/importer.cpp | 13 ++++++-------
gjs/jsapi-class.h | 4 ++--
gjs/jsapi-util-error.cpp | 2 +-
gjs/jsapi-util-string.cpp | 4 ++--
gjs/jsapi-util.cpp | 26 +++++++++++++-------------
modules/cairo-pattern.cpp | 2 +-
modules/cairo-surface.cpp | 2 +-
22 files changed, 72 insertions(+), 73 deletions(-)
---
diff --git a/gi/arg.cpp b/gi/arg.cpp
index 77de076..efd229b 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -595,7 +595,7 @@ gjs_array_from_strv(JSContext *context,
}
JS::RootedObject obj(context, JS_NewArrayObject(context, elems));
- if (obj == NULL)
+ if (!obj)
return false;
value_p.setObject(*obj);
@@ -2190,7 +2190,7 @@ gjs_array_from_g_list (JSContext *context,
}
JS::RootedObject obj(context, JS_NewArrayObject(context, elems));
- if (obj == NULL)
+ if (!obj)
return false;
value_p.setObject(*obj);
@@ -2223,7 +2223,7 @@ gjs_array_from_carray_internal (JSContext *context,
JS::RootedObject obj(context,
gjs_byte_array_from_byte_array(context, &gbytearray));
- if (obj == NULL)
+ if (!obj)
return false;
value_p.setObject(*obj);
return true;
@@ -2328,7 +2328,7 @@ gjs_array_from_carray_internal (JSContext *context,
#undef ITERATE
JS::RootedObject obj(context, JS_NewArrayObject(context, elems));
- if (obj == NULL)
+ if (!obj)
return false;
value_p.setObject(*obj);
@@ -2437,7 +2437,7 @@ gjs_array_from_zero_terminated_c_array (JSContext *context,
JS::RootedObject obj(context,
gjs_byte_array_from_byte_array(context, &gbytearray));
- if (obj == NULL)
+ if (!obj)
return false;
value_p.setObject(*obj);
return true;
@@ -2518,7 +2518,7 @@ gjs_array_from_zero_terminated_c_array (JSContext *context,
#undef ITERATE
JS::RootedObject obj(context, JS_NewArrayObject(context, elems));
- if (obj == NULL)
+ if (!obj)
return false;
value_p.setObject(*obj);
@@ -2544,7 +2544,7 @@ gjs_object_from_g_hash (JSContext *context,
}
JS::RootedObject obj(context, JS_NewPlainObject(context));
- if (obj == NULL)
+ if (!obj)
return false;
value_p.setObject(*obj);
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index e7cd79d..3924bc4 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -561,7 +561,7 @@ get_nested_interface_object(JSContext *context,
obj = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto);
- if (obj == NULL)
+ if (!obj)
return false;
GJS_INC_COUNTER(boxed);
@@ -1257,7 +1257,7 @@ gjs_c_struct_from_boxed(JSContext *context,
{
Boxed *priv;
- if (obj == NULL)
+ if (!obj)
return NULL;
priv = priv_from_js(context, obj);
diff --git a/gi/closure.cpp b/gi/closure.cpp
index 4173f98..5578335 100644
--- a/gi/closure.cpp
+++ b/gi/closure.cpp
@@ -110,8 +110,8 @@ global_context_finalized(JS::HandleObject obj,
"which calls object %p",
c, c->obj.get());
- if (c->obj != NULL) {
- g_assert(c->obj == obj);
+ if (c->obj) {
+ g_assert(c->obj == obj.get());
invalidate_js_pointers(gc);
}
diff --git a/gi/enumeration.cpp b/gi/enumeration.cpp
index 9b0f470..9f6c91f 100644
--- a/gi/enumeration.cpp
+++ b/gi/enumeration.cpp
@@ -165,7 +165,7 @@ gjs_define_enumeration(JSContext *context,
enum_name = g_base_info_get_name( (GIBaseInfo*) info);
JS::RootedObject enum_obj(context, JS_NewPlainObject(context));
- if (enum_obj == NULL) {
+ if (!enum_obj) {
g_error("Could not create enumeration %s.%s",
g_base_info_get_namespace( (GIBaseInfo*) info),
enum_name);
diff --git a/gi/function.cpp b/gi/function.cpp
index 6ac04a9..9cb0866 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -1689,7 +1689,7 @@ function_new(JSContext *context,
JS::RootedObject function(context,
JS_NewObjectWithGivenProto(context, &gjs_function_class, proto));
- if (function == NULL) {
+ if (!function) {
gjs_debug(GJS_DEBUG_GFUNCTION, "Failed to construct function");
return NULL;
}
@@ -1726,7 +1726,7 @@ gjs_define_function(JSContext *context,
JSAutoRequest ar(context);
JS::RootedObject function(context, function_new(context, gtype, info));
- if (function == NULL)
+ if (!function)
return NULL;
if (info_type == GI_INFO_TYPE_FUNCTION) {
diff --git a/gi/fundamental.cpp b/gi/fundamental.cpp
index ca2a422..5f928ce 100644
--- a/gi/fundamental.cpp
+++ b/gi/fundamental.cpp
@@ -612,7 +612,7 @@ gjs_lookup_fundamental_prototype(JSContext *context,
constructor = &value.toObject();
}
- g_assert(constructor != NULL);
+ g_assert(constructor);
if (!gjs_object_get_property(context, constructor,
GJS_STRING_PROTOTYPE, &value))
@@ -772,7 +772,7 @@ gjs_object_from_g_fundamental(JSContext *context,
object = JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto);
- if (object == NULL)
+ if (!object)
goto out;
init_fundamental_instance(context, object);
@@ -814,7 +814,7 @@ gjs_g_fundamental_from_object(JSContext *context,
{
FundamentalInstance *priv;
- if (obj == NULL)
+ if (!obj)
return NULL;
priv = priv_from_js(context, obj);
diff --git a/gi/gerror.cpp b/gi/gerror.cpp
index 7a63e17..f3c0f97 100644
--- a/gi/gerror.cpp
+++ b/gi/gerror.cpp
@@ -470,7 +470,7 @@ gjs_gerror_from_error(JSContext *context,
{
Error *priv;
- if (obj == NULL)
+ if (!obj)
return NULL;
/* If this is a plain GBoxed (i.e. a GError without metadata),
diff --git a/gi/ns.cpp b/gi/ns.cpp
index 376cc20..455a961 100644
--- a/gi/ns.cpp
+++ b/gi/ns.cpp
@@ -190,7 +190,7 @@ ns_new(JSContext *context,
JS::RootedObject ns(context,
JS_NewObjectWithGivenProto(context, &gjs_ns_class, proto));
- if (ns == NULL)
+ if (!ns)
g_error("No memory to create ns object");
priv = g_slice_new0(Ns);
diff --git a/gi/object.cpp b/gi/object.cpp
index ab19dcd..059b6ec 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -1360,7 +1360,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
free_g_params(¶ms[0], params.size());
ObjectInstance *other_priv = get_object_qdata(gobj);
- if (other_priv && other_priv->keep_alive != object) {
+ if (other_priv && other_priv->keep_alive != object.get()) {
/* g_object_newv returned an object that's already tracked by a JS
* object. Let's assume this is a singleton like IBus.IBus and return
* the existing JS wrapper object.
@@ -1640,7 +1640,7 @@ gjs_lookup_object_constructor_from_info(JSContext *context,
constructor = &value.toObject();
}
- g_assert(constructor != NULL);
+ g_assert(constructor);
return constructor;
}
@@ -1653,7 +1653,7 @@ gjs_lookup_object_prototype_from_info(JSContext *context,
JS::RootedObject constructor(context,
gjs_lookup_object_constructor_from_info(context, info, gtype));
- if (G_UNLIKELY (constructor == NULL))
+ if (G_UNLIKELY(!constructor))
return NULL;
JS::RootedValue value(context);
@@ -2014,7 +2014,7 @@ gjs_define_object_class(JSContext *context,
const char *ns;
GType parent_type;
- g_assert(in_object != NULL);
+ g_assert(in_object);
g_assert(gtype != G_TYPE_INVALID);
/* http://egachine.berlios.de/embedding-sm-best-practice/apa.html
@@ -2131,7 +2131,7 @@ gjs_object_from_g_object(JSContext *context,
JS::RootedObject obj(context,
JS_NewObjectWithGivenProto(context, JS_GetClass(proto), proto));
- if (obj == NULL)
+ if (!obj)
return nullptr;
priv = init_object_private(context, obj);
@@ -2142,7 +2142,7 @@ gjs_object_from_g_object(JSContext *context,
/* see the comment in init_object_instance() for this */
g_object_unref(gobj);
- g_assert(priv->keep_alive == obj);
+ g_assert(priv->keep_alive == obj.get());
}
return priv->keep_alive;
@@ -2154,7 +2154,7 @@ gjs_g_object_from_object(JSContext *context,
{
ObjectInstance *priv;
- if (obj == NULL)
+ if (!obj)
return NULL;
priv = priv_from_js(context, obj);
@@ -2871,7 +2871,7 @@ gjs_register_interface(JSContext *cx,
/* create a custom JSClass */
JS::RootedObject module(cx, gjs_lookup_private_namespace(cx));
- if (module == NULL)
+ if (!module)
return false; /* error will have been thrown already */
JS::RootedObject constructor(cx);
diff --git a/gi/param.cpp b/gi/param.cpp
index 2806d2a..dbfde0b 100644
--- a/gi/param.cpp
+++ b/gi/param.cpp
@@ -189,7 +189,7 @@ gjs_lookup_param_prototype(JSContext *context)
return NULL;
JS::RootedObject constructor(context, &value.toObject());
- g_assert(constructor != NULL);
+ g_assert(constructor);
if (!gjs_object_get_property(context, constructor,
GJS_STRING_PROTOTYPE, &value))
@@ -280,7 +280,7 @@ gjs_g_param_from_param(JSContext *context,
{
Param *priv;
- if (obj == NULL)
+ if (!obj)
return NULL;
priv = priv_from_js(context, obj);
diff --git a/gi/repo.cpp b/gi/repo.cpp
index e13cf82..d893ce2 100644
--- a/gi/repo.cpp
+++ b/gi/repo.cpp
@@ -770,7 +770,7 @@ gjs_lookup_generic_prototype(JSContext *context,
{
JS::RootedObject constructor(context,
gjs_lookup_generic_constructor(context, info));
- if (G_UNLIKELY (constructor == NULL))
+ if (G_UNLIKELY(!constructor))
return NULL;
JS::RootedValue value(context);
diff --git a/gi/union.cpp b/gi/union.cpp
index dad723c..b3cbf4a 100644
--- a/gi/union.cpp
+++ b/gi/union.cpp
@@ -422,7 +422,7 @@ gjs_c_union_from_union(JSContext *context,
{
Union *priv;
- if (obj == NULL)
+ if (!obj)
return NULL;
priv = priv_from_js(context, obj);
diff --git a/gjs/byteArray.cpp b/gjs/byteArray.cpp
index 88b38e2..4c32e98 100644
--- a/gjs/byteArray.cpp
+++ b/gjs/byteArray.cpp
@@ -201,7 +201,7 @@ byte_array_get_prop(JSContext *context,
priv = priv_from_js(context, obj);
- if (priv == NULL)
+ if (!priv)
return true; /* prototype, not an instance. */
JS::RootedValue id_value(context);
@@ -231,7 +231,7 @@ byte_array_length_getter(JSContext *context,
GJS_GET_PRIV(context, argc, vp, args, to, ByteArrayInstance, priv);
gsize len = 0;
- if (priv == NULL)
+ if (!priv)
return true; /* prototype, not an instance. */
if (priv->array != NULL)
@@ -250,7 +250,7 @@ byte_array_length_setter(JSContext *context,
GJS_GET_PRIV(context, argc, vp, args, to, ByteArrayInstance, priv);
gsize len = 0;
- if (priv == NULL)
+ if (!priv)
return true; /* prototype, not instance */
byte_array_ensure_array(priv);
@@ -309,7 +309,7 @@ byte_array_set_prop(JSContext *context,
priv = priv_from_js(context, obj);
- if (priv == NULL)
+ if (!priv)
return result.succeed(); /* prototype, not an instance. */
JS::RootedValue id_value(context);
@@ -388,7 +388,7 @@ byte_array_finalize(JSFreeOp *fop,
priv = (ByteArrayInstance*) JS_GetPrivate(obj);
- if (priv == NULL)
+ if (!priv)
return; /* prototype, not instance */
if (priv->array) {
@@ -412,7 +412,7 @@ to_string_func(JSContext *context,
bool encoding_is_utf8;
gchar *data;
- if (priv == NULL)
+ if (!priv)
return true; /* prototype, not instance */
byte_array_ensure_array(priv);
@@ -492,7 +492,7 @@ to_gbytes_func(JSContext *context,
JSObject *ret_bytes_obj;
GIBaseInfo *gbytes_info;
- if (priv == NULL)
+ if (!priv)
return true; /* prototype, not instance */
byte_array_ensure_gbytes(priv);
@@ -534,7 +534,7 @@ from_string_func(JSContext *context,
bool encoding_is_utf8;
JS::RootedObject obj(context, byte_array_new(context));
- if (obj == NULL)
+ if (!obj)
return false;
priv = priv_from_js(context, obj);
@@ -643,7 +643,7 @@ from_array_func(JSContext *context,
bool is_array;
JS::RootedObject obj(context, byte_array_new(context));
- if (obj == NULL)
+ if (!obj)
return false;
priv = priv_from_js(context, obj);
@@ -715,7 +715,7 @@ from_gbytes_func(JSContext *context,
gbytes = (GBytes*) gjs_c_struct_from_boxed(context, bytes_obj);
JS::RootedObject obj(context, byte_array_new(context));
- if (obj == NULL)
+ if (!obj)
return false;
priv = priv_from_js(context, obj);
g_assert (priv != NULL);
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index 2c74359..5e3f073 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -1341,11 +1341,11 @@ coverage_log(JSContext *context,
* could not be converted to string */
exc_state = JS_SaveExceptionState(context);
JS::RootedString jstr(context, JS::ToString(context, argv[0]));
- if (jstr != NULL)
+ if (jstr)
argv[0].setString(jstr); // GC root
JS_RestoreExceptionState(context, exc_state);
- if (jstr == NULL) {
+ if (!jstr) {
g_message("JS LOG: <cannot convert value to string>");
return true;
}
@@ -1392,7 +1392,7 @@ coverage_get_file_modification_time(JSContext *context,
mtime_values_array[1].setInt32(mtime.tv_usec);
JS::RootedObject array_obj(context,
JS_NewArrayObject(context, mtime_values_array));
- if (array_obj == NULL)
+ if (!array_obj)
goto out;
args.rval().setObject(*array_obj);
} else {
diff --git a/gjs/global.cpp b/gjs/global.cpp
index 16dd5bd..0a65a48 100644
--- a/gjs/global.cpp
+++ b/gjs/global.cpp
@@ -51,7 +51,7 @@ gjs_log(JSContext *cx,
JS::RootedString jstr(cx, JS::ToString(cx, argv[0]));
exc_state.restore();
- if (jstr == NULL) {
+ if (!jstr) {
g_message("JS LOG: <cannot convert value to string>");
return true;
}
@@ -114,7 +114,7 @@ gjs_print_parse_args(JSContext *cx,
JS::RootedString jstr(cx, JS::ToString(cx, argv[n]));
exc_state.restore();
- if (jstr != NULL) {
+ if (jstr) {
GjsAutoJSChar s(cx);
if (!gjs_string_to_utf8(cx, JS::StringValue(jstr), &s)) {
g_string_free(str, true);
diff --git a/gjs/importer.cpp b/gjs/importer.cpp
index 1de23d4..458e23a 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -195,7 +195,7 @@ import_directory(JSContext *context,
* this always succeeds.
*/
importer = gjs_define_importer(context, obj, name, full_paths, false);
- return importer != NULL;
+ return importer != nullptr;
}
/* Make the property we set in gjs_module_import() permanent;
@@ -209,8 +209,7 @@ seal_import(JSContext *cx,
{
JS::Rooted<JS::PropertyDescriptor> descr(cx);
- if (!JS_GetOwnPropertyDescriptorById(cx, obj, id, &descr) ||
- descr.object() == NULL) {
+ if (!JS_GetOwnPropertyDescriptorById(cx, obj, id, &descr) || !descr.object()) {
gjs_debug(GJS_DEBUG_IMPORTER,
"Failed to get attributes to seal '%s' in importer",
name);
@@ -370,7 +369,7 @@ load_module_elements(JSContext *cx,
size_t ix, length;
JS::RootedObject module_obj(cx, load_module_init(cx, in_object, init_path));
- if (module_obj == NULL)
+ if (!module_obj)
return;
JS::Rooted<JS::IdVector> ids(cx, cx);
@@ -774,7 +773,7 @@ importer_resolve(JSContext *context,
gjs_debug_jsprop(GJS_DEBUG_IMPORTER,
"Resolve prop '%s' hook obj %p priv %p",
name.get(), obj.get(), priv);
- if (priv == NULL) {
+ if (!priv) {
/* we are the prototype, or have the wrong class */
*resolved = false;
return true;
@@ -799,7 +798,7 @@ importer_finalize(js::FreeOp *fop,
priv = (Importer*) JS_GetPrivate(obj);
gjs_debug_lifecycle(GJS_DEBUG_IMPORTER,
"finalize, obj %p priv %p", obj, priv);
- if (priv == NULL)
+ if (!priv)
return; /* we are the prototype, not a real instance */
GJS_DEC_COUNTER(importer);
@@ -866,7 +865,7 @@ importer_new(JSContext *context,
JS::RootedObject importer(context,
JS_NewObjectWithGivenProto(context, &gjs_importer_class, proto));
- if (importer == NULL)
+ if (!importer)
g_error("No memory to create importer");
priv = g_slice_new0(Importer);
diff --git a/gjs/jsapi-class.h b/gjs/jsapi-class.h
index 508c828..c3c8fa9 100644
--- a/gjs/jsapi-class.h
+++ b/gjs/jsapi-class.h
@@ -68,7 +68,7 @@ JSObject *gjs_construct_object_dynamic(JSContext *cx,
* priv_from_js_with_typecheck: a convenience function to call
* do_base_typecheck and priv_from_js
*/
-#define GJS_DEFINE_PRIV_FROM_JS(type, klass) \
+#define GJS_DEFINE_PRIV_FROM_JS(type, klass) \
GJS_ALWAYS_INLINE G_GNUC_UNUSED \
static inline bool \
do_base_typecheck(JSContext *context, \
@@ -307,7 +307,7 @@ gjs_##name##_constructor(JSContext *context, \
return false; \
} \
object = JS_NewObjectForConstructor(context, &gjs_##name##_class, argv); \
- if (object == NULL) \
+ if (!object) \
return false; \
}
diff --git a/gjs/jsapi-util-error.cpp b/gjs/jsapi-util-error.cpp
index 1196bd0..0af708d 100644
--- a/gjs/jsapi-util-error.cpp
+++ b/gjs/jsapi-util-error.cpp
@@ -97,7 +97,7 @@ gjs_throw_valist(JSContext *context,
constructor = &v_constructor.toObject();
new_exc = JS_New(context, constructor, error_args);
- if (new_exc == NULL)
+ if (!new_exc)
goto out;
if (error_name != NULL) {
diff --git a/gjs/jsapi-util-string.cpp b/gjs/jsapi-util-string.cpp
index 53f32f5..41929b5 100644
--- a/gjs/jsapi-util-string.cpp
+++ b/gjs/jsapi-util-string.cpp
@@ -87,7 +87,7 @@ gjs_string_from_utf8(JSContext *context,
value_p.setString(str);
JS_EndRequest(context);
- return str != NULL;
+ return str != nullptr;
}
bool
@@ -313,7 +313,7 @@ gjs_string_from_ucs4(JSContext *cx,
/* Avoid a copy - assumes that g_malloc == js_malloc == malloc */
JS::RootedString str(cx, JS_NewUCString(cx, u16_string, u16_string_length));
- if (str == NULL) {
+ if (!str) {
gjs_throw(cx, "Failed to convert UCS-4 string to UTF-16");
return false;
}
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 48f71f4..8627cb7 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -311,11 +311,11 @@ gjs_define_string_array(JSContext *context,
JS::RootedObject array(context,
gjs_build_string_array(context, array_length, (char **) array_values));
- if (array == NULL)
- return NULL;
+ if (!array)
+ return nullptr;
if (!JS_DefineProperty(context, in_object, array_name, array, attrs))
- return NULL;
+ return nullptr;
return array;
}
@@ -374,7 +374,7 @@ _gjs_g_utf8_make_valid (const char *name)
g_return_val_if_fail (name != NULL, NULL);
- string = NULL;
+ string = nullptr;
remainder = name;
remaining_bytes = strlen (name);
@@ -383,7 +383,7 @@ _gjs_g_utf8_make_valid (const char *name)
break;
valid_bytes = invalid - remainder;
- if (string == NULL)
+ if (!string)
string = g_string_sized_new (remaining_bytes);
g_string_append_len (string, remainder, valid_bytes);
@@ -394,7 +394,7 @@ _gjs_g_utf8_make_valid (const char *name)
remainder = invalid + 1;
}
- if (string == NULL)
+ if (!string)
return g_strdup (name);
g_string_append (string, remainder);
@@ -427,7 +427,7 @@ gjs_value_debug_string(JSContext *context,
JS::RootedString str(context, JS::ToString(context, value));
- if (str == NULL) {
+ if (!str) {
if (value.isObject()) {
/* Specifically the Call object (see jsfun.c in spidermonkey)
* does not have a toString; there may be others also.
@@ -436,7 +436,7 @@ gjs_value_debug_string(JSContext *context,
if (klass != NULL) {
str = JS_NewStringCopyZ(context, klass->name);
JS_ClearPendingException(context);
- if (str == NULL) {
+ if (!str) {
JS_EndRequest(context);
return g_strdup("[out of memory copying class name]");
}
@@ -451,7 +451,7 @@ gjs_value_debug_string(JSContext *context,
}
}
- g_assert(str != NULL);
+ g_assert(str);
bytes = JS_EncodeStringToUTF8(context, str);
JS_EndRequest(context);
@@ -468,7 +468,7 @@ utf8_exception_from_non_gerror_value(JSContext *cx,
{
GjsAutoJSChar utf8_exception(cx);
JS::RootedString exc_str(cx, JS::ToString(cx, exc));
- if (exc_str != NULL)
+ if (exc_str)
gjs_string_to_utf8(cx, JS::StringValue(exc_str), &utf8_exception);
return utf8_exception.copy();
}
@@ -511,7 +511,7 @@ gjs_log_exception_full(JSContext *context,
}
}
- if (message != NULL)
+ if (message)
gjs_string_to_utf8(context, JS::StringValue(message), &utf8_message);
/* We log syntax errors differently, because the stack for those includes
@@ -536,7 +536,7 @@ gjs_log_exception_full(JSContext *context,
lineNumber = js_lineNumber.toInt32();
- if (message != NULL) {
+ if (message) {
g_critical("JS ERROR: %s: %s @ %s:%u", utf8_message.get(), utf8_exception,
utf8_filename.get(), lineNumber);
} else {
@@ -557,7 +557,7 @@ gjs_log_exception_full(JSContext *context,
have_utf8_stack = true;
}
- if (message != nullptr) {
+ if (message) {
if (have_utf8_stack)
g_warning("JS ERROR: %s: %s\n%s", utf8_message.get(), utf8_exception, utf8_stack.get());
else
diff --git a/modules/cairo-pattern.cpp b/modules/cairo-pattern.cpp
index f82fbb9..d22fb64 100644
--- a/modules/cairo-pattern.cpp
+++ b/modules/cairo-pattern.cpp
@@ -114,7 +114,7 @@ gjs_cairo_pattern_construct(JSContext *context,
GjsCairoPattern *priv;
g_return_if_fail(context != NULL);
- g_return_if_fail(object != NULL);
+ g_return_if_fail(object != nullptr);
g_return_if_fail(pattern != NULL);
priv = g_slice_new0(GjsCairoPattern);
diff --git a/modules/cairo-surface.cpp b/modules/cairo-surface.cpp
index af783f9..8f0e50a 100644
--- a/modules/cairo-surface.cpp
+++ b/modules/cairo-surface.cpp
@@ -150,7 +150,7 @@ gjs_cairo_surface_construct(JSContext *context,
GjsCairoSurface *priv;
g_return_if_fail(context != NULL);
- g_return_if_fail(object != NULL);
+ g_return_if_fail(object != nullptr);
g_return_if_fail(surface != NULL);
priv = g_slice_new0(GjsCairoSurface);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]