[gjs/wip/ptomato/mozjs31prep: 8/15] js: Prefer bool to gboolean
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/mozjs31prep: 8/15] js: Prefer bool to gboolean
- Date: Mon, 19 Sep 2016 04:15:43 +0000 (UTC)
commit 5aeae2d3bc0c22cac89284b0a67dc39e9eb56467
Author: Philip Chimento <philip chimento gmail com>
Date: Mon Sep 5 15:09:07 2016 -0700
js: Prefer bool to gboolean
Since we removed JSBool, JS_TRUE, and JS_FALSE in the previous commit, we
now also make usage of gboolean, TRUE, and FALSE consistent. In some
places, JSBool and gboolean were used interchangeably. Here, we take the
approach of using C++ bool, true, and false everywhere, except when
required by the API, e.g. for the return type of idle functions.
In a few instances, TRUE and FALSE were used in comments in JS code; here
we change those to true and false to avoid confusion.
Fixes a few formatting glitches in lines of code that were touched
anyway.
https://bugzilla.gnome.org/show_bug.cgi?id=742249
examples/gtk.js | 8 +-
gi/arg.cpp | 294 +++++++++++++++++-----------------
gi/arg.h | 4 +-
gi/boxed.cpp | 52 +++---
gi/closure.cpp | 12 +-
gi/closure.h | 4 +-
gi/enumeration.cpp | 2 +-
gi/foreign.cpp | 8 +-
gi/foreign.h | 4 +-
gi/function.cpp | 104 ++++++------
gi/function.h | 4 +-
gi/fundamental.cpp | 6 +-
gi/gerror.cpp | 6 +-
gi/gerror.h | 2 +-
gi/gtype.cpp | 2 +-
gi/keep-alive.cpp | 12 +-
gi/keep-alive.h | 8 +-
gi/ns.cpp | 4 +-
gi/object.cpp | 108 ++++++------
gi/proxyutils.cpp | 2 +-
gi/repo.cpp | 22 ++--
gi/repo.h | 2 +-
gi/value.cpp | 42 +++---
gjs/byteArray.cpp | 24 ++--
gjs/console.cpp | 10 +-
gjs/context-private.h | 2 +-
gjs/context.cpp | 44 +++---
gjs/context.h | 6 +-
gjs/coverage-internal.h | 20 ++--
gjs/coverage.cpp | 148 +++++++++---------
gjs/importer.cpp | 31 ++--
gjs/importer.h | 4 +-
gjs/jsapi-util-array.cpp | 8 +-
gjs/jsapi-util-error.cpp | 2 +-
gjs/jsapi-util-string.cpp | 14 +-
gjs/jsapi-util.cpp | 42 +++---
gjs/jsapi-util.h | 10 +-
gjs/mem.cpp | 2 +-
gjs/mem.h | 2 +-
gjs/native.cpp | 4 +-
gjs/native.h | 2 +-
gjs/runtime.cpp | 2 +-
gjs/type-module.cpp | 2 +-
installed-tests/gjs-unit.cpp | 10 +-
libgjs-private/gjs-gdbus-wrapper.cpp | 4 +-
modules/cairo-context.cpp | 6 +-
modules/cairo-region.cpp | 2 +-
modules/cairo-surface.cpp | 2 +-
modules/console.cpp | 4 +-
test/gjs-test-coverage.cpp | 105 ++++++-------
test/gjs-tests.cpp | 2 +-
util/crash.cpp | 2 +-
util/glib.cpp | 20 ++--
util/glib.h | 4 +-
util/log.cpp | 24 ++--
util/misc.cpp | 8 +-
util/misc.h | 2 +-
57 files changed, 637 insertions(+), 649 deletions(-)
---
diff --git a/examples/gtk.js b/examples/gtk.js
index 638a147..5a2195d 100644
--- a/examples/gtk.js
+++ b/examples/gtk.js
@@ -7,14 +7,14 @@ function hello(widget) {
}
function onDeleteEvent(widget, event) {
- // If you return FALSE in the "delete_event" signal handler,
- // GTK will emit the "destroy" signal. Returning TRUE means
+ // If you return false in the "delete_event" signal handler,
+ // GTK will emit the "destroy" signal. Returning true means
// you don't want the window to be destroyed.
// This is useful for popping up 'are you sure you want to quit?'
// type dialogs.
log("delete event occurred");
- // Change FALSE to TRUE and the main window will not be destroyed
+ // Change false to true and the main window will not be destroyed
// with a "delete_event".
return false;
}
@@ -37,7 +37,7 @@ win.connect("delete-event", onDeleteEvent);
// Here we connect the "destroy" event to a signal handler.
// This event occurs when we call gtk_widget_destroy() on the window,
-// or if we return FALSE in the "onDeleteEvent" callback.
+// or if we return false in the "onDeleteEvent" callback.
win.connect("destroy", onDestroy);
// Sets the border width of the window.
diff --git a/gi/arg.cpp b/gi/arg.cpp
index 32158de..78feef2 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -115,7 +115,7 @@ _gjs_enum_value_is_valid(JSContext *context,
return found;
}
-static gboolean
+static bool
_gjs_enum_uses_signed_type (GIEnumInfo *enum_info)
{
switch (g_enum_info_get_storage_type (enum_info)) {
@@ -123,9 +123,9 @@ _gjs_enum_uses_signed_type (GIEnumInfo *enum_info)
case GI_TYPE_TAG_INT16:
case GI_TYPE_TAG_INT32:
case GI_TYPE_TAG_INT64:
- return TRUE;
+ return true;
default:
- return FALSE;
+ return false;
}
}
@@ -157,7 +157,7 @@ _gjs_enum_to_int (GIEnumInfo *enum_info,
/* Check if an argument of the given needs to be released if we created it
* from a JS value to pass it into a function and aren't transfering ownership.
*/
-static gboolean
+static bool
type_needs_release (GITypeInfo *type_info,
GITypeTag type_tag)
{
@@ -169,12 +169,12 @@ type_needs_release (GITypeInfo *type_info,
case GI_TYPE_TAG_GSLIST:
case GI_TYPE_TAG_GHASH:
case GI_TYPE_TAG_ERROR:
- return TRUE;
+ return true;
case GI_TYPE_TAG_INTERFACE: {
GIBaseInfo* interface_info;
GIInfoType interface_type;
GType gtype;
- gboolean needs_release;
+ bool needs_release;
interface_info = g_type_info_get_interface(type_info);
g_assert(interface_info != NULL);
@@ -208,18 +208,18 @@ type_needs_release (GITypeInfo *type_info,
}
if (g_type_is_a(gtype, G_TYPE_CLOSURE))
- needs_release = TRUE;
+ needs_release = true;
else if (g_type_is_a(gtype, G_TYPE_VALUE))
needs_release = g_type_info_is_pointer(type_info);
else
- needs_release = FALSE;
+ needs_release = false;
g_base_info_unref(interface_info);
return needs_release;
}
default:
- return FALSE;
+ return false;
}
}
@@ -238,11 +238,11 @@ type_needs_out_release(GITypeInfo *type_info,
case GI_TYPE_TAG_GSLIST:
case GI_TYPE_TAG_GHASH:
case GI_TYPE_TAG_ERROR:
- return TRUE;
+ return true;
case GI_TYPE_TAG_INTERFACE: {
GIBaseInfo* interface_info;
GIInfoType interface_type;
- gboolean needs_release;
+ bool needs_release;
interface_info = g_type_info_get_interface(type_info);
g_assert(interface_info != NULL);
@@ -252,7 +252,7 @@ type_needs_out_release(GITypeInfo *type_info,
switch(interface_type) {
case GI_INFO_TYPE_ENUM:
case GI_INFO_TYPE_FLAGS:
- needs_release = FALSE;
+ needs_release = false;
break;
case GI_INFO_TYPE_STRUCT:
@@ -261,7 +261,7 @@ type_needs_out_release(GITypeInfo *type_info,
break;
default:
- needs_release = TRUE;
+ needs_release = true;
}
g_base_info_unref(interface_info);
@@ -269,7 +269,7 @@ type_needs_out_release(GITypeInfo *type_info,
return needs_release;
}
default:
- return FALSE;
+ return false;
}
}
@@ -327,7 +327,7 @@ gjs_array_to_g_list(JSContext *context,
NULL,
GJS_ARGUMENT_LIST_ELEMENT,
transfer,
- FALSE,
+ false,
&elem_arg)) {
return false;
}
@@ -405,7 +405,7 @@ gjs_object_to_g_hash(JSContext *context,
if (!gjs_value_to_g_argument(context, key_js, key_param_info, NULL,
GJS_ARGUMENT_HASH_ELEMENT,
transfer,
- FALSE /* don't allow null */,
+ false /* don't allow null */,
&key_arg))
goto free_hash_and_fail;
@@ -416,7 +416,7 @@ gjs_object_to_g_hash(JSContext *context,
if (!gjs_value_to_g_argument(context, val_js, val_param_info, NULL,
GJS_ARGUMENT_HASH_ELEMENT,
transfer,
- TRUE /* allow null */,
+ true /* allow null */,
&val_arg))
goto free_hash_and_fail;
@@ -556,8 +556,8 @@ gjs_array_to_intarray(JSContext *context,
jsval array_value,
unsigned int length,
void **arr_p,
- unsigned intsize,
- gboolean is_signed)
+ unsigned intsize,
+ bool is_signed)
{
/* nasty union types in an attempt to unify the various int types */
union { guint32 u; gint32 i; } intval;
@@ -659,7 +659,7 @@ gjs_array_to_floatarray(JSContext *context,
jsval array_value,
unsigned int length,
void **arr_p,
- gboolean is_double)
+ bool is_double)
{
unsigned int i;
void *result;
@@ -744,7 +744,7 @@ gjs_array_to_ptrarray(JSContext *context,
NULL, /* arg name */
GJS_ARGUMENT_ARRAY_ELEMENT,
transfer,
- FALSE, /* absent better information, FALSE for now */
+ false, /* absent better information, false for now */
&arg);
if (!success) {
@@ -823,15 +823,15 @@ gjs_array_from_flat_gvalue_array(JSContext *context,
return result;
}
-static gboolean
+static bool
is_gvalue(GIBaseInfo *info,
GIInfoType info_type)
{
- gboolean result = FALSE;
+ bool result = false;
switch(info_type) {
case GI_INFO_TYPE_VALUE:
- result = TRUE;
+ result = true;
break;
case GI_INFO_TYPE_STRUCT:
case GI_INFO_TYPE_OBJECT:
@@ -851,16 +851,16 @@ is_gvalue(GIBaseInfo *info,
return result;
}
-static gboolean
+static bool
is_gvalue_flat_array(GITypeInfo *param_info,
GITypeTag element_type)
{
GIBaseInfo *interface_info;
GIInfoType info_type;
- gboolean result;
+ bool result;
if (element_type != GI_TYPE_TAG_INTERFACE)
- return FALSE;
+ return false;
interface_info = g_type_info_get_interface(param_info);
info_type = g_base_info_get_type(interface_info);
@@ -881,7 +881,7 @@ gjs_array_to_array(JSContext *context,
GITypeInfo *param_info,
void **arr_p)
{
- enum { UNSIGNED=FALSE, SIGNED=TRUE };
+ enum { UNSIGNED=false, SIGNED=true };
GITypeTag element_type;
element_type = g_type_info_get_tag(param_info);
@@ -921,10 +921,10 @@ gjs_array_to_array(JSContext *context,
(context, array_value, length, arr_p, 4, SIGNED);
case GI_TYPE_TAG_FLOAT:
return gjs_array_to_floatarray
- (context, array_value, length, arr_p, FALSE);
+ (context, array_value, length, arr_p, false);
case GI_TYPE_TAG_DOUBLE:
return gjs_array_to_floatarray
- (context, array_value, length, arr_p, TRUE);
+ (context, array_value, length, arr_p, true);
case GI_TYPE_TAG_GTYPE:
return gjs_gtypearray_to_array
(context, array_value, length, arr_p);
@@ -1013,7 +1013,7 @@ gjs_g_array_new_for_type(JSContext *context,
return NULL;
}
- return g_array_sized_new(TRUE, FALSE, element_size, length);
+ return g_array_sized_new(true, false, element_size, length);
}
static gchar *
@@ -1082,7 +1082,7 @@ gjs_array_to_explicit_array_internal(JSContext *context,
const char *arg_name,
GjsArgumentType arg_type,
GITransfer transfer,
- gboolean may_be_null,
+ bool may_be_null,
gpointer *contents,
gsize *length_p)
{
@@ -1150,14 +1150,14 @@ gjs_value_to_g_argument(JSContext *context,
const char *arg_name,
GjsArgumentType arg_type,
GITransfer transfer,
- gboolean may_be_null,
+ bool may_be_null,
GArgument *arg)
{
GITypeTag type_tag;
- gboolean wrong;
- gboolean out_of_range;
- gboolean report_type_mismatch;
- gboolean nullable_type;
+ bool wrong;
+ bool out_of_range;
+ bool report_type_mismatch;
+ bool nullable_type;
type_tag = g_type_info_get_tag( (GITypeInfo*) type_info);
@@ -1165,41 +1165,41 @@ gjs_value_to_g_argument(JSContext *context,
"Converting jsval to GArgument %s",
g_type_tag_to_string(type_tag));
- nullable_type = FALSE;
- wrong = FALSE; /* return false */
- out_of_range = FALSE;
- report_type_mismatch = FALSE; /* wrong=TRUE, and still need to gjs_throw a type problem */
+ nullable_type = false;
+ wrong = false; /* return false */
+ out_of_range = false;
+ report_type_mismatch = false; /* wrong=true, and still need to gjs_throw a type problem */
switch (type_tag) {
case GI_TYPE_TAG_VOID:
- nullable_type = TRUE;
+ nullable_type = true;
arg->v_pointer = NULL; /* just so it isn't uninitialized */
break;
case GI_TYPE_TAG_INT8: {
gint32 i;
if (!JS_ValueToInt32(context, value, &i))
- wrong = TRUE;
+ wrong = true;
if (i > G_MAXINT8 || i < G_MININT8)
- out_of_range = TRUE;
+ out_of_range = true;
arg->v_int8 = (gint8)i;
break;
}
case GI_TYPE_TAG_UINT8: {
guint32 i;
if (!JS_ValueToECMAUint32(context, value, &i))
- wrong = TRUE;
+ wrong = true;
if (i > G_MAXUINT8)
- out_of_range = TRUE;
+ out_of_range = true;
arg->v_uint8 = (guint8)i;
break;
}
case GI_TYPE_TAG_INT16: {
gint32 i;
if (!JS_ValueToInt32(context, value, &i))
- wrong = TRUE;
+ wrong = true;
if (i > G_MAXINT16 || i < G_MININT16)
- out_of_range = TRUE;
+ out_of_range = true;
arg->v_int16 = (gint16)i;
break;
}
@@ -1207,24 +1207,24 @@ gjs_value_to_g_argument(JSContext *context,
case GI_TYPE_TAG_UINT16: {
guint32 i;
if (!JS_ValueToECMAUint32(context, value, &i))
- wrong = TRUE;
+ wrong = true;
if (i > G_MAXUINT16)
- out_of_range = TRUE;
+ out_of_range = true;
arg->v_uint16 = (guint16)i;
break;
}
case GI_TYPE_TAG_INT32:
if (!JS_ValueToInt32(context, value, &arg->v_int))
- wrong = TRUE;
+ wrong = true;
break;
case GI_TYPE_TAG_UINT32: {
gdouble i;
if (!JS_ValueToNumber(context, value, &i))
- wrong = TRUE;
+ wrong = true;
if (i > G_MAXUINT32 || i < 0)
- out_of_range = TRUE;
+ out_of_range = true;
arg->v_uint32 = (guint32)i;
break;
}
@@ -1232,9 +1232,9 @@ gjs_value_to_g_argument(JSContext *context,
case GI_TYPE_TAG_INT64: {
double v;
if (!JS_ValueToNumber(context, value, &v))
- wrong = TRUE;
+ wrong = true;
if (v > G_MAXINT64 || v < G_MININT64)
- out_of_range = TRUE;
+ out_of_range = true;
arg->v_int64 = v;
}
break;
@@ -1242,9 +1242,9 @@ gjs_value_to_g_argument(JSContext *context,
case GI_TYPE_TAG_UINT64: {
double v;
if (!JS_ValueToNumber(context, value, &v))
- wrong = TRUE;
+ wrong = true;
if (v < 0)
- out_of_range = TRUE;
+ out_of_range = true;
/* XXX we fail with values close to G_MAXUINT64 */
arg->v_uint64 = v;
}
@@ -1252,31 +1252,31 @@ gjs_value_to_g_argument(JSContext *context,
case GI_TYPE_TAG_BOOLEAN:
if (!JS_ValueToBoolean(context, value, &arg->v_boolean))
- wrong = TRUE;
+ wrong = true;
break;
case GI_TYPE_TAG_FLOAT: {
double v;
if (!JS_ValueToNumber(context, value, &v))
- wrong = TRUE;
+ wrong = true;
if (v > G_MAXFLOAT || v < - G_MAXFLOAT)
- out_of_range = TRUE;
+ out_of_range = true;
arg->v_float = (gfloat)v;
}
break;
case GI_TYPE_TAG_DOUBLE:
if (!JS_ValueToNumber(context, value, &arg->v_double))
- wrong = TRUE;
+ wrong = true;
break;
case GI_TYPE_TAG_UNICHAR:
if (JSVAL_IS_STRING(value)) {
if (!gjs_unichar_from_string(context, value, &arg->v_uint32))
- wrong = TRUE;
+ wrong = true;
} else {
- wrong = TRUE;
- report_type_mismatch = TRUE;
+ wrong = true;
+ report_type_mismatch = true;
}
break;
@@ -1285,16 +1285,16 @@ gjs_value_to_g_argument(JSContext *context,
GType gtype;
gtype = gjs_gtype_get_actual_gtype(context, JSVAL_TO_OBJECT(value));
if (gtype == G_TYPE_INVALID)
- wrong = TRUE;
+ wrong = true;
arg->v_ssize = gtype;
} else {
- wrong = TRUE;
- report_type_mismatch = TRUE;
+ wrong = true;
+ report_type_mismatch = true;
}
break;
case GI_TYPE_TAG_FILENAME:
- nullable_type = TRUE;
+ nullable_type = true;
if (JSVAL_IS_NULL(value)) {
arg->v_pointer = NULL;
} else if (JSVAL_IS_STRING(value)) {
@@ -1303,14 +1303,14 @@ gjs_value_to_g_argument(JSContext *context,
// doing this as a separate step to avoid type-punning
arg->v_pointer = filename_str;
else
- wrong = TRUE;
+ wrong = true;
} else {
- wrong = TRUE;
- report_type_mismatch = TRUE;
+ wrong = true;
+ report_type_mismatch = true;
}
break;
case GI_TYPE_TAG_UTF8:
- nullable_type = TRUE;
+ nullable_type = true;
if (JSVAL_IS_NULL(value)) {
arg->v_pointer = NULL;
} else if (JSVAL_IS_STRING(value)) {
@@ -1319,15 +1319,15 @@ gjs_value_to_g_argument(JSContext *context,
// doing this as a separate step to avoid type-punning
arg->v_pointer = utf8_str;
else
- wrong = TRUE;
+ wrong = true;
} else {
- wrong = TRUE;
- report_type_mismatch = TRUE;
+ wrong = true;
+ report_type_mismatch = true;
}
break;
case GI_TYPE_TAG_ERROR:
- nullable_type = TRUE;
+ nullable_type = true;
if (JSVAL_IS_NULL(value)) {
arg->v_pointer = NULL;
} else if (JSVAL_IS_OBJECT(value)) {
@@ -1338,11 +1338,11 @@ gjs_value_to_g_argument(JSContext *context,
if (transfer != GI_TRANSFER_NOTHING)
arg->v_pointer = g_error_copy ((const GError *) arg->v_pointer);
} else {
- wrong = TRUE;
+ wrong = true;
}
} else {
- wrong = TRUE;
- report_type_mismatch = TRUE;
+ wrong = true;
+ report_type_mismatch = true;
}
break;
@@ -1351,7 +1351,7 @@ gjs_value_to_g_argument(JSContext *context,
GIBaseInfo* interface_info;
GIInfoType interface_type;
GType gtype;
- gboolean expect_object;
+ bool expect_object;
interface_info = g_type_info_get_interface(type_info);
g_assert(interface_info != NULL);
@@ -1360,11 +1360,11 @@ gjs_value_to_g_argument(JSContext *context,
if (interface_type == GI_INFO_TYPE_ENUM ||
interface_type == GI_INFO_TYPE_FLAGS) {
- nullable_type = FALSE;
- expect_object = FALSE;
+ nullable_type = false;
+ expect_object = false;
} else {
- nullable_type = TRUE;
- expect_object = TRUE;
+ nullable_type = true;
+ expect_object = true;
}
switch(interface_type) {
@@ -1412,12 +1412,12 @@ gjs_value_to_g_argument(JSContext *context,
g_value_unset (&gvalue);
} else {
arg->v_pointer = NULL;
- wrong = TRUE;
+ wrong = true;
}
} else if (expect_object != JSVAL_IS_OBJECT(value)) {
/* JSVAL_IS_OBJECT handles null too */
- wrong = TRUE;
- report_type_mismatch = TRUE;
+ wrong = true;
+ report_type_mismatch = true;
break;
} else if (JSVAL_IS_NULL(value)) {
arg->v_pointer = NULL;
@@ -1430,8 +1430,8 @@ gjs_value_to_g_argument(JSContext *context,
actual_gtype = gjs_gtype_get_actual_gtype(context, JSVAL_TO_OBJECT(value));
if (actual_gtype == G_TYPE_NONE) {
- wrong = TRUE;
- report_type_mismatch = TRUE;
+ wrong = true;
+ report_type_mismatch = true;
break;
}
@@ -1454,12 +1454,12 @@ gjs_value_to_g_argument(JSContext *context,
JSObject *obj = JSVAL_TO_OBJECT(value);
if (g_type_is_a(gtype, G_TYPE_BYTES)
- && gjs_typecheck_bytearray(context, obj, FALSE)) {
+ && gjs_typecheck_bytearray(context, obj, false)) {
arg->v_pointer = gjs_byte_array_get_bytes(context, obj);
} else if (g_type_is_a(gtype, G_TYPE_ERROR)) {
if (!gjs_typecheck_gerror(context, JSVAL_TO_OBJECT(value), true)) {
arg->v_pointer = NULL;
- wrong = TRUE;
+ wrong = true;
} else {
arg->v_pointer = gjs_gerror_from_error(context,
JSVAL_TO_OBJECT(value));
@@ -1468,7 +1468,7 @@ gjs_value_to_g_argument(JSContext *context,
if (!gjs_typecheck_boxed(context, JSVAL_TO_OBJECT(value),
interface_info, gtype, true)) {
arg->v_pointer = NULL;
- wrong = TRUE;
+ wrong = true;
} else {
arg->v_pointer = gjs_c_struct_from_boxed(context,
JSVAL_TO_OBJECT(value));
@@ -1484,7 +1484,7 @@ gjs_value_to_g_argument(JSContext *context,
gjs_throw(context,
"Can't transfer ownership of a structure type not registered as
boxed");
arg->v_pointer = NULL;
- wrong = TRUE;
+ wrong = true;
}
}
@@ -1502,12 +1502,12 @@ gjs_value_to_g_argument(JSContext *context,
"Can't transfer ownership of a union type not registered as
boxed");
arg->v_pointer = NULL;
- wrong = TRUE;
+ wrong = true;
}
}
} else {
arg->v_pointer = NULL;
- wrong = TRUE;
+ wrong = true;
}
} else if (gtype != G_TYPE_NONE) {
@@ -1520,7 +1520,7 @@ gjs_value_to_g_argument(JSContext *context,
g_object_ref(G_OBJECT(arg->v_pointer));
} else {
arg->v_pointer = NULL;
- wrong = TRUE;
+ wrong = true;
}
} else if (g_type_is_a(gtype, G_TYPE_PARAM)) {
if (gjs_typecheck_param(context, JSVAL_TO_OBJECT(value), gtype, true)) {
@@ -1529,7 +1529,7 @@ gjs_value_to_g_argument(JSContext *context,
g_param_spec_ref(G_PARAM_SPEC(arg->v_pointer));
} else {
arg->v_pointer = NULL;
- wrong = TRUE;
+ wrong = true;
}
} else if (g_type_is_a(gtype, G_TYPE_BOXED)) {
if (g_type_is_a(gtype, G_TYPE_CLOSURE)) {
@@ -1554,7 +1554,7 @@ gjs_value_to_g_argument(JSContext *context,
gjs_fundamental_ref(context, arg->v_pointer);
} else {
arg->v_pointer = NULL;
- wrong = TRUE;
+ wrong = true;
}
} else if (G_TYPE_IS_INTERFACE(gtype)) {
/* Could be a GObject interface that's missing a prerequisite, or could
@@ -1570,16 +1570,16 @@ gjs_value_to_g_argument(JSContext *context,
if (transfer != GI_TRANSFER_NOTHING)
gjs_fundamental_ref(context, arg->v_pointer);
} else {
- /* Call again with throw=TRUE to set the exception */
+ /* Call again with throw=true to set the exception */
gjs_typecheck_object(context, JSVAL_TO_OBJECT(value), gtype, true);
arg->v_pointer = NULL;
- wrong = TRUE;
+ wrong = true;
}
} else {
gjs_throw(context, "Unhandled GType %s unpacking GArgument from Object",
g_type_name(gtype));
arg->v_pointer = NULL;
- wrong = TRUE;
+ wrong = true;
}
} else {
gjs_throw(context, "Unexpected unregistered type unpacking GArgument from Object");
@@ -1594,7 +1594,7 @@ gjs_value_to_g_argument(JSContext *context,
g_base_info_get_name ((GIBaseInfo *)interface_info));
/* gjs_throw should have been called already */
- wrong = TRUE;
+ wrong = true;
}
} else if (JSVAL_IS_NUMBER(value)) {
@@ -1602,9 +1602,9 @@ gjs_value_to_g_argument(JSContext *context,
gint64 value_int64;
if (!gjs_value_to_int64 (context, value, &value_int64))
- wrong = TRUE;
+ wrong = true;
else if (!_gjs_enum_value_is_valid(context, (GIEnumInfo *)interface_info, value_int64))
- wrong = TRUE;
+ wrong = true;
else
arg->v_int = _gjs_enum_to_int ((GIEnumInfo *)interface_info, value_int64);
@@ -1612,19 +1612,19 @@ gjs_value_to_g_argument(JSContext *context,
gint64 value_int64;
if (!gjs_value_to_int64 (context, value, &value_int64))
- wrong = TRUE;
+ wrong = true;
else if (!_gjs_flags_value_is_valid(context, gtype, value_int64))
- wrong = TRUE;
+ wrong = true;
else
arg->v_int = _gjs_enum_to_int ((GIEnumInfo *)interface_info, value_int64);
} else if (gtype == G_TYPE_NONE) {
gjs_throw(context, "Unexpected unregistered type unpacking GArgument from Number");
- wrong = TRUE;
+ wrong = true;
} else {
gjs_throw(context, "Unhandled GType %s unpacking GArgument from Number",
g_type_name(gtype));
- wrong = TRUE;
+ wrong = true;
}
} else {
@@ -1632,8 +1632,8 @@ gjs_value_to_g_argument(JSContext *context,
"JSObject type '%s' is neither null nor an object",
JS_GetTypeName(context,
JS_TypeOfValue(context, value)));
- wrong = TRUE;
- report_type_mismatch = TRUE;
+ wrong = true;
+ report_type_mismatch = true;
}
g_base_info_unref( (GIBaseInfo*) interface_info);
}
@@ -1646,7 +1646,7 @@ gjs_value_to_g_argument(JSContext *context,
length_name = gjs_context_get_const_string(context, GJS_STRING_LENGTH);
- /* nullable_type=FALSE; while a list can be NULL in C, that
+ /* nullable_type=false; while a list can be NULL in C, that
* means empty array in JavaScript, it doesn't mean null in
* JavaScript.
*/
@@ -1662,7 +1662,7 @@ gjs_value_to_g_argument(JSContext *context,
length_name,
&length_value) ||
!JS_ValueToECMAUint32(context, length_value, &length)) {
- wrong = TRUE;
+ wrong = true;
} else {
GList *list;
GSList *slist;
@@ -1681,7 +1681,7 @@ gjs_value_to_g_argument(JSContext *context,
transfer,
type_tag,
&list, &slist)) {
- wrong = TRUE;
+ wrong = true;
}
if (type_tag == GI_TYPE_TAG_GLIST) {
@@ -1693,8 +1693,8 @@ gjs_value_to_g_argument(JSContext *context,
g_base_info_unref((GIBaseInfo*) param_info);
}
} else {
- wrong = TRUE;
- report_type_mismatch = TRUE;
+ wrong = true;
+ report_type_mismatch = true;
}
break;
}
@@ -1703,12 +1703,12 @@ gjs_value_to_g_argument(JSContext *context,
if (JSVAL_IS_NULL(value)) {
arg->v_pointer = NULL;
if (!may_be_null) {
- wrong = TRUE;
- report_type_mismatch = TRUE;
+ wrong = true;
+ report_type_mismatch = true;
}
} else if (!JSVAL_IS_OBJECT(value)) {
- wrong = TRUE;
- report_type_mismatch = TRUE;
+ wrong = true;
+ report_type_mismatch = true;
} else {
GITypeInfo *key_param_info, *val_param_info;
GHashTable *ghash;
@@ -1724,7 +1724,7 @@ gjs_value_to_g_argument(JSContext *context,
val_param_info,
transfer,
&ghash)) {
- wrong = TRUE;
+ wrong = true;
} else {
arg->v_pointer = ghash;
}
@@ -1748,9 +1748,7 @@ gjs_value_to_g_argument(JSContext *context,
* of our own byteArray class.
*/
if (JSVAL_IS_OBJECT(value) &&
- gjs_typecheck_bytearray(context,
- JSVAL_TO_OBJECT(value),
- FALSE))
+ gjs_typecheck_bytearray(context, JSVAL_TO_OBJECT(value), false))
{
JSObject *bytearray_obj = JSVAL_TO_OBJECT(value);
if (array_type == GI_ARRAY_TYPE_BYTE_ARRAY) {
@@ -1770,7 +1768,7 @@ gjs_value_to_g_argument(JSContext *context,
may_be_null,
&data,
&length)) {
- wrong = TRUE;
+ wrong = true;
break;
}
@@ -1780,7 +1778,7 @@ gjs_value_to_g_argument(JSContext *context,
GArray *array = gjs_g_array_new_for_type(context, length, param_info);
if (!array)
- wrong = TRUE;
+ wrong = true;
else {
g_array_append_vals(array, data, length);
arg->v_pointer = array;
@@ -1809,8 +1807,8 @@ gjs_value_to_g_argument(JSContext *context,
default:
g_warning("Unhandled type %s for JavaScript to GArgument conversion",
g_type_tag_to_string(type_tag));
- wrong = TRUE;
- report_type_mismatch = TRUE;
+ wrong = true;
+ report_type_mismatch = true;
break;
}
@@ -1896,7 +1894,7 @@ gjs_g_argument_init_default(JSContext *context,
arg->v_uint64 = 0;
case GI_TYPE_TAG_BOOLEAN:
- arg->v_boolean = FALSE;
+ arg->v_boolean = false;
break;
case GI_TYPE_TAG_FLOAT:
@@ -2037,7 +2035,7 @@ gjs_array_from_g_list (JSContext *context,
if (!gjs_value_from_g_argument(context, &elem,
param_info, &arg,
- TRUE))
+ true))
goto out;
if (!JS_DefineElement(context, obj,
@@ -2053,7 +2051,7 @@ gjs_array_from_g_list (JSContext *context,
if (!gjs_value_from_g_argument(context, &elem,
param_info, &arg,
- TRUE))
+ true))
goto out;
if (!JS_DefineElement(context, obj,
@@ -2120,7 +2118,7 @@ gjs_array_from_carray_internal (JSContext *context,
#define ITERATE(type) \
for (i = 0; i < length; i++) { \
arg.v_##type = *(((g##type*)array) + i); \
- if (!gjs_value_from_g_argument(context, &elem, param_info, &arg, TRUE)) \
+ if (!gjs_value_from_g_argument(context, &elem, param_info, &arg, true)) \
goto finally; \
if (!JS_DefineElement(context, obj, i, elem, NULL, NULL, \
JSPROP_ENUMERATE)) \
@@ -2178,7 +2176,7 @@ gjs_array_from_carray_internal (JSContext *context,
for (i = 0; i < length; i++) {
arg.v_pointer = ((char*)array) + (struct_size * i);
- if (!gjs_value_from_g_argument(context, &elem, param_info, &arg, TRUE))
+ if (!gjs_value_from_g_argument(context, &elem, param_info, &arg, true))
goto finally;
if (!JS_DefineElement(context, obj, i, elem, NULL, NULL,
JSPROP_ENUMERATE))
@@ -2271,7 +2269,7 @@ gjs_array_from_boxed_array (JSContext *context,
if (arg->v_pointer == NULL) {
*value_p = JSVAL_NULL;
- return TRUE;
+ return true;
}
switch(array_type) {
@@ -2339,7 +2337,7 @@ gjs_array_from_zero_terminated_c_array (JSContext *context,
g##type *array = (g##type *) c_array; \
for (i = 0; array[i]; i++) { \
arg.v_##type = array[i]; \
- if (!gjs_value_from_g_argument(context, &elem, param_info, &arg, TRUE)) \
+ if (!gjs_value_from_g_argument(context, &elem, param_info, &arg, true)) \
goto finally; \
if (!JS_DefineElement(context, obj, i, elem, NULL, NULL, \
JSPROP_ENUMERATE)) \
@@ -2447,7 +2445,7 @@ gjs_object_from_g_hash (JSContext *context,
(&iter, &keyarg.v_pointer, &valarg.v_pointer)) {
if (!gjs_value_from_g_argument(context, &keyjs,
key_param_info, &keyarg,
- TRUE))
+ true))
goto out;
keystr = JS_ValueToString(context, keyjs);
@@ -2459,7 +2457,7 @@ gjs_object_from_g_hash (JSContext *context,
if (!gjs_value_from_g_argument(context, &valjs,
val_param_info, &valarg,
- TRUE))
+ true))
goto out;
if (!JS_DefineProperty(context, obj, keyutf8, valjs,
@@ -2487,7 +2485,7 @@ gjs_value_from_g_argument (JSContext *context,
jsval *value_p,
GITypeInfo *type_info,
GArgument *arg,
- gboolean copy_structs)
+ bool copy_structs)
{
GITypeTag type_tag;
@@ -2587,7 +2585,7 @@ gjs_value_from_g_argument (JSContext *context,
case GI_TYPE_TAG_ERROR:
{
if (arg->v_pointer) {
- JSObject *obj = gjs_error_from_gerror(context, (GError *) arg->v_pointer, FALSE);
+ JSObject *obj = gjs_error_from_gerror(context, (GError *) arg->v_pointer, false);
if (obj) {
*value_p = OBJECT_TO_JSVAL(obj);
return true;
@@ -2693,7 +2691,7 @@ gjs_value_from_g_argument (JSContext *context,
if (g_type_is_a(gtype, G_TYPE_ERROR)) {
JSObject *obj;
- obj = gjs_error_from_gerror(context, (GError *) arg->v_pointer, FALSE);
+ obj = gjs_error_from_gerror(context, (GError *) arg->v_pointer, false);
if (obj)
value = OBJECT_TO_JSVAL(obj);
else
@@ -2810,7 +2808,7 @@ gjs_value_from_g_argument (JSContext *context,
/* this assumes the array type is one of GArray, GPtrArray or
* GByteArray */
GITypeInfo *param_info;
- gboolean result;
+ bool result;
param_info = g_type_info_get_param_type(type_info, 0);
g_assert(param_info != NULL);
@@ -2831,7 +2829,7 @@ gjs_value_from_g_argument (JSContext *context,
case GI_TYPE_TAG_GSLIST:
{
GITypeInfo *param_info;
- gboolean result;
+ bool result;
param_info = g_type_info_get_param_type(type_info, 0);
g_assert(param_info != NULL);
@@ -2854,7 +2852,7 @@ gjs_value_from_g_argument (JSContext *context,
case GI_TYPE_TAG_GHASH:
{
GITypeInfo *key_param_info, *val_param_info;
- gboolean result;
+ bool result;
key_param_info = g_type_info_get_param_type(type_info, 0);
g_assert(key_param_info != NULL);
@@ -2913,7 +2911,7 @@ gjs_ghr_helper(gpointer key, gpointer val, gpointer user_data) {
g_type_info_get_tag(c->val_param_info),
&val_arg))
c->failed = true;
- return TRUE;
+ return true;
}
/* We need to handle GI_TRANSFER_NOTHING differently for out parameters
@@ -3159,7 +3157,7 @@ gjs_g_arg_release_internal(JSContext *context,
param_info,
element_type,
&elem)) {
- failed = TRUE;
+ failed = true;
}
}
}
@@ -3192,7 +3190,7 @@ gjs_g_arg_release_internal(JSContext *context,
case GI_TYPE_TAG_INT32:
case GI_TYPE_TAG_INT64:
case GI_TYPE_TAG_GTYPE:
- g_array_free((GArray*) arg->v_pointer, TRUE);
+ g_array_free((GArray*) arg->v_pointer, true);
break;
case GI_TYPE_TAG_UTF8:
@@ -3204,7 +3202,7 @@ gjs_g_arg_release_internal(JSContext *context,
case GI_TYPE_TAG_GHASH:
case GI_TYPE_TAG_ERROR:
if (transfer == GI_TRANSFER_CONTAINER) {
- g_array_free((GArray*) arg->v_pointer, TRUE);
+ g_array_free((GArray*) arg->v_pointer, true);
} else if (type_needs_out_release (param_info, element_type)) {
GArray *array = (GArray *) arg->v_pointer;
guint i;
@@ -3220,7 +3218,7 @@ gjs_g_arg_release_internal(JSContext *context,
&arg_iter);
}
- g_array_free (array, TRUE);
+ g_array_free (array, true);
}
break;
@@ -3256,7 +3254,7 @@ gjs_g_arg_release_internal(JSContext *context,
}
}
- g_ptr_array_free(array, TRUE);
+ g_ptr_array_free(array, true);
g_base_info_unref((GIBaseInfo*) param_info);
} else {
diff --git a/gi/arg.h b/gi/arg.h
index 92cd92d..7d6fc7e 100644
--- a/gi/arg.h
+++ b/gi/arg.h
@@ -63,14 +63,14 @@ bool gjs_value_to_g_argument (JSContext *context,
const char *arg_name,
GjsArgumentType argument_type,
GITransfer transfer,
- gboolean may_be_null,
+ bool may_be_null,
GArgument *arg);
bool gjs_value_from_g_argument (JSContext *context,
jsval *value_p,
GITypeInfo *type_info,
GArgument *arg,
- gboolean copy_structs);
+ bool copy_structs);
bool gjs_value_from_explicit_array (JSContext *context,
jsval *value_p,
GITypeInfo *type_info,
diff --git a/gi/boxed.cpp b/gi/boxed.cpp
index daac2bd..467d789 100644
--- a/gi/boxed.cpp
+++ b/gi/boxed.cpp
@@ -58,7 +58,7 @@ typedef struct {
the reference to the C gboxed */
} Boxed;
-static gboolean struct_is_simple(GIStructInfo *info);
+static bool struct_is_simple(GIStructInfo *info);
static bool boxed_set_field_from_value(JSContext *context,
Boxed *priv,
@@ -221,7 +221,7 @@ boxed_new_direct(Boxed *priv)
g_assert(priv->can_allocate_directly);
priv->gboxed = g_slice_alloc0(g_struct_info_get_size (priv->info));
- priv->allocated_directly = TRUE;
+ priv->allocated_directly = true;
gjs_debug_lifecycle(GJS_DEBUG_GBOXED,
"JSObject created by directly allocating %s",
@@ -264,9 +264,7 @@ boxed_init_from_props(JSContext *context,
JSObject *props;
JSObject *iter;
jsid prop_id;
- gboolean success;
-
- success = FALSE;
+ bool success = false;
if (!JSVAL_IS_OBJECT(props_value)) {
gjs_throw(context, "argument should be a hash with fields to set");
@@ -318,7 +316,7 @@ boxed_init_from_props(JSContext *context,
goto out;
}
- success = TRUE;
+ success = true;
out:
@@ -620,7 +618,7 @@ get_nested_interface_object (JSContext *context,
/* A structure nested inside a parent object; doesn't have an independent allocation */
priv->gboxed = ((char *)parent_priv->gboxed) + offset;
- priv->not_owning_gboxed = TRUE;
+ priv->not_owning_gboxed = true;
/* We never actually read the reserved slot, but we put the parent object
* into it to hold onto the parent object.
@@ -642,7 +640,7 @@ boxed_field_getter (JSContext *context,
GIFieldInfo *field_info;
GITypeInfo *type_info;
GArgument arg;
- gboolean success = FALSE;
+ bool success = false;
priv = priv_from_js(context, obj);
if (!priv)
@@ -691,10 +689,10 @@ boxed_field_getter (JSContext *context,
if (!gjs_value_from_g_argument (context, value.address(),
type_info,
&arg,
- TRUE))
+ true))
goto out;
- success = TRUE;
+ success = true;
out:
g_base_info_unref ((GIBaseInfo *)type_info);
@@ -755,8 +753,8 @@ boxed_set_field_from_value(JSContext *context,
{
GITypeInfo *type_info;
GArgument arg;
- gboolean success = FALSE;
- gboolean need_release = FALSE;
+ bool success = false;
+ bool need_release = false;
type_info = g_field_info_get_type (field_info);
@@ -786,10 +784,10 @@ boxed_set_field_from_value(JSContext *context,
g_base_info_get_name ((GIBaseInfo *)field_info),
GJS_ARGUMENT_FIELD,
GI_TRANSFER_NOTHING,
- TRUE, &arg))
+ true, &arg))
goto out;
- need_release = TRUE;
+ need_release = true;
if (!g_field_info_set_field (field_info, priv->gboxed, &arg)) {
gjs_throw(context, "Writing field %s.%s is not supported",
@@ -798,7 +796,7 @@ boxed_set_field_from_value(JSContext *context,
goto out;
}
- success = TRUE;
+ success = true;
out:
if (need_release)
@@ -820,7 +818,7 @@ boxed_field_setter (JSContext *context,
{
Boxed *priv;
GIFieldInfo *field_info;
- gboolean success = FALSE;
+ bool success = false;
priv = priv_from_js(context, obj);
if (!priv)
@@ -875,7 +873,7 @@ define_boxed_class_fields (JSContext *context,
for (i = 0; i < n_fields; i++) {
GIFieldInfo *field = g_struct_info_get_field (priv->info, i);
const char *field_name = g_base_info_get_name ((GIBaseInfo *)field);
- gboolean result;
+ bool result;
result = JS_DefineProperty(context, proto, field_name,
JSVAL_NULL,
@@ -952,10 +950,10 @@ JSFunctionSpec gjs_boxed_proto_funcs[] = {
{ NULL }
};
-static gboolean
+static bool
type_can_be_allocated_directly(GITypeInfo *type_info)
{
- gboolean is_simple = TRUE;
+ bool is_simple = true;
if (g_type_info_is_pointer(type_info)) {
if (g_type_info_get_tag(type_info) == GI_TYPE_TAG_ARRAY &&
@@ -967,7 +965,7 @@ type_can_be_allocated_directly(GITypeInfo *type_info)
g_base_info_unref((GIBaseInfo*)param_info);
} else {
- is_simple = FALSE;
+ is_simple = false;
}
} else {
switch (g_type_info_get_tag(type_info)) {
@@ -1001,11 +999,11 @@ type_can_be_allocated_directly(GITypeInfo *type_info)
case GI_INFO_TYPE_BOXED:
case GI_INFO_TYPE_STRUCT:
if (!struct_is_simple((GIStructInfo *)interface))
- is_simple = FALSE;
+ is_simple = false;
break;
case GI_INFO_TYPE_UNION:
/* FIXME: Need to implement */
- is_simple = FALSE;
+ is_simple = false;
break;
case GI_INFO_TYPE_ENUM:
case GI_INFO_TYPE_FLAGS:
@@ -1024,7 +1022,7 @@ type_can_be_allocated_directly(GITypeInfo *type_info)
case GI_INFO_TYPE_ARG:
case GI_INFO_TYPE_TYPE:
case GI_INFO_TYPE_UNRESOLVED:
- is_simple = FALSE;
+ is_simple = false;
break;
case GI_INFO_TYPE_INVALID_0:
g_assert_not_reached();
@@ -1043,16 +1041,16 @@ type_can_be_allocated_directly(GITypeInfo *type_info)
* type that we know how to assign to. If so, then we can allocate and free
* instances without needing a constructor.
*/
-static gboolean
+static bool
struct_is_simple(GIStructInfo *info)
{
int n_fields = g_struct_info_get_n_fields(info);
- gboolean is_simple = TRUE;
+ bool is_simple = true;
int i;
/* If it's opaque, it's not simple */
if (n_fields == 0)
- return FALSE;
+ return false;
for (i = 0; i < n_fields && is_simple; i++) {
GIFieldInfo *field_info = g_struct_info_get_field(info, i);
@@ -1232,7 +1230,7 @@ gjs_boxed_from_c_struct(JSContext *context,
* G_SIGNAL_TYPE_STATIC_SCOPE
*/
priv->gboxed = gboxed;
- priv->not_owning_gboxed = TRUE;
+ priv->not_owning_gboxed = true;
} else {
if (priv->gtype != G_TYPE_NONE && g_type_is_a (priv->gtype, G_TYPE_BOXED)) {
priv->gboxed = g_boxed_copy(priv->gtype, gboxed);
diff --git a/gi/closure.cpp b/gi/closure.cpp
index 61ed619..a3d5ef6 100644
--- a/gi/closure.cpp
+++ b/gi/closure.cpp
@@ -95,7 +95,7 @@ global_context_finalized(JSObject *obj,
void *data)
{
Closure *c;
- gboolean need_unref;
+ bool need_unref;
c = (Closure *) data;
@@ -107,7 +107,7 @@ global_context_finalized(JSObject *obj,
* invalid memory access
*/
need_unref = c->unref_on_global_object_finalized;
- c->unref_on_global_object_finalized = FALSE;
+ c->unref_on_global_object_finalized = false;
if (c->obj != NULL) {
g_assert(c->obj == obj);
@@ -207,7 +207,7 @@ closure_invalidated(gpointer data,
"until global object finalize)",
closure);
- c->unref_on_global_object_finalized = TRUE;
+ c->unref_on_global_object_finalized = true;
g_closure_ref(&c->base);
} else {
/* If the context still exists, then remove our destroy
@@ -299,7 +299,7 @@ gjs_closure_invoke(GClosure *closure,
JS_EndRequest(context);
}
-gboolean
+bool
gjs_closure_is_valid(GClosure *closure)
{
Closure *c;
@@ -347,7 +347,7 @@ GClosure*
gjs_closure_new(JSContext *context,
JSObject *callable,
const char *description,
- gboolean root_function)
+ bool root_function)
{
Closure *c;
@@ -362,7 +362,7 @@ gjs_closure_new(JSContext *context,
JS_BeginRequest(context);
c->obj = callable;
- c->unref_on_global_object_finalized = FALSE;
+ c->unref_on_global_object_finalized = false;
GJS_INC_COUNTER(closure);
diff --git a/gi/closure.h b/gi/closure.h
index 506178a..a520111 100644
--- a/gi/closure.h
+++ b/gi/closure.h
@@ -33,13 +33,13 @@ G_BEGIN_DECLS
GClosure* gjs_closure_new (JSContext *context,
JSObject *callable,
const char *description,
- gboolean root_function);
+ bool root_function);
void gjs_closure_invoke (GClosure *closure,
int argc,
jsval *argv,
jsval *retval);
JSContext* gjs_closure_get_context (GClosure *closure);
-gboolean gjs_closure_is_valid (GClosure *closure);
+bool gjs_closure_is_valid (GClosure *closure);
JSObject* gjs_closure_get_callable (GClosure *closure);
void gjs_closure_trace (GClosure *closure,
diff --git a/gi/enumeration.cpp b/gi/enumeration.cpp
index e21bf5b..c9061f8 100644
--- a/gi/enumeration.cpp
+++ b/gi/enumeration.cpp
@@ -121,7 +121,7 @@ gjs_define_enum_values(JSContext *context,
n_values = g_enum_info_get_n_values(info);
for (i = 0; i < n_values; ++i) {
GIValueInfo *value_info = g_enum_info_get_value(info, i);
- gboolean failed;
+ bool failed;
failed = !gjs_define_enum_value(context, in_object, value_info);
diff --git a/gi/foreign.cpp b/gi/foreign.cpp
index e2b59d2..7b86a25 100644
--- a/gi/foreign.cpp
+++ b/gi/foreign.cpp
@@ -34,9 +34,9 @@
static struct {
char *gi_namespace;
char *module; // relative to "imports."
- gboolean loaded;
+ bool loaded;
} foreign_modules[] = {
- { (char*)"cairo", (char*)"cairo", FALSE },
+ { (char*)"cairo", (char*)"cairo", false },
{ NULL }
};
@@ -84,7 +84,7 @@ gjs_foreign_load_foreign_module(JSContext *context,
return false;
}
g_free(script);
- foreign_modules[i].loaded = TRUE;
+ foreign_modules[i].loaded = true;
return true;
}
@@ -144,7 +144,7 @@ gjs_struct_foreign_convert_to_g_argument(JSContext *context,
const char *arg_name,
GjsArgumentType argument_type,
GITransfer transfer,
- gboolean may_be_null,
+ bool may_be_null,
GArgument *arg)
{
GjsForeignInfo *foreign;
diff --git a/gi/foreign.h b/gi/foreign.h
index 5b0aae3..c5186f9 100644
--- a/gi/foreign.h
+++ b/gi/foreign.h
@@ -33,7 +33,7 @@ typedef bool (*GjsArgOverrideToGArgumentFunc) (JSContext *context,
const char *arg_name,
GjsArgumentType argument_type,
GITransfer transfer,
- gboolean may_be_null,
+ bool may_be_null,
GArgument *arg);
typedef bool (*GjsArgOverrideFromGArgumentFunc) (JSContext *context,
@@ -59,7 +59,7 @@ bool gjs_struct_foreign_convert_to_g_argument (JSContext *context,
const char *arg_name,
GjsArgumentType argument_type,
GITransfer transfer,
- gboolean may_be_null,
+ bool may_be_null,
GArgument *arg);
bool gjs_struct_foreign_convert_from_g_argument (JSContext *context,
jsval *value_p,
diff --git a/gi/function.cpp b/gi/function.cpp
index 2daca2d..5542c22 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -178,8 +178,8 @@ gjs_callback_closure(ffi_cif *cif,
jsval *jsargs, rval;
JSObject *this_object;
GITypeInfo ret_type;
- gboolean success = FALSE;
- gboolean ret_type_is_void;
+ bool success = false;
+ bool ret_type_is_void;
trampoline = (GjsCallbackTrampoline *) data;
g_assert(trampoline);
@@ -247,7 +247,7 @@ gjs_callback_closure(ffi_cif *cif,
g_arg_info_load_type(&array_length_arg, &arg_type_info);
if (!gjs_value_from_g_argument(context, &length,
&arg_type_info,
- (GArgument *) args[array_length_pos], TRUE))
+ (GArgument *) args[array_length_pos], true))
goto out;
if (!gjs_value_from_explicit_array(context, &jsargs[n_jsargs++],
@@ -259,7 +259,7 @@ gjs_callback_closure(ffi_cif *cif,
if (!gjs_value_from_g_argument(context,
&jsargs[n_jsargs++],
&type_info,
- (GArgument *) args[i], FALSE))
+ (GArgument *) args[i], false))
goto out;
break;
default:
@@ -301,7 +301,7 @@ gjs_callback_closure(ffi_cif *cif,
"callback",
GJS_ARGUMENT_RETURN_VALUE,
transfer,
- TRUE,
+ true,
&argument))
goto out;
@@ -325,7 +325,7 @@ gjs_callback_closure(ffi_cif *cif,
"callback",
GJS_ARGUMENT_ARGUMENT,
GI_TRANSFER_NOTHING,
- TRUE,
+ true,
*(GArgument **)args[i]))
goto out;
@@ -349,7 +349,7 @@ gjs_callback_closure(ffi_cif *cif,
"callback",
GJS_ARGUMENT_ARGUMENT,
GI_TRANSFER_NOTHING,
- TRUE,
+ true,
&argument))
goto out;
@@ -377,7 +377,7 @@ gjs_callback_closure(ffi_cif *cif,
"callback",
GJS_ARGUMENT_ARGUMENT,
GI_TRANSFER_NOTHING,
- TRUE,
+ true,
*(GArgument **)args[i]))
goto out;
@@ -385,7 +385,7 @@ gjs_callback_closure(ffi_cif *cif,
}
}
- success = TRUE;
+ success = true;
out:
if (!success) {
@@ -423,7 +423,7 @@ gjs_callback_trampoline_new(JSContext *context,
jsval function,
GICallableInfo *callable_info,
GIScopeType scope,
- gboolean is_vfunc)
+ bool is_vfunc)
{
GjsCallbackTrampoline *trampoline;
int n_args, i;
@@ -696,12 +696,12 @@ gjs_invoke_c_function(JSContext *context,
guint8 gi_argc, gi_arg_pos;
guint8 c_argc, c_arg_pos;
guint8 js_arg_pos;
- gboolean can_throw_gerror;
- gboolean did_throw_gerror = FALSE;
+ bool can_throw_gerror;
+ bool did_throw_gerror = false;
GError *local_error = NULL;
- gboolean failed, postinvoke_release_failed;
+ bool failed, postinvoke_release_failed;
- gboolean is_method;
+ bool is_method;
GITypeInfo return_info;
GITypeTag return_tag;
jsval *return_values = NULL;
@@ -758,7 +758,7 @@ gjs_invoke_c_function(JSContext *context,
out_arg_cvalues = g_newa(GArgument, c_argc);
inout_original_arg_cvalues = g_newa(GArgument, c_argc);
- failed = FALSE;
+ failed = false;
c_arg_pos = 0; /* index into in_arg_cvalues, etc */
js_arg_pos = 0; /* index into argv */
@@ -774,7 +774,7 @@ gjs_invoke_c_function(JSContext *context,
for (gi_arg_pos = 0; gi_arg_pos < gi_argc; gi_arg_pos++, c_arg_pos++) {
GIDirection direction;
GIArgInfo arg_info;
- gboolean arg_removed = FALSE;
+ bool arg_removed = false;
/* gjs_debug(GJS_DEBUG_GFUNCTION, "gi_arg_pos: %d c_arg_pos: %d js_arg_pos: %d", gi_arg_pos,
c_arg_pos, js_arg_pos); */
@@ -809,7 +809,7 @@ gjs_invoke_c_function(JSContext *context,
} else if (interface_type == GI_INFO_TYPE_UNION) {
size = g_union_info_get_size((GIUnionInfo*)interface_info);
} else {
- failed = TRUE;
+ failed = true;
}
g_base_info_unref((GIBaseInfo*)interface_info);
@@ -821,7 +821,7 @@ gjs_invoke_c_function(JSContext *context,
break;
}
default:
- failed = TRUE;
+ failed = true;
}
if (failed)
gjs_throw(context, "Unsupported type %s for (out caller-allocates)",
g_type_tag_to_string(type_tag));
@@ -859,7 +859,7 @@ gjs_invoke_c_function(JSContext *context,
g_base_info_get_name( (GIBaseInfo*) &arg_info),
JS_GetTypeName(context,
JS_TypeOfValue(context, value)));
- failed = TRUE;
+ failed = true;
break;
}
@@ -868,7 +868,7 @@ gjs_invoke_c_function(JSContext *context,
value,
callable_info,
scope,
- FALSE);
+ false);
closure = trampoline->closure;
g_base_info_unref(callable_info);
}
@@ -895,7 +895,7 @@ gjs_invoke_c_function(JSContext *context,
break;
}
case PARAM_SKIPPED:
- arg_removed = TRUE;
+ arg_removed = true;
break;
case PARAM_ARRAY: {
GIArgInfo array_length_arg;
@@ -905,7 +905,7 @@ gjs_invoke_c_function(JSContext *context,
if (!gjs_value_to_explicit_array(context, js_argv[js_arg_pos], &arg_info,
in_value, &length)) {
- failed = TRUE;
+ failed = true;
break;
}
@@ -914,7 +914,7 @@ gjs_invoke_c_function(JSContext *context,
array_length_pos += is_method ? 1 : 0;
if (!gjs_value_to_arg(context, INT_TO_JSVAL(length), &array_length_arg,
in_arg_cvalues + array_length_pos)) {
- failed = TRUE;
+ failed = true;
break;
}
/* Also handle the INOUT for the length here */
@@ -939,7 +939,7 @@ gjs_invoke_c_function(JSContext *context,
g_assert_cmpuint(js_arg_pos, <, js_argc);
if (!gjs_value_to_arg(context, js_argv[js_arg_pos], &arg_info,
in_value)) {
- failed = TRUE;
+ failed = true;
break;
}
}
@@ -967,7 +967,7 @@ gjs_invoke_c_function(JSContext *context,
/* Did argument conversion fail? In that case, skip invocation and jump to release
* processing. */
if (failed) {
- did_throw_gerror = FALSE;
+ did_throw_gerror = false;
goto release;
}
@@ -1001,7 +1001,7 @@ gjs_invoke_c_function(JSContext *context,
if (can_throw_gerror) {
did_throw_gerror = local_error != NULL;
} else {
- did_throw_gerror = FALSE;
+ did_throw_gerror = false;
}
if (js_rval)
@@ -1015,7 +1015,7 @@ gjs_invoke_c_function(JSContext *context,
if (return_tag != GI_TYPE_TAG_VOID) {
GITransfer transfer = g_callable_info_get_caller_owns((GICallableInfo*) function->info);
- gboolean arg_failed = FALSE;
+ bool arg_failed = false;
gint array_length_pos;
g_assert_cmpuint(next_rval, <, function->js_out_argc);
@@ -1034,7 +1034,7 @@ gjs_invoke_c_function(JSContext *context,
arg_failed = !gjs_value_from_g_argument(context, &length,
&arg_type_info,
&out_arg_cvalues[array_length_pos],
- TRUE);
+ true);
if (!arg_failed && js_rval) {
arg_failed = !gjs_value_from_explicit_array(context,
&return_values[next_rval],
@@ -1049,12 +1049,12 @@ gjs_invoke_c_function(JSContext *context,
&return_info,
JSVAL_TO_INT(length),
&return_gargument))
- failed = TRUE;
+ failed = true;
} else {
if (js_rval)
arg_failed = !gjs_value_from_g_argument(context, &return_values[next_rval],
&return_info, &return_gargument,
- TRUE);
+ true);
/* Free GArgument, the jsval should have ref'd or copied it */
if (!arg_failed &&
!r_value &&
@@ -1062,10 +1062,10 @@ gjs_invoke_c_function(JSContext *context,
transfer,
&return_info,
&return_gargument))
- failed = TRUE;
+ failed = true;
}
if (arg_failed)
- failed = TRUE;
+ failed = true;
++next_rval;
}
@@ -1076,7 +1076,7 @@ release:
* all out args to JS
*/
c_arg_pos = is_method ? 1 : 0;
- postinvoke_release_failed = FALSE;
+ postinvoke_release_failed = false;
for (gi_arg_pos = 0; gi_arg_pos < gi_argc && c_arg_pos < processed_c_args; gi_arg_pos++, c_arg_pos++) {
GIDirection direction;
GIArgInfo arg_info;
@@ -1135,14 +1135,14 @@ release:
&arg_type_info,
length,
arg)) {
- postinvoke_release_failed = TRUE;
+ postinvoke_release_failed = true;
}
} else if (param_type == PARAM_NORMAL) {
if (!gjs_g_argument_release_in_arg(context,
transfer,
&arg_type_info,
arg)) {
- postinvoke_release_failed = TRUE;
+ postinvoke_release_failed = true;
}
}
}
@@ -1156,7 +1156,7 @@ release:
if ((direction == GI_DIRECTION_OUT || direction == GI_DIRECTION_INOUT) && param_type !=
PARAM_SKIPPED) {
GArgument *arg;
- gboolean arg_failed = FALSE;
+ bool arg_failed = false;
gint array_length_pos;
jsval array_length;
GITransfer transfer;
@@ -1178,7 +1178,7 @@ release:
arg_failed = !gjs_value_from_g_argument(context, &array_length,
&array_length_type_info,
&out_arg_cvalues[array_length_pos],
- TRUE);
+ true);
if (!arg_failed) {
arg_failed = !gjs_value_from_explicit_array(context,
&return_values[next_rval],
@@ -1191,12 +1191,12 @@ release:
&return_values[next_rval],
&arg_type_info,
arg,
- TRUE);
+ true);
}
}
if (arg_failed)
- postinvoke_release_failed = TRUE;
+ postinvoke_release_failed = true;
/* Free GArgument, the jsval should have ref'd or copied it */
transfer = g_arg_info_get_ownership_transfer(&arg_info);
@@ -1251,7 +1251,7 @@ release:
}
if (postinvoke_release_failed)
- failed = TRUE;
+ failed = true;
g_assert(failed || did_throw_gerror || next_rval == (guint8)function->js_out_argc);
g_assert_cmpuint(c_arg_pos, ==, processed_c_args);
@@ -1270,7 +1270,7 @@ release:
function->js_out_argc,
return_values);
if (array == NULL) {
- failed = TRUE;
+ failed = true;
} else {
*js_rval = OBJECT_TO_JSVAL(array);
}
@@ -1401,7 +1401,7 @@ function_to_string (JSContext *context,
{
Function *priv;
gchar *string;
- gboolean free;
+ bool free;
JSObject *self;
jsval retval;
bool ret = false;
@@ -1420,11 +1420,11 @@ function_to_string (JSContext *context,
priv = priv_from_js (context, self);
if (priv == NULL) {
string = (gchar *) "function () {\n}";
- free = FALSE;
+ free = false;
goto out;
}
- free = TRUE;
+ free = true;
n_args = g_callable_info_get_n_args(priv->info);
n_jsargs = 0;
@@ -1446,7 +1446,7 @@ function_to_string (JSContext *context,
n_jsargs++;
g_string_append(arg_names_str, g_base_info_get_name(&arg_info));
}
- arg_names = g_string_free(arg_names_str, FALSE);
+ arg_names = g_string_free(arg_names_str, false);
if (g_base_info_get_type(priv->info) == GI_INFO_TYPE_FUNCTION) {
string = g_strdup_printf("function %s(%s) {\n\t/* proxy for native symbol %s(); */\n}",
@@ -1509,7 +1509,7 @@ JSFunctionSpec gjs_function_proto_funcs[] = {
JS_FS_END
};
-static gboolean
+static bool
init_cached_function_data (JSContext *context,
Function *function,
GType gtype,
@@ -1528,7 +1528,7 @@ init_cached_function_data (JSContext *context,
&(function->invoker),
&error)) {
gjs_throw_g_error(context, error);
- return FALSE;
+ return false;
}
} else if (info_type == GI_INFO_TYPE_VFUNC) {
gpointer addr;
@@ -1539,14 +1539,14 @@ init_cached_function_data (JSContext *context,
gjs_throw_g_error(context, error);
g_clear_error(&error);
- return FALSE;
+ return false;
}
if (!g_function_invoker_new_for_address(addr, info,
&(function->invoker),
&error)) {
gjs_throw_g_error(context, error);
- return FALSE;
+ return false;
}
}
@@ -1742,7 +1742,7 @@ gjs_define_function(JSContext *context,
JSObject *function = NULL;
GIInfoType info_type;
gchar *name;
- gboolean free_name;
+ bool free_name;
info_type = g_base_info_get_type((GIBaseInfo *)info);
@@ -1756,10 +1756,10 @@ gjs_define_function(JSContext *context,
if (info_type == GI_INFO_TYPE_FUNCTION) {
name = (gchar *) g_base_info_get_name((GIBaseInfo*) info);
- free_name = FALSE;
+ free_name = false;
} else if (info_type == GI_INFO_TYPE_VFUNC) {
name = g_strdup_printf("vfunc_%s", g_base_info_get_name((GIBaseInfo*) info));
- free_name = TRUE;
+ free_name = true;
} else {
g_assert_not_reached ();
}
diff --git a/gi/function.h b/gi/function.h
index 2419f22..8d463d6 100644
--- a/gi/function.h
+++ b/gi/function.h
@@ -48,7 +48,7 @@ typedef struct {
ffi_cif cif;
ffi_closure *closure;
GIScopeType scope;
- gboolean is_vfunc;
+ bool is_vfunc;
GjsParamType *param_types;
} GjsCallbackTrampoline;
@@ -56,7 +56,7 @@ GjsCallbackTrampoline* gjs_callback_trampoline_new(JSContext *context,
jsval function,
GICallableInfo *callable_info,
GIScopeType scope,
- gboolean is_vfunc);
+ bool is_vfunc);
void gjs_callback_trampoline_unref(GjsCallbackTrampoline *trampoline);
void gjs_callback_trampoline_ref(GjsCallbackTrampoline *trampoline);
diff --git a/gi/fundamental.cpp b/gi/fundamental.cpp
index 53d5246..e39bc48 100644
--- a/gi/fundamental.cpp
+++ b/gi/fundamental.cpp
@@ -171,7 +171,7 @@ static void
associate_js_instance_to_fundamental(JSContext *context,
JSObject *object,
void *gfundamental,
- gboolean owned_ref)
+ bool owned_ref)
{
FundamentalInstance *priv;
@@ -443,7 +443,7 @@ GJS_NATIVE_CONSTRUCTOR_DECLARE(fundamental_instance)
if (!fundamental_invoke_constructor(priv, context, object, argc, argv.array(), &ret_value))
return false;
- associate_js_instance_to_fundamental(context, object, ret_value.v_pointer, FALSE);
+ associate_js_instance_to_fundamental(context, object, ret_value.v_pointer, false);
g_callable_info_load_return_type((GICallableInfo*) priv->prototype->constructor_info, &return_info);
@@ -780,7 +780,7 @@ gjs_object_from_g_fundamental(JSContext *context,
init_fundamental_instance(context, object);
- associate_js_instance_to_fundamental(context, object, gfundamental, FALSE);
+ associate_js_instance_to_fundamental(context, object, gfundamental, false);
out:
return object;
diff --git a/gi/gerror.cpp b/gi/gerror.cpp
index 9a69bc2..8209781 100644
--- a/gi/gerror.cpp
+++ b/gi/gerror.cpp
@@ -298,7 +298,7 @@ error_constructor_value_of(JSContext *context, unsigned argc, jsval *vp)
v_out = INT_TO_JSVAL(priv->domain);
rec.rval().set(v_out);
- return TRUE;
+ return true;
}
@@ -472,7 +472,7 @@ define_error_properties(JSContext *context,
JSObject*
gjs_error_from_gerror(JSContext *context,
GError *gerror,
- gboolean add_stack)
+ bool add_stack)
{
JSObject *obj;
JSObject *proto;
@@ -560,7 +560,7 @@ gjs_typecheck_gerror (JSContext *context,
bool throw_error)
{
if (gjs_typecheck_boxed (context, obj, NULL, G_TYPE_ERROR, false))
- return TRUE;
+ return true;
return do_base_typecheck(context, obj, throw_error);
}
diff --git a/gi/gerror.h b/gi/gerror.h
index 38cfa2f..8602be6 100644
--- a/gi/gerror.h
+++ b/gi/gerror.h
@@ -38,7 +38,7 @@ GError* gjs_gerror_from_error (JSContext *context,
JSObject *obj);
JSObject* gjs_error_from_gerror (JSContext *context,
GError *gerror,
- gboolean add_stack);
+ bool add_stack);
bool gjs_typecheck_gerror (JSContext *context,
JSObject *obj,
bool throw_error);
diff --git a/gi/gtype.cpp b/gi/gtype.cpp
index 9c3e8c5..ee87d63 100644
--- a/gi/gtype.cpp
+++ b/gi/gtype.cpp
@@ -103,7 +103,7 @@ get_name_func (JSContext *context,
if (gtype == 0) {
rec.rval().set(JSVAL_NULL);
- return TRUE;
+ return true;
} else {
ret = gjs_string_from_utf8(context, g_type_name(gtype), -1, &retval);
if (ret)
diff --git a/gi/keep-alive.cpp b/gi/keep-alive.cpp
index 6c286df..ecde4fc 100644
--- a/gi/keep-alive.cpp
+++ b/gi/keep-alive.cpp
@@ -96,7 +96,7 @@ keep_alive_finalize(JSFreeOp *fop,
if (priv == NULL)
return; /* we are the prototype, not a real instance */
- priv->inside_finalize = TRUE;
+ priv->inside_finalize = true;
while (gjs_g_hash_table_steal_one(priv->children,
&key, &value)) {
@@ -140,9 +140,9 @@ keep_alive_trace(JSTracer *tracer,
return;
g_assert(!priv->inside_trace);
- priv->inside_trace = TRUE;
+ priv->inside_trace = true;
g_hash_table_foreach(priv->children, trace_foreach, tracer);
- priv->inside_trace = FALSE;
+ priv->inside_trace = false;
}
/* The bizarre thing about this vtable is that it applies to both
@@ -407,7 +407,7 @@ gjs_keep_alive_iterator_init (GjsKeepAliveIter *iter,
g_hash_table_iter_init(&real->hashiter, priv->children);
}
-gboolean
+bool
gjs_keep_alive_iterator_next (GjsKeepAliveIter *iter,
GjsUnrootedFunc notify_func,
JSObject **out_child,
@@ -415,7 +415,7 @@ gjs_keep_alive_iterator_next (GjsKeepAliveIter *iter,
{
GjsRealKeepAliveIter *real = (GjsRealKeepAliveIter*)iter;
gpointer k, v;
- gboolean ret = FALSE;
+ bool ret = false;
while (g_hash_table_iter_next(&real->hashiter, &k, &v)) {
Child *child = (Child*)k;
@@ -423,7 +423,7 @@ gjs_keep_alive_iterator_next (GjsKeepAliveIter *iter,
if (child->notify != notify_func)
continue;
- ret = TRUE;
+ ret = true;
*out_child = child->child;
*out_data = child->data;
break;
diff --git a/gi/keep-alive.h b/gi/keep-alive.h
index 478cd2e..db064fd 100644
--- a/gi/keep-alive.h
+++ b/gi/keep-alive.h
@@ -82,10 +82,10 @@ struct GjsKeepAliveIter {
void gjs_keep_alive_iterator_init (GjsKeepAliveIter *iter, JSObject *keep_alive);
-gboolean gjs_keep_alive_iterator_next (GjsKeepAliveIter *iter,
- GjsUnrootedFunc notify_func,
- JSObject **out_child,
- void **out_data);
+bool gjs_keep_alive_iterator_next (GjsKeepAliveIter *iter,
+ GjsUnrootedFunc notify_func,
+ JSObject **out_child,
+ void **out_data);
G_END_DECLS
diff --git a/gi/ns.cpp b/gi/ns.cpp
index f3a53c0..1b55b2f 100644
--- a/gi/ns.cpp
+++ b/gi/ns.cpp
@@ -67,7 +67,7 @@ ns_new_resolve(JSContext *context,
GIRepository *repo;
GIBaseInfo *info;
bool ret = false;
- gboolean defined;
+ bool defined;
if (!gjs_get_string_id(context, id, &name))
return true; /* not resolved, but no error */
@@ -95,7 +95,7 @@ ns_new_resolve(JSContext *context,
info = g_irepository_find_by_name(repo, priv->gi_namespace, name);
if (info == NULL) {
- /* No property defined, but no error either, so return TRUE */
+ /* No property defined, but no error either, so return true */
JS_EndRequest(context);
ret = true;
goto out;
diff --git a/gi/object.cpp b/gi/object.cpp
index e0031f3..86b2b4a 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -188,7 +188,7 @@ init_g_param_from_property(JSContext *context,
jsval js_value,
GType gtype,
GParameter *parameter,
- gboolean constructing)
+ bool constructing)
{
char *gname;
GParamSpec *param_spec;
@@ -351,7 +351,7 @@ object_instance_set_prop(JSContext *context,
value_p,
G_TYPE_FROM_INSTANCE(priv->gobj),
¶m,
- FALSE /* constructing */)) {
+ false /* constructing */)) {
case SOME_ERROR_OCCURRED:
ret = false;
case NO_SUCH_G_PROPERTY:
@@ -376,7 +376,7 @@ object_instance_set_prop(JSContext *context,
return ret;
}
-static gboolean
+static bool
is_vfunc_unchanged(GIVFuncInfo *info,
GType gtype)
{
@@ -387,13 +387,13 @@ is_vfunc_unchanged(GIVFuncInfo *info,
addr1 = g_vfunc_info_get_address(info, gtype, &error);
if (error) {
g_clear_error(&error);
- return FALSE;
+ return false;
}
addr2 = g_vfunc_info_get_address(info, ptype, &error);
if (error) {
g_clear_error(&error);
- return FALSE;
+ return false;
}
return addr1 == addr2;
@@ -402,11 +402,11 @@ is_vfunc_unchanged(GIVFuncInfo *info,
static GIVFuncInfo *
find_vfunc_on_parents(GIObjectInfo *info,
gchar *name,
- gboolean *out_defined_by_parent)
+ bool *out_defined_by_parent)
{
GIVFuncInfo *vfunc = NULL;
GIObjectInfo *parent;
- gboolean defined_by_parent = FALSE;
+ bool defined_by_parent = false;
/* ref the first info so that we don't destroy
* it when unrefing parents later */
@@ -424,7 +424,7 @@ find_vfunc_on_parents(GIObjectInfo *info,
if (parent)
vfunc = g_object_info_find_vfunc(parent, name);
- defined_by_parent = TRUE;
+ defined_by_parent = true;
}
if (parent)
@@ -572,7 +572,7 @@ object_instance_new_resolve(JSContext *context,
gchar *name_without_vfunc_ = &name[6];
GIVFuncInfo *vfunc;
- gboolean defined_by_parent;
+ bool defined_by_parent;
vfunc = find_vfunc_on_parents(priv->info, name_without_vfunc_, &defined_by_parent);
if (vfunc != NULL) {
@@ -683,7 +683,7 @@ object_instance_props_to_g_parameters(JSContext *context,
if (n_gparams_p)
*n_gparams_p = 0;
- gparams = g_array_new(/* nul term */ FALSE, /* clear */ TRUE,
+ gparams = g_array_new(/* nul term */ false, /* clear */ true,
sizeof(GParameter));
if (argc == 0 || JSVAL_IS_VOID(argv[0]))
@@ -722,7 +722,7 @@ object_instance_props_to_g_parameters(JSContext *context,
value,
gtype,
&gparam,
- TRUE /* constructing */)) {
+ true /* constructing */)) {
case NO_SUCH_G_PROPERTY:
gjs_throw(context, "No property %s on this GObject %s",
name, g_type_name(gtype));
@@ -746,7 +746,7 @@ object_instance_props_to_g_parameters(JSContext *context,
if (n_gparams_p)
*n_gparams_p = gparams->len;
if (gparams_p)
- *gparams_p = (GParameter*) g_array_free(gparams, FALSE);
+ *gparams_p = (GParameter*) g_array_free(gparams, false);
return true;
@@ -755,7 +755,7 @@ object_instance_props_to_g_parameters(JSContext *context,
GParameter *to_free;
int count;
count = gparams->len;
- to_free = (GParameter*) g_array_free(gparams, FALSE);
+ to_free = (GParameter*) g_array_free(gparams, false);
free_g_params(to_free, count);
}
return false;
@@ -805,7 +805,7 @@ get_qdata_key_for_toggle_direction(ToggleDirection direction)
return quark;
}
-static gboolean
+static bool
clear_toggle_idle_source(GObject *gobj,
ToggleDirection direction)
{
@@ -816,7 +816,7 @@ clear_toggle_idle_source(GObject *gobj,
return g_object_steal_qdata(gobj, qdata_key) != NULL;
}
-static gboolean
+static bool
toggle_idle_source_is_queued(GObject *gobj,
ToggleDirection direction)
{
@@ -827,7 +827,7 @@ toggle_idle_source_is_queued(GObject *gobj,
return g_object_get_qdata(gobj, qdata_key) != NULL;
}
-static gboolean
+static bool
cancel_toggle_idle(GObject *gobj,
ToggleDirection direction)
{
@@ -855,7 +855,7 @@ handle_toggle_down(GObject *gobj)
priv = (ObjectInstance *) JS_GetPrivate(obj);
gjs_debug_lifecycle(GJS_DEBUG_GOBJECT,
- "Toggle notify gobj %p obj %p is_last_ref TRUE keep-alive %p",
+ "Toggle notify gobj %p obj %p is_last_ref true keep-alive %p",
gobj, obj, priv->keep_alive);
/* Change to weak ref so the wrapper-wrappee pair can be
@@ -889,7 +889,7 @@ handle_toggle_up(GObject *gobj)
priv = (ObjectInstance *) JS_GetPrivate(obj);
gjs_debug_lifecycle(GJS_DEBUG_GOBJECT,
- "Toggle notify gobj %p obj %p is_last_ref FALSEd keep-alive %p",
+ "Toggle notify gobj %p obj %p is_last_ref false keep-alive %p",
gobj, obj, priv->keep_alive);
/* Change to strong ref so the wrappee keeps the wrapper alive
@@ -930,7 +930,7 @@ idle_handle_toggle(gpointer data)
}
out:
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void
@@ -961,7 +961,7 @@ queue_toggle_idle(GObject *gobj,
* (either only up, or down-up)
*/
operation->gobj = (GObject*) g_object_ref(gobj);
- operation->needs_unref = TRUE;
+ operation->needs_unref = true;
break;
case TOGGLE_DOWN:
/* If we're toggling down, we don't need to take a reference since
@@ -1000,8 +1000,8 @@ wrapped_gobj_toggle_notify(gpointer data,
GObject *gobj,
gboolean is_last_ref)
{
- gboolean is_main_thread, is_sweeping;
- gboolean toggle_up_queued, toggle_down_queued;
+ bool is_main_thread, is_sweeping;
+ bool toggle_up_queued, toggle_down_queued;
GjsContext *context;
JSContext *js_context;
@@ -1050,7 +1050,7 @@ wrapped_gobj_toggle_notify(gpointer data,
js_context = (JSContext*) gjs_context_get_native_context(context);
is_sweeping = gjs_runtime_is_sweeping(JS_GetRuntime(js_context));
} else {
- is_sweeping = FALSE;
+ is_sweeping = false;
}
toggle_up_queued = toggle_idle_source_is_queued(gobj, TOGGLE_UP);
@@ -1128,7 +1128,7 @@ gjs_object_prepare_shutdown (JSContext *context)
/* First, get rid of anything left over on the main context */
while (g_main_context_pending(NULL) &&
g_atomic_int_get(&pending_idle_toggles) > 0) {
- g_main_context_iteration(NULL, FALSE);
+ g_main_context_iteration(NULL, false);
}
/* Now, we iterate over all of the objects, breaking the JS <-> C
@@ -1413,8 +1413,8 @@ object_instance_finalize(JSFreeOp *fop,
priv->info ? g_base_info_get_name((GIBaseInfo*) priv->info) :
g_type_name(priv->gtype)));
if (priv->gobj) {
- gboolean had_toggle_up;
- gboolean had_toggle_down;
+ bool had_toggle_up;
+ bool had_toggle_down;
invalidate_all_signals (priv);
@@ -1561,7 +1561,7 @@ static bool
real_connect_func(JSContext *context,
unsigned argc,
jsval *vp,
- gboolean after)
+ bool after)
{
JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
JSObject *obj = JSVAL_TO_OBJECT(argv.thisv());
@@ -1614,7 +1614,7 @@ real_connect_func(JSContext *context,
G_OBJECT_TYPE(priv->gobj),
&signal_id,
&signal_detail,
- TRUE)) {
+ true)) {
gjs_throw(context, "No signal '%s' on object '%s'",
signal_name,
g_type_name(G_OBJECT_TYPE(priv->gobj)));
@@ -1657,7 +1657,7 @@ connect_after_func(JSContext *context,
unsigned argc,
jsval *vp)
{
- return real_connect_func(context, argc, vp, TRUE);
+ return real_connect_func(context, argc, vp, true);
}
static bool
@@ -1665,7 +1665,7 @@ connect_func(JSContext *context,
unsigned argc,
jsval *vp)
{
- return real_connect_func(context, argc, vp, FALSE);
+ return real_connect_func(context, argc, vp, false);
}
static bool
@@ -1684,7 +1684,7 @@ emit_func(JSContext *context,
GValue *instance_and_args;
GValue rvalue = G_VALUE_INIT;
unsigned int i;
- gboolean failed;
+ bool failed;
jsval retval;
bool ret = false;
@@ -1720,7 +1720,7 @@ emit_func(JSContext *context,
G_OBJECT_TYPE(priv->gobj),
&signal_id,
&signal_detail,
- FALSE)) {
+ false)) {
gjs_throw(context, "No signal '%s' on object '%s'",
signal_name,
g_type_name(G_OBJECT_TYPE(priv->gobj)));
@@ -1748,7 +1748,7 @@ emit_func(JSContext *context,
g_value_init(&instance_and_args[0], G_TYPE_FROM_INSTANCE(priv->gobj));
g_value_set_instance(&instance_and_args[0], priv->gobj);
- failed = FALSE;
+ failed = false;
for (i = 0; i < signal_query.n_params; ++i) {
GValue *value;
value = &instance_and_args[i + 1];
@@ -1772,7 +1772,7 @@ emit_func(JSContext *context,
if (!gjs_value_from_g_value(context,
&retval,
&rvalue))
- failed = TRUE;
+ failed = true;
g_value_unset(&rvalue);
} else {
@@ -1854,8 +1854,8 @@ init_func (JSContext *context,
bool ret;
- if (!do_base_typecheck(context, obj, TRUE))
- return FALSE;
+ if (!do_base_typecheck(context, obj, true))
+ return false;
ret = object_instance_init(context, &obj, argc, argv.array());
@@ -2207,7 +2207,7 @@ find_vfunc_info (JSContext *context,
GIBaseInfo *ancestor_info;
GIStructInfo *struct_info;
gpointer implementor_class;
- gboolean is_interface;
+ bool is_interface;
*field_info_ret = NULL;
*implementor_vtable_ret = NULL;
@@ -2366,7 +2366,7 @@ gjs_hook_up_vfunc(JSContext *cx,
method_ptr = G_STRUCT_MEMBER_P(implementor_vtable, offset);
trampoline = gjs_callback_trampoline_new(cx, OBJECT_TO_JSVAL(function), callback_info,
- GI_SCOPE_TYPE_NOTIFIED, TRUE);
+ GI_SCOPE_TYPE_NOTIFIED, true);
*((ffi_closure **)method_ptr) = trampoline->closure;
@@ -2681,7 +2681,7 @@ gjs_add_interface(GType instance_type,
&interface_vtable);
}
-static gboolean
+static bool
validate_interfaces_and_properties_args(JSContext *cx,
JSObject *interfaces,
JSObject *properties,
@@ -2692,28 +2692,28 @@ validate_interfaces_and_properties_args(JSContext *cx,
if (!JS_IsArrayObject(cx, interfaces)) {
gjs_throw(cx, "Invalid parameter interfaces (expected Array)");
- return FALSE;
+ return false;
}
if (!JS_GetArrayLength(cx, interfaces, &n_int))
- return FALSE;
+ return false;
if (!JS_IsArrayObject(cx, properties)) {
gjs_throw(cx, "Invalid parameter properties (expected Array)");
- return FALSE;
+ return false;
}
if (!JS_GetArrayLength(cx, properties, &n_prop))
- return FALSE;
+ return false;
if (n_interfaces != NULL)
*n_interfaces = n_int;
if (n_properties != NULL)
*n_properties = n_prop;
- return TRUE;
+ return true;
}
-static gboolean
+static bool
get_interface_gtypes(JSContext *cx,
JSObject *interfaces,
guint32 n_interfaces,
@@ -2726,25 +2726,25 @@ get_interface_gtypes(JSContext *cx,
GType iface_type;
if (!JS_GetElement(cx, interfaces, i, &iface_val.get()))
- return FALSE;
+ return false;
if (!iface_val.isObject()) {
gjs_throw (cx, "Invalid parameter interfaces (element %d was not a GType)", i);
- return FALSE;
+ return false;
}
iface_type = gjs_gtype_get_actual_gtype(cx, &iface_val.toObject());
if (iface_type == G_TYPE_INVALID) {
gjs_throw (cx, "Invalid parameter interfaces (element %d was not a GType)", i);
- return FALSE;
+ return false;
}
iface_types[i] = iface_type;
}
- return TRUE;
+ return true;
}
-static gboolean
+static bool
save_properties_for_class_init(JSContext *cx,
JSObject *properties,
guint32 n_properties,
@@ -2761,18 +2761,18 @@ save_properties_for_class_init(JSContext *cx,
if (!JS_GetElement(cx, properties, i, &prop_val.get())) {
g_clear_pointer(&properties_native, g_ptr_array_unref);
- return FALSE;
+ return false;
}
if (!prop_val.isObject()) {
g_clear_pointer(&properties_native, g_ptr_array_unref);
gjs_throw(cx, "Invalid parameter, expected object");
- return FALSE;
+ return false;
}
JS::RootedObject prop_obj(cx, &prop_val.toObject());
if (!gjs_typecheck_param(cx, prop_obj, G_TYPE_NONE, true)) {
g_clear_pointer(&properties_native, g_ptr_array_unref);
- return FALSE;
+ return false;
}
g_ptr_array_add(properties_native, g_param_spec_ref(gjs_g_param_from_param(cx, prop_obj)));
}
@@ -2780,7 +2780,7 @@ save_properties_for_class_init(JSContext *cx,
g_ptr_array_ref(properties_native));
g_clear_pointer(&properties_native, g_ptr_array_unref);
- return TRUE;
+ return true;
}
static bool
diff --git a/gi/proxyutils.cpp b/gi/proxyutils.cpp
index 59c101d..ecfb658 100644
--- a/gi/proxyutils.cpp
+++ b/gi/proxyutils.cpp
@@ -71,6 +71,6 @@ _gjs_proxy_to_string_func(JSContext *context,
ret = true;
out:
- g_string_free (buf, TRUE);
+ g_string_free (buf, true);
return ret;
}
diff --git a/gi/repo.cpp b/gi/repo.cpp
index 63afb57..97a80a6 100644
--- a/gi/repo.cpp
+++ b/gi/repo.cpp
@@ -367,7 +367,7 @@ gjs_define_constant(JSContext *context,
type_info = g_constant_info_get_type(info);
g_constant_info_get_value(info, &garg);
- if (!gjs_value_from_g_argument(context, &value, type_info, &garg, TRUE))
+ if (!gjs_value_from_g_argument(context, &value, type_info, &garg, true))
goto out;
name = g_base_info_get_name((GIBaseInfo*) info);
@@ -432,7 +432,7 @@ _gjs_log_info_usage(GIBaseInfo *info)
details = g_strdup_printf(".details = { .func = { .retval_transfer = GI_TRANSFER_%s, .n_args =
%d, .args = %s } }",
TRANSFER_STRING(retval_transfer), n_args, args->str);
- g_string_free(args, TRUE);
+ g_string_free(args, true);
} else {
details = g_strdup_printf(".details = { .nothing = {} }");
}
@@ -454,13 +454,13 @@ bool
gjs_define_info(JSContext *context,
JSObject *in_object,
GIBaseInfo *info,
- gboolean *defined)
+ bool *defined)
{
#if GJS_VERBOSE_ENABLE_GI_USAGE
_gjs_log_info_usage(info);
#endif
- *defined = TRUE;
+ *defined = true;
switch (g_base_info_get_type(info)) {
case GI_INFO_TYPE_FUNCTION:
@@ -501,7 +501,7 @@ gjs_define_info(JSContext *context,
as static methods
*/
if (g_struct_info_is_gtype_struct((GIStructInfo*) info)) {
- *defined = FALSE;
+ *defined = false;
break;
}
/* Fall through */
@@ -722,25 +722,25 @@ gjs_camel_from_hyphen(const char *hyphen_name)
{
GString *s;
const char *p;
- gboolean next_upper;
+ bool next_upper;
s = g_string_sized_new(strlen(hyphen_name) + 1);
- next_upper = FALSE;
+ next_upper = false;
for (p = hyphen_name; *p; ++p) {
if (*p == '-' || *p == '_') {
- next_upper = TRUE;
+ next_upper = true;
} else {
if (next_upper) {
g_string_append_c(s, g_ascii_toupper(*p));
- next_upper = FALSE;
+ next_upper = false;
} else {
g_string_append_c(s, *p);
}
}
}
- return g_string_free(s, FALSE);
+ return g_string_free(s, false);
}
char*
@@ -761,7 +761,7 @@ gjs_hyphen_from_camel(const char *camel_name)
}
}
- return g_string_free(s, FALSE);
+ return g_string_free(s, false);
}
JSObject *
diff --git a/gi/repo.h b/gi/repo.h
index bddab55..0c08f60 100644
--- a/gi/repo.h
+++ b/gi/repo.h
@@ -51,7 +51,7 @@ JSObject * gjs_lookup_generic_prototype (JSContext *context,
bool gjs_define_info (JSContext *context,
JSObject *in_object,
GIBaseInfo *info,
- gboolean *defined);
+ bool *defined);
char* gjs_camel_from_hyphen (const char *hyphen_name);
char* gjs_hyphen_from_camel (const char *camel_name);
diff --git a/gi/value.cpp b/gi/value.cpp
index 8912b1e..4606eb4 100644
--- a/gi/value.cpp
+++ b/gi/value.cpp
@@ -44,7 +44,7 @@
static bool gjs_value_from_g_value_internal(JSContext *context,
jsval *value_p,
const GValue *gvalue,
- gboolean no_copy,
+ bool no_copy,
GSignalQuery *signal_query,
gint arg_n);
@@ -89,7 +89,7 @@ gjs_value_from_array_and_length_values(JSContext *context,
GITypeInfo *array_type_info,
const GValue *array_value,
const GValue *array_length_value,
- gboolean no_copy,
+ bool no_copy,
GSignalQuery *signal_query,
int array_length_arg_n)
{
@@ -127,7 +127,7 @@ closure_marshal(GClosure *closure,
int i;
GSignalQuery signal_query = { 0, };
GISignalInfo *signal_info;
- gboolean *skip;
+ bool *skip;
int *array_len_indices_for;
GITypeInfo **type_info_for;
int argv_index;
@@ -208,8 +208,8 @@ closure_marshal(GClosure *closure,
/* Check if any parameters, such as array lengths, need to be eliminated
* before we invoke the closure.
*/
- skip = g_newa(gboolean, argc);
- memset(skip, 0, sizeof (gboolean) * argc);
+ skip = g_newa(bool, argc);
+ memset(skip, 0, sizeof (bool) * argc);
array_len_indices_for = g_newa(int, argc);
for(i = 0; i < argc; i++)
array_len_indices_for[i] = -1;
@@ -228,7 +228,7 @@ closure_marshal(GClosure *closure,
array_len_pos = g_type_info_get_array_length(type_info_for[i]);
if (array_len_pos != -1) {
- skip[array_len_pos + 1] = TRUE;
+ skip[array_len_pos + 1] = true;
array_len_indices_for[i] = array_len_pos + 1;
}
@@ -241,14 +241,14 @@ closure_marshal(GClosure *closure,
argv_index = 0;
for (i = 0; i < argc; ++i) {
const GValue *gval = ¶m_values[i];
- gboolean no_copy;
+ bool no_copy;
int array_len_index;
bool res;
if (skip[i])
continue;
- no_copy = FALSE;
+ no_copy = false;
if (i >= 1 && signal_query.signal_id) {
no_copy = (signal_query.param_types[i - 1] & G_SIGNAL_TYPE_STATIC_SCOPE) != 0;
@@ -315,7 +315,7 @@ gjs_closure_new_for_signal(JSContext *context,
{
GClosure *closure;
- closure = gjs_closure_new(context, callable, description, FALSE);
+ closure = gjs_closure_new(context, callable, description, false);
g_closure_set_meta_marshal(closure, GUINT_TO_POINTER(signal_id), closure_marshal);
@@ -329,7 +329,7 @@ gjs_closure_new_marshaled (JSContext *context,
{
GClosure *closure;
- closure = gjs_closure_new(context, callable, description, TRUE);
+ closure = gjs_closure_new(context, callable, description, true);
g_closure_set_marshal(closure, closure_marshal);
@@ -365,7 +365,7 @@ static bool
gjs_value_to_g_value_internal(JSContext *context,
jsval value,
GValue *gvalue,
- gboolean no_copy)
+ bool no_copy)
{
GType gtype;
@@ -580,8 +580,8 @@ gjs_value_to_g_value_internal(JSContext *context,
NULL,
GJS_ARGUMENT_ARGUMENT,
GI_TRANSFER_NOTHING,
- TRUE, &arg))
- return FALSE;
+ true, &arg))
+ return false;
gboxed = arg.v_pointer;
}
@@ -761,7 +761,7 @@ gjs_value_to_g_value(JSContext *context,
jsval value,
GValue *gvalue)
{
- return gjs_value_to_g_value_internal(context, value, gvalue, FALSE);
+ return gjs_value_to_g_value_internal(context, value, gvalue, false);
}
bool
@@ -769,7 +769,7 @@ gjs_value_to_g_value_no_copy(JSContext *context,
jsval value,
GValue *gvalue)
{
- return gjs_value_to_g_value_internal(context, value, gvalue, TRUE);
+ return gjs_value_to_g_value_internal(context, value, gvalue, true);
}
static bool
@@ -802,7 +802,7 @@ static bool
gjs_value_from_g_value_internal(JSContext *context,
jsval *value_p,
const GValue *gvalue,
- gboolean no_copy,
+ bool no_copy,
GSignalQuery *signal_query,
gint arg_n)
{
@@ -850,7 +850,7 @@ gjs_value_from_g_value_internal(JSContext *context,
d = g_value_get_float(gvalue);
return JS_NewNumberValue(context, d, value_p);
} else if (gtype == G_TYPE_BOOLEAN) {
- gboolean v;
+ bool v;
v = g_value_get_boolean(gvalue);
*value_p = BOOLEAN_TO_JSVAL(!!v);
} else if (g_type_is_a(gtype, G_TYPE_OBJECT) || g_type_is_a(gtype, G_TYPE_INTERFACE)) {
@@ -890,10 +890,10 @@ gjs_value_from_g_value_internal(JSContext *context,
/* special case GError */
if (g_type_is_a(gtype, G_TYPE_ERROR)) {
- obj = gjs_error_from_gerror(context, (GError*) gboxed, FALSE);
+ obj = gjs_error_from_gerror(context, (GError*) gboxed, false);
*value_p = OBJECT_TO_JSVAL(obj);
- return TRUE;
+ return true;
}
/* The only way to differentiate unions and structs is from
@@ -979,7 +979,7 @@ gjs_value_from_g_value_internal(JSContext *context,
arg.v_pointer = g_value_get_pointer(gvalue);
- res = gjs_value_from_g_argument(context, value_p, &type_info, &arg, TRUE);
+ res = gjs_value_from_g_argument(context, value_p, &type_info, &arg, true);
g_base_info_unref((GIBaseInfo*)arg_info);
g_base_info_unref((GIBaseInfo*)signal_info);
@@ -1035,5 +1035,5 @@ gjs_value_from_g_value(JSContext *context,
jsval *value_p,
const GValue *gvalue)
{
- return gjs_value_from_g_value_internal(context, value_p, gvalue, FALSE, NULL, 0);
+ return gjs_value_from_g_value_internal(context, value_p, gvalue, false, NULL, 0);
}
diff --git a/gjs/byteArray.cpp b/gjs/byteArray.cpp
index db53b76..fe41bc7 100644
--- a/gjs/byteArray.cpp
+++ b/gjs/byteArray.cpp
@@ -348,8 +348,8 @@ gjs_g_byte_array_new(int preallocated_length)
* We nul-terminate too for ease of toString() and for security
* paranoia.
*/
- array = (GByteArray*) g_array_sized_new (TRUE, /* nul-terminated */
- TRUE, /* clear to zero */
+ array = (GByteArray*) g_array_sized_new (true, /* nul-terminated */
+ true, /* clear to zero */
1, /* element size */
preallocated_length);
if (preallocated_length > 0) {
@@ -401,7 +401,7 @@ byte_array_finalize(JSFreeOp *fop,
return; /* prototype, not instance */
if (priv->array) {
- g_byte_array_free(priv->array, TRUE);
+ g_byte_array_free(priv->array, true);
priv->array = NULL;
} else if (priv->bytes) {
g_clear_pointer(&priv->bytes, g_bytes_unref);
@@ -420,7 +420,7 @@ to_string_func(JSContext *context,
JSObject *object = JSVAL_TO_OBJECT(argv.thisv());
ByteArrayInstance *priv;
char *encoding;
- gboolean encoding_is_utf8;
+ bool encoding_is_utf8;
gchar *data;
priv = priv_from_js(context, object);
@@ -440,14 +440,14 @@ to_string_func(JSContext *context,
* just an optimization anyway.
*/
if (strcmp(encoding, "UTF-8") == 0) {
- encoding_is_utf8 = TRUE;
+ encoding_is_utf8 = true;
g_free(encoding);
encoding = NULL;
} else {
- encoding_is_utf8 = FALSE;
+ encoding_is_utf8 = false;
}
} else {
- encoding_is_utf8 = TRUE;
+ encoding_is_utf8 = true;
}
if (priv->array->len == 0)
@@ -581,7 +581,7 @@ from_string_func(JSContext *context,
JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
ByteArrayInstance *priv;
char *encoding;
- gboolean encoding_is_utf8;
+ bool encoding_is_utf8;
JSObject *obj;
bool retval = false;
@@ -614,14 +614,14 @@ from_string_func(JSContext *context,
* just an optimization anyway.
*/
if (strcmp(encoding, "UTF-8") == 0) {
- encoding_is_utf8 = TRUE;
+ encoding_is_utf8 = true;
g_free(encoding);
encoding = NULL;
} else {
- encoding_is_utf8 = FALSE;
+ encoding_is_utf8 = false;
}
} else {
- encoding_is_utf8 = TRUE;
+ encoding_is_utf8 = true;
}
if (encoding_is_utf8) {
@@ -761,7 +761,7 @@ from_gbytes_func(JSContext *context,
"bytes", &bytes_obj))
return false;
- if (!gjs_typecheck_boxed(context, bytes_obj, NULL, G_TYPE_BYTES, TRUE))
+ if (!gjs_typecheck_boxed(context, bytes_obj, NULL, G_TYPE_BYTES, true))
return false;
gbytes = (GBytes*) gjs_c_struct_from_boxed(context, bytes_obj);
diff --git a/gjs/console.cpp b/gjs/console.cpp
index 3d720c2..4b76348 100644
--- a/gjs/console.cpp
+++ b/gjs/console.cpp
@@ -47,7 +47,7 @@ static GOptionEntry entries[] = {
G_GNUC_NORETURN
static void
print_help (GOptionContext *context,
- gboolean main_help)
+ bool main_help)
{
gchar *help;
@@ -76,8 +76,8 @@ main(int argc, char **argv)
context = g_option_context_new(NULL);
/* pass unknown through to the JS script */
- g_option_context_set_ignore_unknown_options(context, TRUE);
- g_option_context_set_help_enabled(context, FALSE);
+ g_option_context_set_ignore_unknown_options(context, true);
+ g_option_context_set_help_enabled(context, false);
g_option_context_add_main_entries(context, entries, NULL);
if (!g_option_context_parse(context, &argc, &argv, &error))
@@ -85,9 +85,9 @@ main(int argc, char **argv)
if (argc >= 2) {
if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0)
- print_help(context, TRUE);
+ print_help(context, true);
else if (strcmp(argv[1], "--help-all") == 0)
- print_help(context, FALSE);
+ print_help(context, false);
}
g_option_context_free (context);
diff --git a/gjs/context-private.h b/gjs/context-private.h
index 1d4e6e0..98adddb 100644
--- a/gjs/context-private.h
+++ b/gjs/context-private.h
@@ -29,7 +29,7 @@
G_BEGIN_DECLS
-gboolean _gjs_context_destroying (GjsContext *js_context);
+bool _gjs_context_destroying (GjsContext *js_context);
void _gjs_context_schedule_gc_if_needed (GjsContext *js_context);
diff --git a/gjs/context.cpp b/gjs/context.cpp
index e120622..d670b62 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -67,7 +67,7 @@ struct _GjsContext {
char **search_path;
- gboolean destroying;
+ bool destroying;
guint auto_gc_id;
@@ -211,7 +211,7 @@ gjs_print_parse_args(JSContext *context,
if (jstr != NULL) {
if (!gjs_string_to_utf8(context, STRING_TO_JSVAL(jstr), &s)) {
JS_EndRequest(context);
- g_string_free(str, TRUE);
+ g_string_free(str, true);
return false;
}
@@ -221,14 +221,14 @@ gjs_print_parse_args(JSContext *context,
g_string_append_c(str, ' ');
} else {
JS_EndRequest(context);
- *buffer = g_string_free(str, TRUE);
+ *buffer = g_string_free(str, true);
if (!*buffer)
*buffer = g_strdup("<invalid string>");
return true;
}
}
- *buffer = g_string_free(str, FALSE);
+ *buffer = g_string_free(str, false);
JS_EndRequest(context);
return true;
@@ -243,7 +243,7 @@ gjs_print(JSContext *context,
char *buffer;
if (!gjs_print_parse_args(context, argv, &buffer)) {
- return FALSE;
+ return false;
}
g_print("%s\n", buffer);
@@ -262,7 +262,7 @@ gjs_printerr(JSContext *context,
char *buffer;
if (!gjs_print_parse_args(context, argv, &buffer)) {
- return FALSE;
+ return false;
}
g_printerr("%s\n", buffer);
@@ -349,7 +349,7 @@ gjs_context_dispose(GObject *object)
JS_GC(js_context->runtime);
JS_EndRequest(js_context->context);
- js_context->destroying = TRUE;
+ js_context->destroying = true;
/* Now, release all native objects, to avoid recursion between
* the JS teardown and the C teardown. The JSObject proxies
@@ -450,7 +450,7 @@ gjs_context_constructed(GObject *object)
js_context->search_path ?
(const char**) js_context->search_path :
NULL,
- TRUE))
+ true))
g_error("Failed to create root importer");
/* Now copy the global root importer (which we just created,
@@ -525,7 +525,7 @@ gjs_context_new_with_search_path(char** search_path)
NULL);
}
-gboolean
+bool
_gjs_context_destroying (GjsContext *context)
{
return context->destroying;
@@ -537,7 +537,7 @@ trigger_gc_if_needed (gpointer user_data)
GjsContext *js_context = GJS_CONTEXT(user_data);
js_context->auto_gc_id = 0;
gjs_gc_if_needed(js_context->context);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
void
@@ -626,7 +626,7 @@ gjs_context_get_native_context (GjsContext *js_context)
return js_context->context;
}
-gboolean
+bool
gjs_context_eval(GjsContext *js_context,
const char *script,
gssize script_len,
@@ -634,7 +634,7 @@ gjs_context_eval(GjsContext *js_context,
int *exit_status_p,
GError **error)
{
- gboolean ret = FALSE;
+ bool ret = false;
jsval retval;
JSAutoCompartment ac(js_context->context, js_context->global);
@@ -665,14 +665,14 @@ gjs_context_eval(GjsContext *js_context,
}
}
- ret = TRUE;
+ ret = true;
out:
g_object_unref(G_OBJECT(js_context));
return ret;
}
-gboolean
+bool
gjs_context_eval_file(GjsContext *js_context,
const char *filename,
int *exit_status_p,
@@ -680,22 +680,22 @@ gjs_context_eval_file(GjsContext *js_context,
{
char *script = NULL;
gsize script_len;
- gboolean ret = TRUE;
+ bool ret = true;
GFile *file = g_file_new_for_commandline_arg(filename);
if (!g_file_query_exists(file, NULL)) {
- ret = FALSE;
+ ret = false;
goto out;
}
if (!g_file_load_contents(file, NULL, &script, &script_len, NULL, error)) {
- ret = FALSE;
+ ret = false;
goto out;
}
if (!gjs_context_eval(js_context, script, script_len, filename, exit_status_p, error)) {
- ret = FALSE;
+ ret = false;
goto out;
}
@@ -705,7 +705,7 @@ out:
return ret;
}
-gboolean
+bool
gjs_context_define_string_array(GjsContext *js_context,
const char *array_name,
gssize array_length,
@@ -722,10 +722,10 @@ gjs_context_define_string_array(GjsContext *js_context,
GJS_ERROR,
GJS_ERROR_FAILED,
"gjs_define_string_array() failed");
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
static GjsContext *current_context;
@@ -752,7 +752,7 @@ gjs_context_get_const_string(JSContext *context,
return gjs_context->const_strings[name];
}
-gboolean
+bool
gjs_object_get_property_const(JSContext *context,
JSObject *obj,
GjsConstString property_name,
diff --git a/gjs/context.h b/gjs/context.h
index ccd8bc6..880a373 100644
--- a/gjs/context.h
+++ b/gjs/context.h
@@ -46,17 +46,17 @@ GType gjs_context_get_type (void) G_GNUC_CONST;
GjsContext* gjs_context_new (void);
GjsContext* gjs_context_new_with_search_path (char **search_path);
-gboolean gjs_context_eval_file (GjsContext *js_context,
+bool gjs_context_eval_file (GjsContext *js_context,
const char *filename,
int *exit_status_p,
GError **error);
-gboolean gjs_context_eval (GjsContext *js_context,
+bool gjs_context_eval (GjsContext *js_context,
const char *script,
gssize script_len,
const char *filename,
int *exit_status_p,
GError **error);
-gboolean gjs_context_define_string_array (GjsContext *js_context,
+bool gjs_context_define_string_array (GjsContext *js_context,
const char *array_name,
gssize array_length,
const char **array_values,
diff --git a/gjs/coverage-internal.h b/gjs/coverage-internal.h
index 8533642..2a57b2a 100644
--- a/gjs/coverage-internal.h
+++ b/gjs/coverage-internal.h
@@ -37,18 +37,18 @@ GBytes * gjs_serialize_statistics(GjsCoverage *coverage);
JSString * gjs_deserialize_cache_to_object(GjsCoverage *coverage,
GBytes *cache_bytes);
-gboolean gjs_run_script_in_coverage_compartment(GjsCoverage *coverage,
- const char *script);
-gboolean gjs_inject_value_into_coverage_compartment(GjsCoverage *coverage,
- JS::HandleValue value,
- const char *property);
-
-gboolean gjs_get_path_mtime(const char *path,
- GTimeVal *mtime);
+bool gjs_run_script_in_coverage_compartment(GjsCoverage *coverage,
+ const char *script);
+bool gjs_inject_value_into_coverage_compartment(GjsCoverage *coverage,
+ JS::HandleValue value,
+ const char *property);
+
+bool gjs_get_path_mtime(const char *path,
+ GTimeVal *mtime);
gchar * gjs_get_path_checksum(const char *path);
-gboolean gjs_write_cache_to_path(const char *path,
- GBytes *cache_bytes);
+bool gjs_write_cache_to_path(const char *path,
+ GBytes *cache_bytes);
extern const char *GJS_COVERAGE_CACHE_FILE_NAME;
diff --git a/gjs/coverage.cpp b/gjs/coverage.cpp
index ce7b146..e44a14e 100644
--- a/gjs/coverage.cpp
+++ b/gjs/coverage.cpp
@@ -57,7 +57,7 @@ typedef struct _GjsCoverageBranchExit {
typedef struct _GjsCoverageBranch {
GArray *exits;
unsigned int point;
- gboolean hit;
+ bool hit;
} GjsCoverageBranch;
typedef struct _GjsCoverageFunction {
@@ -156,7 +156,7 @@ typedef struct _WriteAlternativeData {
unsigned int *n_branch_alternatives_hit;
GOutputStream *output_stream;
gpointer *all_alternatives;
- gboolean branch_point_was_hit;
+ bool branch_point_was_hit;
} WriteAlternativeData;
typedef struct _WriteBranchInfoData {
@@ -389,11 +389,11 @@ get_absolute_path(const char *path)
return absolute_path;
}
-typedef gboolean (*ConvertAndInsertJSVal) (GArray *array,
- JSContext *context,
- jsval *element);
+typedef bool (*ConvertAndInsertJSVal) (GArray *array,
+ JSContext *context,
+ jsval *element);
-static gboolean
+static bool
get_array_from_js_value(JSContext *context,
jsval *value,
size_t array_element_size,
@@ -401,20 +401,20 @@ get_array_from_js_value(JSContext *context,
ConvertAndInsertJSVal inserter,
GArray **out_array)
{
- g_return_val_if_fail(out_array != NULL, FALSE);
- g_return_val_if_fail(*out_array == NULL, FALSE);
+ g_return_val_if_fail(out_array != NULL, false);
+ g_return_val_if_fail(*out_array == NULL, false);
JSObject *js_array = JSVAL_TO_OBJECT(*value);
if (!JS_IsArrayObject(context, js_array)) {
g_critical("Returned object from is not an array");
- return FALSE;
+ return false;
}
/* We're not preallocating any space here at the moment until
* we have some profiling data that suggests a good size to
* preallocate to. */
- GArray *c_side_array = g_array_new(TRUE, TRUE, array_element_size);
+ GArray *c_side_array = g_array_new(true, true, array_element_size);
u_int32_t js_array_len;
if (element_clear_func)
@@ -427,23 +427,23 @@ get_array_from_js_value(JSContext *context,
if (!JS_GetElement(context, js_array, i, &element)) {
g_array_unref(c_side_array);
gjs_throw(context, "Failed to get function names array element %d", i);
- return FALSE;
+ return false;
}
if (!(inserter(c_side_array, context, &element))) {
g_array_unref(c_side_array);
gjs_throw(context, "Failed to convert array element %d", i);
- return FALSE;
+ return false;
}
}
}
*out_array = c_side_array;
- return TRUE;
+ return true;
}
-static gboolean
+static bool
convert_and_insert_unsigned_int(GArray *array,
JSContext *context,
jsval *element)
@@ -452,7 +452,7 @@ convert_and_insert_unsigned_int(GArray *array,
!JSVAL_IS_VOID(*element) &&
!JSVAL_IS_NULL(*element)) {
g_critical("Array element is not an integer or undefined or null");
- return FALSE;
+ return false;
}
if (JSVAL_IS_INT(*element)) {
@@ -463,7 +463,7 @@ convert_and_insert_unsigned_int(GArray *array,
g_array_append_val(array, not_executable);
}
- return TRUE;
+ return true;
}
static GArray *
@@ -505,7 +505,7 @@ clear_coverage_function(gpointer info_location)
g_free(info->key);
}
-static gboolean
+static bool
convert_and_insert_function_decl(GArray *array,
JSContext *context,
jsval *element)
@@ -514,14 +514,14 @@ convert_and_insert_function_decl(GArray *array,
if (!object) {
gjs_throw(context, "Converting element to object failed");
- return FALSE;
+ return false;
}
jsval function_name_property_value;
if (!JS_GetProperty(context, object, "name", &function_name_property_value)) {
gjs_throw(context, "Failed to get name property for function object");
- return FALSE;
+ return false;
}
char *utf8_string;
@@ -531,27 +531,27 @@ convert_and_insert_function_decl(GArray *array,
function_name_property_value,
&utf8_string)) {
gjs_throw(context, "Failed to convert function_name to string");
- return FALSE;
+ return false;
}
} else if (JSVAL_IS_NULL(function_name_property_value)) {
utf8_string = NULL;
} else {
gjs_throw(context, "Unexpected type for function_name");
- return FALSE;
+ return false;
}
jsval hit_count_property_value;
if (!JS_GetProperty(context, object, "hitCount", &hit_count_property_value) ||
!JSVAL_IS_INT(hit_count_property_value)) {
gjs_throw(context, "Failed to get hitCount property for function object");
- return FALSE;
+ return false;
}
jsval line_number_property_value;
if (!JS_GetProperty(context, object, "line", &line_number_property_value) ||
!JSVAL_IS_INT(line_number_property_value)) {
gjs_throw(context, "Failed to get line property for function object");
- return FALSE;
+ return false;
}
unsigned int line_number = JSVAL_TO_INT(line_number_property_value);
@@ -565,7 +565,7 @@ convert_and_insert_function_decl(GArray *array,
g_array_append_val(array, info);
- return TRUE;
+ return true;
}
static GArray *
@@ -607,21 +607,21 @@ clear_coverage_branch(gpointer branch_location)
g_array_unref(branch->exits);
}
-static gboolean
+static bool
convert_and_insert_branch_exit(GArray *array,
JSContext *context,
jsval *element)
{
if (!JSVAL_IS_OBJECT(*element)) {
gjs_throw(context, "Branch exit array element is not an object");
- return FALSE;
+ return false;
}
JSObject *object = JSVAL_TO_OBJECT(*element);
if (!object) {
gjs_throw(context, "Converting element to object failed");
- return FALSE;
+ return false;
}
jsval line_value;
@@ -630,7 +630,7 @@ convert_and_insert_branch_exit(GArray *array,
if (!JS_GetProperty(context, object, "line", &line_value) ||
!JSVAL_IS_INT(line_value)) {
gjs_throw(context, "Failed to get line property from element");
- return FALSE;
+ return false;
}
line = JSVAL_TO_INT(line_value);
@@ -641,7 +641,7 @@ convert_and_insert_branch_exit(GArray *array,
if (!JS_GetProperty(context, object, "hitCount", &hit_count_value) ||
!JSVAL_IS_INT(hit_count_value)) {
gjs_throw(context, "Failed to get hitCount property from element");
- return FALSE;
+ return false;
}
hit_count = JSVAL_TO_INT(hit_count_value);
@@ -653,10 +653,10 @@ convert_and_insert_branch_exit(GArray *array,
g_array_append_val(array, exit);
- return TRUE;
+ return true;
}
-static gboolean
+static bool
convert_and_insert_branch_info(GArray *array,
JSContext *context,
jsval *element)
@@ -664,7 +664,7 @@ convert_and_insert_branch_info(GArray *array,
if (!JSVAL_IS_OBJECT(*element) &&
!JSVAL_IS_VOID(*element)) {
gjs_throw(context, "Branch array element is not an object or undefined");
- return FALSE;
+ return false;
}
if (JSVAL_IS_OBJECT(*element)) {
@@ -672,7 +672,7 @@ convert_and_insert_branch_info(GArray *array,
if (!object) {
gjs_throw(context, "Converting element to object failed");
- return FALSE;
+ return false;
}
jsval branch_point_value;
@@ -681,7 +681,7 @@ convert_and_insert_branch_info(GArray *array,
if (!JS_GetProperty(context, object, "point", &branch_point_value) ||
!JSVAL_IS_INT(branch_point_value)) {
gjs_throw(context, "Failed to get point property from element");
- return FALSE;
+ return false;
}
branch_point = JSVAL_TO_INT(branch_point_value);
@@ -692,7 +692,7 @@ convert_and_insert_branch_info(GArray *array,
if (!JS_GetProperty(context, object, "hit", &was_hit_value) ||
!JSVAL_IS_BOOLEAN(was_hit_value)) {
gjs_throw(context, "Failed to get point property from element");
- return FALSE;
+ return false;
}
was_hit = JSVAL_TO_BOOLEAN(was_hit_value);
@@ -703,7 +703,7 @@ convert_and_insert_branch_info(GArray *array,
if (!JS_GetProperty(context, object, "exits", &branch_exits_value) ||
!JSVAL_IS_OBJECT(branch_exits_value)) {
gjs_throw(context, "Failed to get exits property from element");
- return FALSE;
+ return false;
}
if (!get_array_from_js_value(context,
@@ -713,7 +713,7 @@ convert_and_insert_branch_info(GArray *array,
convert_and_insert_branch_exit,
&branch_exits_array)) {
/* Already logged the exception, no need to do anything here */
- return FALSE;
+ return false;
}
GjsCoverageBranch branch;
@@ -725,7 +725,7 @@ convert_and_insert_branch_info(GArray *array,
g_array_append_val(array, branch);
}
- return TRUE;
+ return true;
}
static GArray *
@@ -756,7 +756,7 @@ typedef struct _GjsCoverageFileStatistics {
GArray *branches;
} GjsCoverageFileStatistics;
-static gboolean
+static bool
fetch_coverage_file_statistics_from_js(JSContext *context,
JS::HandleObject coverage_statistics,
const char *filename,
@@ -777,7 +777,7 @@ fetch_coverage_file_statistics_from_js(JSContext *context,
g_clear_pointer(&lines, g_array_unref);
g_clear_pointer(&functions, g_array_unref);
g_clear_pointer(&branches, g_array_unref);
- return FALSE;
+ return false;
}
statistics->filename = g_strdup(filename);
@@ -785,7 +785,7 @@ fetch_coverage_file_statistics_from_js(JSContext *context,
statistics->functions = functions;
statistics->branches = branches;
- return TRUE;
+ return true;
}
static void
@@ -901,7 +901,7 @@ get_covered_files(GjsCoverage *coverage)
return NULL;
}
-gboolean
+bool
gjs_get_path_mtime(const char *path, GTimeVal *mtime)
{
/* path could be a resource path, as the callers don't check
@@ -923,7 +923,7 @@ gjs_get_path_mtime(const char *path, GTimeVal *mtime)
"falling back to checksum method for caching. Reason was: %s",
path, error->message);
g_clear_object(&info);
- return FALSE;
+ return false;
}
g_file_info_get_modification_time(info, mtime);
@@ -932,8 +932,8 @@ gjs_get_path_mtime(const char *path, GTimeVal *mtime)
/* For some URI types, eg, resources, the operation getting
* the mtime might succeed, but by default zero is returned.
*
- * Check if that is the case for boht tv_sec and tv_usec and if
- * so return FALSE. */
+ * Check if that is the case for both tv_sec and tv_usec and if
+ * so return false. */
return !(mtime->tv_sec == 0 && mtime->tv_usec == 0);
}
@@ -1127,8 +1127,8 @@ gjs_fetch_statistics_from_js(GjsCoverage *coverage,
GjsCoveragePrivate *priv = (GjsCoveragePrivate *) gjs_coverage_get_instance_private(coverage);
JSContext *js_context = (JSContext *) gjs_context_get_native_context(priv->context);
- GArray *file_statistics_array = g_array_new(FALSE,
- FALSE,
+ GArray *file_statistics_array = g_array_new(false,
+ false,
sizeof(GjsCoverageFileStatistics));
g_array_set_clear_func(file_statistics_array,
gjs_coverage_statistics_file_statistics_clear);
@@ -1154,7 +1154,7 @@ gjs_fetch_statistics_from_js(GjsCoverage *coverage,
return file_statistics_array;
}
-gboolean
+bool
gjs_write_cache_to_path(const char *path,
GBytes *cache)
{
@@ -1167,7 +1167,7 @@ gjs_write_cache_to_path(const char *path,
cache_data,
cache_len,
NULL,
- FALSE,
+ false,
G_FILE_CREATE_NONE,
NULL,
NULL,
@@ -1186,12 +1186,12 @@ gjs_write_cache_to_path(const char *path,
g_clear_error(&error);
}
- return FALSE;
+ return false;
}
g_object_unref(file);
- return TRUE;
+ return true;
}
static bool
@@ -1265,8 +1265,8 @@ gjs_coverage_write_statistics(GjsCoverage *coverage,
g_strfreev(executed_coverage_files);
- const gboolean has_cache_path = priv->cache_path != NULL;
- const gboolean cache_is_stale = coverage_statistics_has_stale_cache(coverage);
+ const bool has_cache_path = priv->cache_path != NULL;
+ const bool cache_is_stale = coverage_statistics_has_stale_cache(coverage);
if (has_cache_path && cache_is_stale) {
GBytes *cache_data = gjs_serialize_statistics(coverage);
@@ -1301,7 +1301,7 @@ static JSClass coverage_global_class = {
{ NULL }
};
-static gboolean
+static bool
gjs_context_eval_file_in_compartment(GjsContext *context,
const char *filename,
JSObject *compartment_object,
@@ -1319,7 +1319,7 @@ gjs_context_eval_file_in_compartment(GjsContext *context,
NULL,
error)) {
g_object_unref(file);
- return FALSE;
+ return false;
}
g_object_unref(file);
@@ -1338,12 +1338,12 @@ gjs_context_eval_file_in_compartment(GjsContext *context,
gjs_log_exception(js_context);
g_free(script);
g_set_error(error, GJS_ERROR, GJS_ERROR_FAILED, "Failed to evaluate %s", filename);
- return FALSE;
+ return false;
}
g_free(script);
- return TRUE;
+ return true;
}
static JSBool
@@ -1545,7 +1545,7 @@ coverage_statistics_tracer(JSTracer *trc, void *data)
/* This function is mainly used in the tests in order to fiddle with
* the internals of the coverage statisics collector on the coverage
* compartment side */
-gboolean
+bool
gjs_run_script_in_coverage_compartment(GjsCoverage *coverage,
const char *script)
{
@@ -1561,13 +1561,13 @@ gjs_run_script_in_coverage_compartment(GjsCoverage *coverage,
&rval)) {
gjs_log_exception(js_context);
g_warning("Failed to evaluate <coverage_modifier>");
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-gboolean
+bool
gjs_inject_value_into_coverage_compartment(GjsCoverage *coverage,
JS::HandleValue handle_value,
const char *property)
@@ -1584,10 +1584,10 @@ gjs_inject_value_into_coverage_compartment(GjsCoverage *coverage,
jsval value = handle_value;
if (!JS_SetProperty(js_context, coverage_global_scope, property, &value)) {
g_warning("Failed to set property %s to requested value", property);
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
/* Gets the root import and wraps it into a cross-compartment
@@ -1613,7 +1613,7 @@ gjs_wrap_root_importer_in_compartment(JSContext *context,
return wrapped_importer;
}
-static gboolean
+static bool
bootstrap_coverage(GjsCoverage *coverage)
{
static const char *coverage_script = "resource:///org/gnome/gjs/modules/coverage.js";
@@ -1634,28 +1634,28 @@ bootstrap_coverage(GjsCoverage *coverage)
JS::RootedObject debuggeeWrapper(context, debuggee);
if (!JS_WrapObject(context, debuggeeWrapper.address())) {
gjs_throw(context, "Failed to wrap debugeee");
- return FALSE;
+ return false;
}
JS::RootedValue debuggeeWrapperValue(context, JS::ObjectValue(*debuggeeWrapper));
if (!JS_SetProperty(context, debugger_compartment, "debuggee", debuggeeWrapperValue.address())) {
gjs_throw(context, "Failed to set debuggee property");
- return FALSE;
+ return false;
}
if (!JS_InitStandardClasses(context, debugger_compartment)) {
gjs_throw(context, "Failed to init standard classes");
- return FALSE;
+ return false;
}
if (!JS_InitReflect(context, debugger_compartment)) {
gjs_throw(context, "Failed to init Reflect");
- return FALSE;
+ return false;
}
if (!JS_DefineDebuggerObject(context, debugger_compartment)) {
gjs_throw(context, "Failed to init Debugger");
- return FALSE;
+ return false;
}
JS::RootedObject wrapped_importer(JS_GetRuntime(context),
@@ -1664,7 +1664,7 @@ bootstrap_coverage(GjsCoverage *coverage)
if (!wrapped_importer) {
gjs_throw(context, "Failed to wrap root importer in debugger compartment");
- return FALSE;
+ return false;
}
/* Now copy the global root importer (which we just created,
@@ -1672,7 +1672,7 @@ bootstrap_coverage(GjsCoverage *coverage)
*/
if (!gjs_define_root_importer_object(context, debugger_compartment, wrapped_importer)) {
gjs_throw(context, "Failed to set 'imports' on debugger compartment");
- return FALSE;
+ return false;
}
if (!JS_DefineFunctions(context, debugger_compartment, &coverage_funcs[0]))
@@ -1688,7 +1688,7 @@ bootstrap_coverage(GjsCoverage *coverage)
if (!JS_GetProperty(context, debugger_compartment, "CoverageStatistics",
&coverage_statistics_prototype_value) ||
!JSVAL_IS_OBJECT(coverage_statistics_prototype_value)) {
gjs_throw(context, "Failed to get CoverageStatistics prototype");
- return FALSE;
+ return false;
}
/* Create value for holding the cache. This will be undefined if
@@ -1726,7 +1726,7 @@ bootstrap_coverage(GjsCoverage *coverage)
if (!coverage_statistics) {
gjs_throw(context, "Failed to create coverage_statitiscs object");
- return FALSE;
+ return false;
}
/* Add a tracer, as suggested by jdm on #jsapi */
@@ -1737,7 +1737,7 @@ bootstrap_coverage(GjsCoverage *coverage)
priv->coverage_statistics = coverage_statistics;
}
- return TRUE;
+ return true;
}
static void
diff --git a/gjs/importer.cpp b/gjs/importer.cpp
index d3cf464..efc8c2d 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -39,7 +39,7 @@
static char **gjs_search_path = NULL;
typedef struct {
- gboolean is_root;
+ bool is_root;
} Importer;
typedef struct {
@@ -58,7 +58,7 @@ define_meta_properties(JSContext *context,
const char *module_name,
JSObject *parent)
{
- gboolean parent_is_module;
+ bool parent_is_module;
/* We define both __moduleName__ and __parentModule__ to null
* on the root importer
@@ -121,7 +121,7 @@ import_directory(JSContext *context,
* its search path. gjs_define_importer() exits if it fails, so
* this always succeeds.
*/
- importer = gjs_define_importer(context, obj, name, full_paths, FALSE);
+ importer = gjs_define_importer(context, obj, name, full_paths, false);
return importer != NULL;
}
@@ -230,7 +230,7 @@ import_native_file(JSContext *context,
/* I am not sure whether this can happen, but if it does we want to trap it.
*/
gjs_debug(GJS_DEBUG_IMPORTER,
- "Module '%s' reported an exception but gjs_import_native_module() returned TRUE",
+ "Module '%s' reported an exception but gjs_import_native_module() returned true",
name);
goto out;
}
@@ -426,7 +426,7 @@ do_import(JSContext *context,
GPtrArray *directories;
jsid search_path_name;
GFile *gfile;
- gboolean exists;
+ bool exists;
search_path_name = gjs_context_get_const_string(context, GJS_STRING_SEARCH_PATH);
if (!gjs_object_require_property(context, obj, "importer", search_path_name, &search_path_val)) {
@@ -604,7 +604,7 @@ do_import(JSContext *context,
g_ptr_array_add(directories, NULL);
str_array = (char**) directories->pdata;
- g_ptr_array_free(directories, FALSE);
+ g_ptr_array_free(directories, false);
g_strfreev(str_array);
}
@@ -640,7 +640,7 @@ static void
importer_iterator_free(ImporterIterator *iter)
{
g_ptr_array_foreach(iter->elements, (GFunc)g_free, NULL);
- g_ptr_array_free(iter->elements, TRUE);
+ g_ptr_array_free(iter->elements, true);
g_slice_free(ImporterIterator, iter);
}
@@ -935,7 +935,7 @@ JSFunctionSpec gjs_importer_proto_funcs[] = {
static JSObject*
importer_new(JSContext *context,
- gboolean is_root)
+ bool is_root)
{
JSObject *importer;
Importer *priv;
@@ -1039,7 +1039,7 @@ gjs_get_search_path(void)
g_ptr_array_add(path, NULL);
- search_path = (char**)g_ptr_array_free(path, FALSE);
+ search_path = (char**)g_ptr_array_free(path, false);
gjs_search_path = search_path;
} else {
@@ -1053,8 +1053,8 @@ static JSObject*
gjs_create_importer(JSContext *context,
const char *importer_name,
const char **initial_search_path,
- gboolean add_standard_search_path,
- gboolean is_root,
+ bool add_standard_search_path,
+ bool is_root,
JSObject *in_object)
{
JSObject *importer;
@@ -1091,12 +1091,13 @@ gjs_define_importer(JSContext *context,
JSObject *in_object,
const char *importer_name,
const char **initial_search_path,
- gboolean add_standard_search_path)
+ bool add_standard_search_path)
{
JSObject *importer;
- importer = gjs_create_importer(context, importer_name, initial_search_path, add_standard_search_path,
FALSE, in_object);
+ importer = gjs_create_importer(context, importer_name, initial_search_path,
+ add_standard_search_path, false, in_object);
if (!JS_DefineProperty(context, in_object,
importer_name, OBJECT_TO_JSVAL(importer),
@@ -1117,7 +1118,7 @@ gjs_define_importer(JSContext *context,
bool
gjs_create_root_importer(JSContext *context,
const char **initial_search_path,
- gboolean add_standard_search_path)
+ bool add_standard_search_path)
{
jsval importer;
@@ -1136,7 +1137,7 @@ gjs_create_root_importer(JSContext *context,
importer = OBJECT_TO_JSVAL(gjs_create_importer(context, "imports",
initial_search_path,
add_standard_search_path,
- TRUE, NULL));
+ true, NULL));
gjs_set_global_slot(context, GJS_GLOBAL_SLOT_IMPORTS, importer);
JS_EndRequest(context);
diff --git a/gjs/importer.h b/gjs/importer.h
index dc3bf4b..2b28c6e 100644
--- a/gjs/importer.h
+++ b/gjs/importer.h
@@ -35,7 +35,7 @@ G_BEGIN_DECLS
bool gjs_create_root_importer (JSContext *context,
const char **initial_search_path,
- gboolean add_standard_search_path);
+ bool add_standard_search_path);
bool gjs_define_root_importer (JSContext *context,
JSObject *in_object);
bool gjs_define_root_importer_object(JSContext *context,
@@ -45,7 +45,7 @@ JSObject* gjs_define_importer (JSContext *context,
JSObject *in_object,
const char *importer_name,
const char **initial_search_path,
- gboolean add_standard_search_path);
+ bool add_standard_search_path);
G_END_DECLS
diff --git a/gjs/jsapi-util-array.cpp b/gjs/jsapi-util-array.cpp
index 5aa357e..7f19fcf 100644
--- a/gjs/jsapi-util-array.cpp
+++ b/gjs/jsapi-util-array.cpp
@@ -47,8 +47,8 @@ gjs_rooted_array_new()
GArray *array;
/* we prealloc ARRAY_MAX_LEN to avoid realloc */
- array = g_array_sized_new(FALSE, /* zero-terminated */
- FALSE, /* clear */
+ array = g_array_sized_new(false, /* zero-terminated */
+ false, /* clear */
sizeof(jsval), /* element size */
ARRAY_MAX_LEN); /* reserved size */
@@ -263,7 +263,7 @@ gjs_set_values(JSContext *context,
* @free_segment: whether or not to free and unroot the internal jsval array
*
* Frees the memory allocated for the #GjsRootedArray. If @free_segment is
- * %TRUE the internal memory block allocated for the jsval array will
+ * true the internal memory block allocated for the jsval array will
* be freed and unrooted also.
*
* Returns: the jsval array if it was not freed
@@ -271,7 +271,7 @@ gjs_set_values(JSContext *context,
jsval*
gjs_rooted_array_free(JSContext *context,
GjsRootedArray *array,
- gboolean free_segment)
+ bool free_segment)
{
GArray *garray;
diff --git a/gjs/jsapi-util-error.cpp b/gjs/jsapi-util-error.cpp
index d403ce9..46609e6 100644
--- a/gjs/jsapi-util-error.cpp
+++ b/gjs/jsapi-util-error.cpp
@@ -178,7 +178,7 @@ gjs_throw_g_error (JSContext *context,
JS_BeginRequest(context);
- err_obj = gjs_error_from_gerror(context, error, TRUE);
+ err_obj = gjs_error_from_gerror(context, error, true);
g_error_free (error);
if (err_obj)
JS_SetPendingException(context, OBJECT_TO_JSVAL(err_obj));
diff --git a/gjs/jsapi-util-string.cpp b/gjs/jsapi-util-string.cpp
index b09518b..ab9f3a5 100644
--- a/gjs/jsapi-util-string.cpp
+++ b/gjs/jsapi-util-string.cpp
@@ -28,7 +28,7 @@
#include "jsapi-util.h"
#include "compat.h"
-gboolean
+JSBool
gjs_string_to_utf8 (JSContext *context,
const jsval value,
char **utf8_string_p)
@@ -106,7 +106,7 @@ gjs_string_from_utf8(JSContext *context,
return str != NULL;
}
-gboolean
+JSBool
gjs_string_to_filename(JSContext *context,
const jsval filename_val,
char **filename_string_p)
@@ -126,12 +126,12 @@ gjs_string_to_filename(JSContext *context,
if (!filename_string) {
gjs_throw_g_error(context, error);
g_free(tmp);
- return FALSE;
+ return false;
}
*filename_string_p = filename_string;
g_free(tmp);
- return TRUE;
+ return true;
}
bool
@@ -248,7 +248,7 @@ gjs_get_string_id (JSContext *context,
* If @string is empty, @result will be 0. An exception will
* be thrown if @string can not be represented as UTF-8.
*/
-gboolean
+bool
gjs_unichar_from_string (JSContext *context,
jsval value,
gunichar *result)
@@ -257,9 +257,9 @@ gjs_unichar_from_string (JSContext *context,
if (gjs_string_to_utf8(context, value, &utf8_str)) {
*result = g_utf8_get_char(utf8_str);
g_free(utf8_str);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
jsid
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 99cd36a..3bdbfd3 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -60,9 +60,9 @@ static JSClass global_class = {
* This function creates a global object given the context,
* and initializes it with the default API.
*
- * Returns: %TRUE on success, %FALSE otherwise
+ * Returns: true on success, false otherwise
*/
-gboolean
+bool
gjs_init_context_standard (JSContext *context,
JSObject **global_out)
{
@@ -94,23 +94,23 @@ gjs_init_context_standard (JSContext *context,
options.setVersion(JSVERSION_LATEST);
global = JS_NewGlobalObject(context, &global_class, NULL, options);
if (global == NULL)
- return FALSE;
+ return false;
/* Set the context's global */
JSAutoCompartment ac(context, global);
if (!JS_InitStandardClasses(context, global))
- return FALSE;
+ return false;
if (!JS_InitReflect(context, global))
- return FALSE;
+ return false;
if (!JS_DefineDebuggerObject(context, global))
- return FALSE;
+ return false;
*global_out = global;
- return TRUE;
+ return true;
}
void
@@ -140,7 +140,7 @@ gjs_get_global_slot (JSContext *context,
*
* Requires request.
*/
-gboolean
+bool
gjs_object_require_property(JSContext *context,
JSObject *obj,
const char *obj_description,
@@ -223,7 +223,7 @@ gjs_build_string_array(JSContext *context,
if (array_length == -1)
array_length = g_strv_length(array_values);
- elems = g_array_sized_new(FALSE, FALSE, sizeof(jsval), array_length);
+ elems = g_array_sized_new(false, false, sizeof(jsval), array_length);
for (i = 0; i < array_length; ++i) {
jsval element;
@@ -232,7 +232,7 @@ gjs_build_string_array(JSContext *context,
}
array = JS_NewArrayObject(context, elems->len, (jsval*) elems->data);
- g_array_free(elems, TRUE);
+ g_array_free(elems, true);
return array;
}
@@ -303,7 +303,7 @@ gjs_string_readable (JSContext *context,
JS_EndRequest(context);
- return g_string_free(buf, FALSE);
+ return g_string_free(buf, false);
}
/**
@@ -468,7 +468,7 @@ gjs_explain_scope(JSContext *context,
gjs_debug(GJS_DEBUG_SCOPE,
" Chain: %s",
chain->str);
- g_string_free(chain, TRUE);
+ g_string_free(chain, true);
JS_EndRequest(context);
}
@@ -481,14 +481,14 @@ gjs_log_exception_full(JSContext *context,
jsval stack;
JSString *exc_str;
char *utf8_exception, *utf8_message;
- gboolean is_syntax;
+ bool is_syntax;
JS_BeginRequest(context);
- is_syntax = FALSE;
+ is_syntax = false;
if (JSVAL_IS_OBJECT(exc) &&
- gjs_typecheck_boxed(context, JSVAL_TO_OBJECT(exc), NULL, G_TYPE_ERROR, FALSE)) {
+ gjs_typecheck_boxed(context, JSVAL_TO_OBJECT(exc), NULL, G_TYPE_ERROR, false)) {
GError *gerror;
gerror = (GError*) gjs_c_struct_from_boxed(context, JSVAL_TO_OBJECT(exc));
@@ -587,7 +587,7 @@ gjs_log_exception_full(JSContext *context,
static bool
log_and_maybe_keep_exception(JSContext *context,
- gboolean keep)
+ bool keep)
{
jsval exc = JSVAL_VOID;
bool retval = false;
@@ -621,13 +621,13 @@ log_and_maybe_keep_exception(JSContext *context,
bool
gjs_log_exception(JSContext *context)
{
- return log_and_maybe_keep_exception(context, FALSE);
+ return log_and_maybe_keep_exception(context, false);
}
bool
gjs_log_and_keep_exception(JSContext *context)
{
- return log_and_maybe_keep_exception(context, TRUE);
+ return log_and_maybe_keep_exception(context, true);
}
static void
@@ -874,7 +874,7 @@ gjs_parse_args_valist (JSContext *context,
guint n_unwind = 0;
#define MAX_UNWIND_STRINGS 16
gpointer unwind_strings[MAX_UNWIND_STRINGS];
- gboolean ignore_trailing_args = FALSE;
+ bool ignore_trailing_args = false;
guint n_required = 0;
guint n_total = 0;
guint consumed_args;
@@ -882,7 +882,7 @@ gjs_parse_args_valist (JSContext *context,
JS_BeginRequest(context);
if (*format == '!') {
- ignore_trailing_args = TRUE;
+ ignore_trailing_args = true;
format++;
}
@@ -957,7 +957,7 @@ gjs_parse_args_valist (JSContext *context,
if (!JSVAL_IS_BOOLEAN(js_value)) {
arg_error_message = "Not a boolean";
} else {
- gboolean *arg = (gboolean*) arg_location;
+ bool *arg = (bool*) arg_location;
*arg = JSVAL_TO_BOOLEAN(js_value);
}
}
diff --git a/gjs/jsapi-util.h b/gjs/jsapi-util.h
index d160f9a..fbfe42e 100644
--- a/gjs/jsapi-util.h
+++ b/gjs/jsapi-util.h
@@ -202,7 +202,7 @@ jsval gjs_##cname##_create_proto(JSContext *context, JSObject *module, const cha
return rval; \
}
-gboolean gjs_init_context_standard (JSContext *context,
+bool gjs_init_context_standard (JSContext *context,
JSObject **global_out);
JSObject* gjs_get_import_global (JSContext *context);
@@ -213,7 +213,7 @@ void gjs_set_global_slot (JSContext *context,
GjsGlobalSlot slot,
jsval value);
-gboolean gjs_object_require_property (JSContext *context,
+bool gjs_object_require_property (JSContext *context,
JSObject *obj,
const char *obj_description,
jsid property_name,
@@ -339,7 +339,7 @@ bool gjs_get_string_id (JSContext *context,
jsid gjs_intern_string_to_id (JSContext *context,
const char *string);
-gboolean gjs_unichar_from_string (JSContext *context,
+bool gjs_unichar_from_string (JSContext *context,
jsval string,
gunichar *result);
@@ -375,7 +375,7 @@ int gjs_rooted_array_get_length (JSContext *context,
GjsRootedArray *array);
jsval* gjs_rooted_array_free (JSContext *context,
GjsRootedArray *array,
- gboolean free_segment);
+ bool free_segment);
void gjs_set_values (JSContext *context,
jsval *locations,
int n_locations,
@@ -435,7 +435,7 @@ typedef enum {
jsid gjs_context_get_const_string (JSContext *context,
GjsConstString string);
-gboolean gjs_object_get_property_const (JSContext *context,
+bool gjs_object_get_property_const (JSContext *context,
JSObject *obj,
GjsConstString property_name,
jsval *value_p);
diff --git a/gjs/mem.cpp b/gjs/mem.cpp
index 9106a54..73f7312 100644
--- a/gjs/mem.cpp
+++ b/gjs/mem.cpp
@@ -72,7 +72,7 @@ static GjsMemCounter* counters[] = {
void
gjs_memory_report(const char *where,
- gboolean die_if_leaks)
+ bool die_if_leaks)
{
int i;
int n_counters;
diff --git a/gjs/mem.h b/gjs/mem.h
index ee4e038..94b8d0d 100644
--- a/gjs/mem.h
+++ b/gjs/mem.h
@@ -74,7 +74,7 @@ GJS_DECLARE_COUNTER(interface)
g_atomic_int_get(&gjs_counter_ ## name .value)
void gjs_memory_report(const char *where,
- gboolean die_if_leaks);
+ bool die_if_leaks);
G_END_DECLS
diff --git a/gjs/native.cpp b/gjs/native.cpp
index cb2eb6e..52adbc0 100644
--- a/gjs/native.cpp
+++ b/gjs/native.cpp
@@ -63,13 +63,13 @@ gjs_register_native_module (const char *module_id,
* been registered. This is used to check to see if a name is a
* builtin module without starting to try and load it.
*/
-gboolean
+bool
gjs_is_registered_native_module(JSContext *context,
JSObject *parent,
const char *name)
{
if (modules == NULL)
- return FALSE;
+ return false;
return g_hash_table_lookup(modules, name) != NULL;
}
diff --git a/gjs/native.h b/gjs/native.h
index cfe5fd3..bdcdcf8 100644
--- a/gjs/native.h
+++ b/gjs/native.h
@@ -41,7 +41,7 @@ void gjs_register_native_module (const char *module_id,
GjsDefineModuleFunc func);
/* called by importer.c to to check for already loaded modules */
-gboolean gjs_is_registered_native_module(JSContext *context,
+bool gjs_is_registered_native_module(JSContext *context,
JSObject *parent,
const char *name);
diff --git a/gjs/runtime.cpp b/gjs/runtime.cpp
index 8dd1c8d..980cb12 100644
--- a/gjs/runtime.cpp
+++ b/gjs/runtime.cpp
@@ -206,7 +206,7 @@ gjs_finalize_callback(JSFreeOp *fop,
JSAPI call
- therefore, if there is a finalizer frame somewhere
in the stack, gjs_runtime_is_sweeping() will return
- TRUE.
+ true.
Comments in mozjs24 imply that this behavior might
change in the future, but it hasn't changed in
diff --git a/gjs/type-module.cpp b/gjs/type-module.cpp
index 36d3df5..730d14c 100644
--- a/gjs/type-module.cpp
+++ b/gjs/type-module.cpp
@@ -48,7 +48,7 @@ gjs_type_module_get ()
static gboolean
gjs_type_module_load (GTypeModule *self)
{
- return TRUE;
+ return true;
}
static void
diff --git a/installed-tests/gjs-unit.cpp b/installed-tests/gjs-unit.cpp
index def4a38..54f7804 100644
--- a/installed-tests/gjs-unit.cpp
+++ b/installed-tests/gjs-unit.cpp
@@ -100,9 +100,9 @@ teardown(GjsTestJSFixture *fix,
g_clear_object(&fix->coverage);
}
- gjs_memory_report("before destroying context", FALSE);
+ gjs_memory_report("before destroying context", false);
g_object_unref(fix->context);
- gjs_memory_report("after destroying context", TRUE);
+ gjs_memory_report("after destroying context", true);
}
static void
@@ -110,7 +110,7 @@ test(GjsTestJSFixture *fix,
gconstpointer test_data)
{
GError *error = NULL;
- gboolean success;
+ bool success;
int code;
GjsTestData *data = (GjsTestData *) test_data;
@@ -154,9 +154,9 @@ main(int argc, char **argv)
* we leak objects.
* https://bugzilla.gnome.org/show_bug.cgi?id=616193
*/
- g_setenv("GJS_DISABLE_JIT", "1", FALSE);
+ g_setenv("GJS_DISABLE_JIT", "1", false);
/* The fact that this isn't the default is kind of lame... */
- g_setenv("GJS_DEBUG_OUTPUT", "stderr", FALSE);
+ g_setenv("GJS_DEBUG_OUTPUT", "stderr", false);
setlocale(LC_ALL, "");
g_test_init(&argc, &argv, NULL);
diff --git a/libgjs-private/gjs-gdbus-wrapper.cpp b/libgjs-private/gjs-gdbus-wrapper.cpp
index 89f1f3f..a28b9b7 100644
--- a/libgjs-private/gjs-gdbus-wrapper.cpp
+++ b/libgjs-private/gjs-gdbus-wrapper.cpp
@@ -84,7 +84,7 @@ gjs_dbus_implementation_property_set(GDBusConnection *connection,
g_signal_emit(self, signals[SIGNAL_HANDLE_PROPERTY_SET], 0, property_name, value);
- return TRUE;
+ return true;
}
static void
@@ -269,7 +269,7 @@ idle_cb (gpointer data) {
GDBusInterfaceSkeleton *skeleton = G_DBUS_INTERFACE_SKELETON (data);
g_dbus_interface_skeleton_flush(skeleton);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
/**
diff --git a/modules/cairo-context.cpp b/modules/cairo-context.cpp
index 62f6172..028e70e 100644
--- a/modules/cairo-context.cpp
+++ b/modules/cairo-context.cpp
@@ -592,7 +592,7 @@ setDash_func(JSContext *context,
goto out;
}
- dashes_c = g_array_sized_new (FALSE, FALSE, sizeof(double), len);
+ dashes_c = g_array_sized_new (false, false, sizeof(double), len);
for (i = 0; i < len; ++i) {
jsval elem;
double b;
@@ -620,7 +620,7 @@ setDash_func(JSContext *context,
retval = true;
out:
if (dashes_c != NULL)
- g_array_free (dashes_c, TRUE);
+ g_array_free (dashes_c, true);
JS_RemoveObjectRoot(context, &dashes);
return retval;
}
@@ -1025,7 +1025,7 @@ context_to_g_argument(JSContext *context,
const char *arg_name,
GjsArgumentType argument_type,
GITransfer transfer,
- gboolean may_be_null,
+ bool may_be_null,
GArgument *arg)
{
JSObject *obj;
diff --git a/modules/cairo-region.cpp b/modules/cairo-region.cpp
index 9de5d5a..45784f7 100644
--- a/modules/cairo-region.cpp
+++ b/modules/cairo-region.cpp
@@ -295,7 +295,7 @@ region_to_g_argument(JSContext *context,
const char *arg_name,
GjsArgumentType argument_type,
GITransfer transfer,
- gboolean may_be_null,
+ bool may_be_null,
GArgument *arg)
{
JSObject *obj;
diff --git a/modules/cairo-surface.cpp b/modules/cairo-surface.cpp
index 3d040e4..d1d6c8c 100644
--- a/modules/cairo-surface.cpp
+++ b/modules/cairo-surface.cpp
@@ -254,7 +254,7 @@ surface_to_g_argument(JSContext *context,
const char *arg_name,
GjsArgumentType argument_type,
GITransfer transfer,
- gboolean may_be_null,
+ bool may_be_null,
GArgument *arg)
{
JSObject *obj;
diff --git a/modules/console.cpp b/modules/console.cpp
index 80c9e21..c3bcefb 100644
--- a/modules/console.cpp
+++ b/modules/console.cpp
@@ -161,7 +161,7 @@ gjs_console_interact(JSContext *context,
{
JS::CallReceiver rec = JS::CallReceiverFromVp(vp);
JSObject *object = JSVAL_TO_OBJECT(rec.thisv());
- gboolean eof = FALSE;
+ bool eof = false;
jsval result;
JSString *str;
GString *buffer = NULL;
@@ -221,7 +221,7 @@ gjs_console_interact(JSContext *context,
}
next:
- g_string_free(buffer, TRUE);
+ g_string_free(buffer, true);
} while (!eof);
g_fprintf(stdout, "\n");
diff --git a/test/gjs-test-coverage.cpp b/test/gjs-test-coverage.cpp
index 2f4f0d8..fa54d6f 100644
--- a/test/gjs-test-coverage.cpp
+++ b/test/gjs-test-coverage.cpp
@@ -249,7 +249,7 @@ eval_script_and_get_coverage_data(GjsContext *context,
coverage_data_length_return);
}
-static gboolean
+static bool
coverage_data_contains_value_for_key(const char *data,
const char *key,
const char *value)
@@ -257,17 +257,17 @@ coverage_data_contains_value_for_key(const char *data,
const char *sf_line = line_starting_with(data, key);
if (!sf_line)
- return FALSE;
+ return false;
return strncmp(&sf_line[strlen(key)],
value,
strlen(value)) == 0;
}
-typedef gboolean (*CoverageDataMatchFunc) (const char *value,
- gpointer user_data);
+typedef bool (*CoverageDataMatchFunc) (const char *value,
+ gpointer user_data);
-static gboolean
+static bool
coverage_data_matches_value_for_key_internal(const char *line,
const char *key,
CoverageDataMatchFunc match,
@@ -276,7 +276,7 @@ coverage_data_matches_value_for_key_internal(const char *line,
return (*match)(line, user_data);
}
-static gboolean
+static bool
coverage_data_matches_value_for_key(const char *data,
const char *key,
CoverageDataMatchFunc match,
@@ -285,12 +285,12 @@ coverage_data_matches_value_for_key(const char *data,
const char *line = line_starting_with(data, key);
if (!line)
- return FALSE;
+ return false;
return coverage_data_matches_value_for_key_internal(line, key, match, user_data);
}
-static gboolean
+static bool
coverage_data_matches_any_value_for_key(const char *data,
const char *key,
CoverageDataMatchFunc match,
@@ -300,15 +300,15 @@ coverage_data_matches_any_value_for_key(const char *data,
while (data) {
if (coverage_data_matches_value_for_key_internal(data, key, match, user_data))
- return TRUE;
+ return true;
data = line_starting_with(data + 1, key);
}
- return FALSE;
+ return false;
}
-static gboolean
+static bool
coverage_data_matches_values_for_key(const char *data,
const char *key,
gsize n,
@@ -323,7 +323,7 @@ coverage_data_matches_values_for_key(const char *data,
while (line && n > 0) {
if (!coverage_data_matches_value_for_key_internal(line, key, match, (gpointer) data_iterator))
- return FALSE;
+ return false;
line = line_starting_with(line + 1, key);
--n;
@@ -332,9 +332,9 @@ coverage_data_matches_values_for_key(const char *data,
/* If n is zero then we've found all available matches */
if (n == 0)
- return TRUE;
+ return true;
- return FALSE;
+ return false;
}
/* A simple wrapper around gjs_coverage_new */
@@ -565,7 +565,7 @@ typedef struct _BranchLineData {
BranchTaken taken;
} BranchLineData;
-static gboolean
+static bool
branch_at_line_should_be_taken(const char *line,
gpointer user_data)
{
@@ -595,11 +595,11 @@ branch_at_line_should_be_taken(const char *line,
else
hit_count_num = atoi(hit_count);
- const gboolean hit_correct_branch_line =
+ const bool hit_correct_branch_line =
branch_data->expected_branch_line == line_no;
- const gboolean hit_correct_branch_id =
+ const bool hit_correct_branch_id =
branch_data->expected_id == branch_id;
- gboolean branch_correctly_taken_or_not_taken;
+ bool branch_correctly_taken_or_not_taken;
switch (branch_data->taken) {
case NOT_EXECUTED:
@@ -820,7 +820,7 @@ test_branch_not_hit_written_to_coverage_data(gpointer fixture_data,
g_free(coverage_data_contents);
}
-static gboolean
+static bool
has_function_name(const char *line,
gpointer user_data)
{
@@ -877,7 +877,7 @@ test_function_names_written_to_coverage_data(gpointer fixture_data,
g_free(coverage_data_contents);
}
-static gboolean
+static bool
has_function_line(const char *line,
gpointer user_data)
{
@@ -932,7 +932,7 @@ typedef struct _FunctionHitCountData {
unsigned int hit_count_minimum;
} FunctionHitCountData;
-static gboolean
+static bool
hit_count_is_more_than_for_function(const char *line,
gpointer user_data)
{
@@ -955,8 +955,8 @@ hit_count_is_more_than_for_function(const char *line,
g_error("sscanf: only matched %d", nmatches);
}
- const gboolean function_name_match = g_strcmp0(data->function, detected_function) == 0;
- const gboolean hit_count_more_than = hit_count >= data->hit_count_minimum;
+ const bool function_name_match = g_strcmp0(data->function, detected_function) == 0;
+ const bool hit_count_more_than = hit_count >= data->hit_count_minimum;
g_free(detected_function);
@@ -1142,7 +1142,7 @@ typedef struct _LineCountIsMoreThanData {
unsigned int expected_to_be_more_than;
} LineCountIsMoreThanData;
-static gboolean
+static bool
line_hit_count_is_more_than(const char *line,
gpointer user_data)
{
@@ -1383,7 +1383,7 @@ typedef struct _ExpectedSourceFileCoverageData {
const char expected_lines_found_character;
} ExpectedSourceFileCoverageData;
-static gboolean
+static bool
check_coverage_data_for_source_file(ExpectedSourceFileCoverageData *expected,
const gsize expected_size,
const char *section_start)
@@ -1393,16 +1393,16 @@ check_coverage_data_for_source_file(ExpectedSourceFileCoverageData *expected,
if (strncmp(§ion_start[3],
expected[i].source_file_path,
strlen (expected[i].source_file_path)) == 0) {
- const gboolean line_hits_match = coverage_data_matches_values_for_key(section_start,
- "DA:",
-
expected[i].n_more_than_matchers,
-
line_hit_count_is_more_than,
- expected[i].more_than,
- sizeof
(LineCountIsMoreThanData));
+ const bool line_hits_match = coverage_data_matches_values_for_key(section_start,
+ "DA:",
+
expected[i].n_more_than_matchers,
+ line_hit_count_is_more_than,
+ expected[i].more_than,
+ sizeof
(LineCountIsMoreThanData));
const char *total_hits_record = line_starting_with(section_start, "LH:");
- const gboolean total_hits_match = total_hits_record[3] ==
expected[i].expected_lines_hit_character;
+ const bool total_hits_match = total_hits_record[3] == expected[i].expected_lines_hit_character;
const char *total_found_record = line_starting_with(section_start, "LF:");
- const gboolean total_found_match = total_found_record[3] ==
expected[i].expected_lines_found_character;
+ const bool total_found_match = total_found_record[3] ==
expected[i].expected_lines_found_character;
return line_hits_match &&
total_hits_match &&
@@ -1410,7 +1410,7 @@ check_coverage_data_for_source_file(ExpectedSourceFileCoverageData *expected,
}
}
- return FALSE;
+ return false;
}
static char *
@@ -1592,10 +1592,7 @@ eval_file_for_ast_in_object_notation(GjsContext *context,
GjsCoverage *coverage,
const char *filename)
{
- gboolean success = gjs_context_eval_file(context,
- filename,
- NULL,
- NULL);
+ bool success = gjs_context_eval_file(context, filename, NULL, NULL);
g_assert_true(success);
const gchar *coverage_paths[] = {
@@ -1624,8 +1621,8 @@ test_coverage_cache_data_in_expected_format(gpointer fixture_data,
sleep(1);
GTimeVal mtime;
- gboolean successfully_got_mtime = gjs_get_path_mtime(fixture->base_fixture.temporary_js_script_filename,
- &mtime);
+ bool successfully_got_mtime = gjs_get_path_mtime(fixture->base_fixture.temporary_js_script_filename,
+ &mtime);
g_assert_true(successfully_got_mtime);
char *mtime_string = g_strdup_printf("[%lli,%lli]", (gint64) mtime.tv_sec, (gint64) mtime.tv_usec);
@@ -1638,7 +1635,7 @@ test_coverage_cache_data_in_expected_format(gpointer fixture_data,
g_assert_cmpstr(cache_in_object_notation, ==, expected_cache_object_notation->str);
- g_string_free(expected_cache_object_notation, TRUE);
+ g_string_free(expected_cache_object_notation, true);
g_free(cache_in_object_notation);
g_free(mtime_string);
}
@@ -1670,7 +1667,7 @@ test_coverage_cache_data_in_expected_format_resource(gpointer fixture_data,
g_assert_cmpstr(cache_in_object_notation, ==, expected_cache_object_notation->str);
- g_string_free(expected_cache_object_notation, TRUE);
+ g_string_free(expected_cache_object_notation, true);
g_free(cache_in_object_notation);
g_free(hash_string);
}
@@ -1821,10 +1818,7 @@ eval_file_for_ast_cache_path(GjsContext *context,
const char *filename,
const char *output_directory)
{
- gboolean success = gjs_context_eval_file(context,
- filename,
- NULL,
- NULL);
+ bool success = gjs_context_eval_file(context, filename, NULL, NULL);
g_assert_true(success);
const gchar *coverage_paths[] = {
@@ -2045,10 +2039,10 @@ test_coverage_cache_file_written_when_no_cache_exists(gpointer fixture_data
/* We need to execute the script now in order for a cache entry
* to be created, since unexecuted scripts are not counted as
* part of the coverage report. */
- gboolean success = gjs_context_eval_file(fixture->base_fixture.context,
- fixture->base_fixture.temporary_js_script_filename,
- NULL,
- NULL);
+ bool success = gjs_context_eval_file(fixture->base_fixture.context,
+ fixture->base_fixture.temporary_js_script_filename,
+ NULL,
+ NULL);
g_assert_true(success);
gjs_coverage_write_statistics(fixture->base_fixture.coverage,
@@ -2065,17 +2059,14 @@ eval_script_for_cache_mtime(GjsContext *context,
const char *script,
const char *output_directory)
{
- gboolean success = gjs_context_eval_file(context,
- script,
- NULL,
- NULL);
+ bool success = gjs_context_eval_file(context, script, NULL, NULL);
g_assert_true(success);
gjs_coverage_write_statistics(coverage,
output_directory);
GTimeVal mtime;
- gboolean successfully_got_mtime = gjs_get_path_mtime(cache_path, &mtime);
+ bool successfully_got_mtime = gjs_get_path_mtime(cache_path, &mtime);
g_assert_true(successfully_got_mtime);
return mtime;
@@ -2127,8 +2118,8 @@ test_coverage_cache_updated_when_cache_stale(gpointer fixture_data,
fixture->output_file_directory);
- const gboolean seconds_different = (first_cache_mtime.tv_sec != second_cache_mtime.tv_sec);
- const gboolean microseconds_different (first_cache_mtime.tv_usec != second_cache_mtime.tv_usec);
+ const bool seconds_different = (first_cache_mtime.tv_sec != second_cache_mtime.tv_sec);
+ const bool microseconds_different = (first_cache_mtime.tv_usec != second_cache_mtime.tv_usec);
g_assert_true(seconds_different || microseconds_different);
diff --git a/test/gjs-tests.cpp b/test/gjs-tests.cpp
index badbbf1..7395f5d 100644
--- a/test/gjs-tests.cpp
+++ b/test/gjs-tests.cpp
@@ -126,7 +126,7 @@ gjstest_test_func_gjs_jsapi_util_array(void)
g_free(ascii);
}
- gjs_rooted_array_free(context, array, TRUE);
+ gjs_rooted_array_free(context, array, true);
JS_LeaveCompartment(context, oldCompartment);
_gjs_unit_test_fixture_finish(&fixture);
diff --git a/util/crash.cpp b/util/crash.cpp
index 342d945..b1b85ae 100644
--- a/util/crash.cpp
+++ b/util/crash.cpp
@@ -155,7 +155,7 @@ gjs_crash_after_timeout(int seconds)
FD_ZERO(&read_fds);
FD_SET(pipe_fds[0], &read_fds);
- while (TRUE) {
+ while (true) {
remaining.tv_sec = term_time.tv_sec - now.tv_sec;
remaining.tv_usec = term_time.tv_usec - now.tv_usec;
if (remaining.tv_usec < 0) {
diff --git a/util/glib.cpp b/util/glib.cpp
index 7045fde..a2b71e0 100644
--- a/util/glib.cpp
+++ b/util/glib.cpp
@@ -43,14 +43,14 @@ get_first_one_predicate(void *key,
sod->value = value;
/* found it! */
- return TRUE;
+ return true;
}
-static gboolean
+static bool
remove_or_steal_one(GHashTable *hash,
void **key_p,
void **value_p,
- gboolean steal)
+ bool steal)
{
StoreOneData sod;
@@ -59,7 +59,7 @@ remove_or_steal_one(GHashTable *hash,
g_hash_table_find(hash, get_first_one_predicate, &sod);
if (sod.key == NULL)
- return FALSE;
+ return false;
if (key_p)
*key_p = sod.key;
@@ -74,20 +74,20 @@ remove_or_steal_one(GHashTable *hash,
return sod.value != NULL;
}
-gboolean
+bool
gjs_g_hash_table_remove_one(GHashTable *hash,
void **key_p,
void **value_p)
{
- return remove_or_steal_one(hash, key_p, value_p, FALSE);
+ return remove_or_steal_one(hash, key_p, value_p, false);
}
-gboolean
+bool
gjs_g_hash_table_steal_one(GHashTable *hash,
void **key_p,
void **value_p)
{
- return remove_or_steal_one(hash, key_p, value_p, TRUE);
+ return remove_or_steal_one(hash, key_p, value_p, true);
}
/** gjs_g_strv_concat:
@@ -124,7 +124,7 @@ gjs_g_strv_concat(char ***strv_array, int len)
g_ptr_array_add(array, NULL);
- return (char**)g_ptr_array_free(array, FALSE);
+ return (char**)g_ptr_array_free(array, false);
}
gchar *
@@ -164,5 +164,5 @@ _gjs_g_utf8_make_valid (const gchar *name)
g_assert (g_utf8_validate (string->str, -1, NULL));
- return g_string_free (string, FALSE);
+ return g_string_free (string, false);
}
diff --git a/util/glib.h b/util/glib.h
index 5be171f..ac82b7f 100644
--- a/util/glib.h
+++ b/util/glib.h
@@ -30,10 +30,10 @@ G_BEGIN_DECLS
gchar * _gjs_g_utf8_make_valid (const gchar *name);
-gboolean gjs_g_hash_table_remove_one (GHashTable *hash,
+bool gjs_g_hash_table_remove_one (GHashTable *hash,
void **key_p,
void **value_p);
-gboolean gjs_g_hash_table_steal_one (GHashTable *hash,
+bool gjs_g_hash_table_steal_one (GHashTable *hash,
void **key_p,
void **value_p);
char** gjs_g_strv_concat (char ***strv_array,
diff --git a/util/log.cpp b/util/log.cpp
index ed6ca18..e211031 100644
--- a/util/log.cpp
+++ b/util/log.cpp
@@ -36,30 +36,30 @@
/* prefix is allowed if it's in the ;-delimited environment variable
* GJS_DEBUG_TOPICS or if that variable is not set.
*/
-static gboolean
+static bool
is_allowed_prefix (const char *prefix)
{
static const char *topics = NULL;
static char **prefixes = NULL;
- gboolean found = FALSE;
+ bool found = false;
int i;
if (topics == NULL) {
topics = g_getenv("GJS_DEBUG_TOPICS");
if (!topics)
- return TRUE;
+ return true;
/* We never really free this, should be gone when the process exits */
prefixes = g_strsplit(topics, ";", -1);
}
if (!prefixes)
- return TRUE;
+ return true;
for (i = 0; prefixes[i] != NULL; i++) {
if (!strcmp(prefixes[i], prefix)) {
- found = TRUE;
+ found = true;
break;
}
}
@@ -89,10 +89,10 @@ gjs_debug(GjsDebugTopic topic,
...)
{
static FILE *logfp = NULL;
- static gboolean debug_log_enabled = FALSE;
- static gboolean strace_timestamps = FALSE;
- static gboolean checked_for_timestamp = FALSE;
- static gboolean print_timestamp = FALSE;
+ static bool debug_log_enabled = false;
+ static bool strace_timestamps = false;
+ static bool checked_for_timestamp = false;
+ static bool print_timestamp = false;
static GTimer *timer = NULL;
const char *prefix;
va_list args;
@@ -100,7 +100,7 @@ gjs_debug(GjsDebugTopic topic,
if (!checked_for_timestamp) {
print_timestamp = gjs_environment_variable_is_set("GJS_DEBUG_TIMESTAMP");
- checked_for_timestamp = TRUE;
+ checked_for_timestamp = true;
}
if (print_timestamp && !timer) {
@@ -111,7 +111,7 @@ gjs_debug(GjsDebugTopic topic,
const char *debug_output = g_getenv("GJS_DEBUG_OUTPUT");
if (debug_output != NULL &&
strcmp(debug_output, "stderr") == 0) {
- debug_log_enabled = TRUE;
+ debug_log_enabled = true;
} else if (debug_output != NULL) {
const char *log_file;
char *free_me;
@@ -140,7 +140,7 @@ gjs_debug(GjsDebugTopic topic,
g_free(free_me);
- debug_log_enabled = TRUE;
+ debug_log_enabled = true;
}
if (logfp == NULL)
diff --git a/util/misc.cpp b/util/misc.cpp
index cef290b..b0a2f37 100644
--- a/util/misc.cpp
+++ b/util/misc.cpp
@@ -24,17 +24,17 @@
#include <config.h>
#include "misc.h"
-gboolean
+bool
gjs_environment_variable_is_set(const char *env_variable_name)
{
const char *s;
s = g_getenv(env_variable_name);
if (s == NULL)
- return FALSE;
+ return false;
if (*s == '\0')
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
diff --git a/util/misc.h b/util/misc.h
index 8b4b91a..bb78427 100644
--- a/util/misc.h
+++ b/util/misc.h
@@ -28,7 +28,7 @@
G_BEGIN_DECLS
-gboolean gjs_environment_variable_is_set (const char *env_variable_name);
+bool gjs_environment_variable_is_set (const char *env_variable_name);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]