From: Philippe Proulx Date: Thu, 11 May 2017 21:12:46 +0000 (-0400) Subject: Do not use `bool` type; use new `bt_bool` instead X-Git-Tag: v2.0.0-pre1~287 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=c55a9f585da53ea54ac458155fac3cdec1779d47 Do not use `bool` type; use new `bt_bool` instead There are possible ABI incompatibilities between C99's `bool` (`_Bool`) type and C++'s `bool` type, and also between different compilers. For this reason we choose to use our own boolean type, `bt_bool`, which is defined as `int`. `BT_FALSE` and `BT_TRUE` are our own definitions for false and true. Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- diff --git a/cli/babeltrace-cfg.h b/cli/babeltrace-cfg.h index ca84ae3f..87231295 100644 --- a/cli/babeltrace-cfg.h +++ b/cli/babeltrace-cfg.h @@ -27,6 +27,7 @@ #include #include +#include #include #include #include diff --git a/cli/babeltrace.c b/cli/babeltrace.c index ba8473af..f42b563e 100644 --- a/cli/babeltrace.c +++ b/cli/babeltrace.c @@ -218,7 +218,7 @@ struct print_map_value_data { }; static -bool print_map_value(const char *key, struct bt_value *object, void *data) +bt_bool print_map_value(const char *key, struct bt_value *object, void *data) { struct print_map_value_data *print_map_value_data = data; @@ -244,13 +244,13 @@ bool print_map_value(const char *key, struct bt_value *object, void *data) print_value_rec(print_map_value_data->fp, object, print_map_value_data->indent + 2); - return true; + return BT_TRUE; } static void print_value_rec(FILE *fp, struct bt_value *value, size_t indent) { - bool bool_val; + bt_bool bool_val; int64_t int_val; double dbl_val; const char *str_val; diff --git a/doc/api/Doxyfile.in b/doc/api/Doxyfile.in index adb2a564..7a82c1cf 100644 --- a/doc/api/Doxyfile.in +++ b/doc/api/Doxyfile.in @@ -147,6 +147,7 @@ INPUT = "@top_srcdir@/include/babeltrace/ctf-ir" \ "@top_srcdir@/include/babeltrace/ref.h" \ "@top_srcdir@/include/babeltrace/values.h" \ "@top_srcdir@/include/babeltrace/logging.h" \ + "@top_srcdir@/include/babeltrace/types.h" \ "@srcdir@/dox/main-page.dox" \ "@srcdir@/dox/includes-build.dox" \ "@srcdir@/dox/write-plugin.dox" \ diff --git a/include/Makefile.am b/include/Makefile.am index 124dce7e..cdf7fb00 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -4,7 +4,8 @@ babeltraceinclude_HEADERS = \ babeltrace/values.h \ babeltrace/ref.h \ babeltrace/logging.h \ - babeltrace/version.h + babeltrace/version.h \ + babeltrace/types.h # Legacy API (for CTF writer) babeltracectfinclude_HEADERS = \ diff --git a/include/babeltrace/babeltrace-internal.h b/include/babeltrace/babeltrace-internal.h index 917e3f5d..18ed309f 100644 --- a/include/babeltrace/babeltrace-internal.h +++ b/include/babeltrace/babeltrace-internal.h @@ -29,12 +29,12 @@ #include #include #include -#include #include +#include #define PERROR_BUFLEN 200 -extern bool babeltrace_verbose, babeltrace_debug; +extern bt_bool babeltrace_verbose, babeltrace_debug; #define printf_verbose(fmt, args...) \ do { \ diff --git a/include/babeltrace/babeltrace.h b/include/babeltrace/babeltrace.h index da6d03e9..36f1b383 100644 --- a/include/babeltrace/babeltrace.h +++ b/include/babeltrace/babeltrace.h @@ -28,6 +28,7 @@ /* Core API */ #include #include +#include #include #include diff --git a/include/babeltrace/common-internal.h b/include/babeltrace/common-internal.h index 6cd15b8e..fd8b12e3 100644 --- a/include/babeltrace/common-internal.h +++ b/include/babeltrace/common-internal.h @@ -1,6 +1,7 @@ #ifndef BABELTRACE_COMMON_INTERNAL_H #define BABELTRACE_COMMON_INTERNAL_H +#include #include #define BT_COMMON_COLOR_RESET "\033[0m" diff --git a/include/babeltrace/ctf-ir/clock-class-internal.h b/include/babeltrace/ctf-ir/clock-class-internal.h index 0d7d8917..d68796e7 100644 --- a/include/babeltrace/ctf-ir/clock-class-internal.h +++ b/include/babeltrace/ctf-ir/clock-class-internal.h @@ -31,8 +31,9 @@ #include #include #include -#include #include +#include +#include struct bt_ctf_clock_class { struct bt_object base; @@ -67,6 +68,6 @@ void bt_ctf_clock_class_serialize(struct bt_ctf_clock_class *clock_class, struct metadata_context *context); BT_HIDDEN -bool bt_ctf_clock_class_is_valid(struct bt_ctf_clock_class *clock_class); +bt_bool bt_ctf_clock_class_is_valid(struct bt_ctf_clock_class *clock_class); #endif /* BABELTRACE_CTF_IR_CLOCK_CLASS_INTERNAL_H */ diff --git a/include/babeltrace/ctf-ir/clock-class.h b/include/babeltrace/ctf-ir/clock-class.h index 223d59f6..3f461aa1 100644 --- a/include/babeltrace/ctf-ir/clock-class.h +++ b/include/babeltrace/ctf-ir/clock-class.h @@ -32,6 +32,7 @@ */ #include +#include #ifdef __cplusplus extern "C" { diff --git a/include/babeltrace/ctf-ir/field-types-internal.h b/include/babeltrace/ctf-ir/field-types-internal.h index f54e859b..2b860405 100644 --- a/include/babeltrace/ctf-ir/field-types-internal.h +++ b/include/babeltrace/ctf-ir/field-types-internal.h @@ -35,6 +35,7 @@ #include #include #include +#include #include typedef void (*type_freeze_func)(struct bt_ctf_field_type *); @@ -65,7 +66,7 @@ struct bt_ctf_field_type_integer { struct bt_ctf_field_type parent; struct bt_ctf_clock_class *mapped_clock; enum bt_ctf_byte_order user_byte_order; - bool is_signed; + bt_bool is_signed; unsigned int size; enum bt_ctf_integer_base base; enum bt_ctf_string_encoding encoding; @@ -89,7 +90,7 @@ struct bt_ctf_field_type_enumeration { struct bt_ctf_field_type *container; GPtrArray *entries; /* Array of ptrs to struct enumeration_mapping */ /* Only set during validation. */ - bool has_overlapping_ranges; + bt_bool has_overlapping_ranges; }; enum bt_ctf_field_type_enumeration_mapping_iterator_type { diff --git a/include/babeltrace/ctf-ir/fields-internal.h b/include/babeltrace/ctf-ir/fields-internal.h index 75769fdf..b7375a45 100644 --- a/include/babeltrace/ctf-ir/fields-internal.h +++ b/include/babeltrace/ctf-ir/fields-internal.h @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -106,6 +107,6 @@ BT_HIDDEN void bt_ctf_field_freeze(struct bt_ctf_field *field); BT_HIDDEN -bool bt_ctf_field_is_set(struct bt_ctf_field *field); +bt_bool bt_ctf_field_is_set(struct bt_ctf_field *field); #endif /* BABELTRACE_CTF_IR_FIELDS_INTERNAL_H */ diff --git a/include/babeltrace/ctf-ir/trace-internal.h b/include/babeltrace/ctf-ir/trace-internal.h index f49e85bc..b468379a 100644 --- a/include/babeltrace/ctf-ir/trace-internal.h +++ b/include/babeltrace/ctf-ir/trace-internal.h @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -52,7 +53,7 @@ struct bt_ctf_trace { GString *name; int frozen; uuid_t uuid; - bool uuid_set; + bt_bool uuid_set; enum bt_ctf_byte_order native_byte_order; struct bt_value *environment; GPtrArray *clocks; /* Array of pointers to bt_ctf_clock_class */ @@ -68,7 +69,7 @@ struct bt_ctf_trace { */ int valid; GPtrArray *listeners; /* Array of struct listener_wrapper */ - bool is_static; + bt_bool is_static; }; struct metadata_context { @@ -88,7 +89,7 @@ int bt_ctf_trace_object_modification(struct bt_ctf_object *object, void *trace_ptr); BT_HIDDEN -bool bt_ctf_trace_has_clock_class(struct bt_ctf_trace *trace, +bt_bool bt_ctf_trace_has_clock_class(struct bt_ctf_trace *trace, struct bt_ctf_clock_class *clock_class); /** diff --git a/include/babeltrace/ctf-ir/trace.h b/include/babeltrace/ctf-ir/trace.h index f3584225..e6a3bc47 100644 --- a/include/babeltrace/ctf-ir/trace.h +++ b/include/babeltrace/ctf-ir/trace.h @@ -34,6 +34,7 @@ #include #include #include +#include #include #ifdef __cplusplus @@ -811,15 +812,15 @@ It is guaranteed that a static trace class will never contain new streams, stream classes, or clock classes. A static class is always frozen. -This function returns \c true if bt_ctf_trace_set_is_static() was +This function returns #BT_TRUE if bt_ctf_trace_set_is_static() was previously called on it. @param[in] trace_class Trace class to check. -@returns \c true if \p trace_class is static, +@returns #BT_TRUE if \p trace_class is static, @sa bt_ctf_trace_set_is_static(): Makes a trace class static. */ -extern bool bt_ctf_trace_is_static(struct bt_ctf_trace *trace_class); +extern bt_bool bt_ctf_trace_is_static(struct bt_ctf_trace *trace_class); /** @brief Makes the CTF IR trace class \p trace_class static. diff --git a/include/babeltrace/ctf-writer/serialize-internal.h b/include/babeltrace/ctf-writer/serialize-internal.h index 6095ae64..6471993c 100644 --- a/include/babeltrace/ctf-writer/serialize-internal.h +++ b/include/babeltrace/ctf-writer/serialize-internal.h @@ -37,6 +37,7 @@ #include #include #include +#include struct bt_ctf_stream_pos { int fd; @@ -130,7 +131,7 @@ int bt_ctf_stream_pos_init(struct bt_ctf_stream_pos *pos, pos->flags = MAP_SHARED; break; default: - assert(false); + assert(BT_FALSE); } return 0; diff --git a/include/babeltrace/graph/clock-class-priority-map-internal.h b/include/babeltrace/graph/clock-class-priority-map-internal.h index 04942145..89ba1c9d 100644 --- a/include/babeltrace/graph/clock-class-priority-map-internal.h +++ b/include/babeltrace/graph/clock-class-priority-map-internal.h @@ -28,10 +28,10 @@ #include #include -#include #include #include #include +#include #include struct bt_clock_class_priority_map { @@ -46,7 +46,7 @@ struct bt_clock_class_priority_map { /* Clock class (weak) with the currently highest priority */ struct bt_ctf_clock_class *highest_prio_cc; - bool frozen; + bt_bool frozen; }; static inline @@ -54,7 +54,7 @@ void bt_clock_class_priority_map_freeze( struct bt_clock_class_priority_map *cc_prio_map) { assert(cc_prio_map); - cc_prio_map->frozen = true; + cc_prio_map->frozen = BT_TRUE; } #endif /* BABELTRACE_GRAPH_CLOCK_CLASS_PRIORITY_MAP_INTERNAL_H */ diff --git a/include/babeltrace/graph/component-class-internal.h b/include/babeltrace/graph/component-class-internal.h index 5f84dcd4..03314845 100644 --- a/include/babeltrace/graph/component-class-internal.h +++ b/include/babeltrace/graph/component-class-internal.h @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include struct bt_component_class; @@ -64,7 +64,7 @@ struct bt_component_class { } methods; /* Array of struct bt_component_class_destroy_listener */ GArray *destroy_listeners; - bool frozen; + bt_bool frozen; }; struct bt_component_class_iterator_methods { diff --git a/include/babeltrace/graph/component-class.h b/include/babeltrace/graph/component-class.h index e30c329c..c98088b1 100644 --- a/include/babeltrace/graph/component-class.h +++ b/include/babeltrace/graph/component-class.h @@ -26,9 +26,9 @@ */ #include -#include #include #include +#include #ifdef __cplusplus extern "C" { @@ -172,21 +172,21 @@ extern enum bt_component_class_type bt_component_class_get_type( struct bt_component_class *component_class); static inline -bool bt_component_class_is_source(struct bt_component_class *component_class) +bt_bool bt_component_class_is_source(struct bt_component_class *component_class) { return bt_component_class_get_type(component_class) == BT_COMPONENT_CLASS_TYPE_SOURCE; } static inline -bool bt_component_class_is_filter(struct bt_component_class *component_class) +bt_bool bt_component_class_is_filter(struct bt_component_class *component_class) { return bt_component_class_get_type(component_class) == BT_COMPONENT_CLASS_TYPE_FILTER; } static inline -bool bt_component_class_is_sink(struct bt_component_class *component_class) +bt_bool bt_component_class_is_sink(struct bt_component_class *component_class) { return bt_component_class_get_type(component_class) == BT_COMPONENT_CLASS_TYPE_SINK; diff --git a/include/babeltrace/graph/component-internal.h b/include/babeltrace/graph/component-internal.h index fe55a601..eaa77339 100644 --- a/include/babeltrace/graph/component-internal.h +++ b/include/babeltrace/graph/component-internal.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -61,7 +62,7 @@ struct bt_component { * Used to protect operations which may only be used during * a component's initialization. */ - bool initializing; + bt_bool initializing; /* Input and output ports (weak references) */ GPtrArray *input_ports; diff --git a/include/babeltrace/graph/component.h b/include/babeltrace/graph/component.h index 975c10e3..31fde560 100644 --- a/include/babeltrace/graph/component.h +++ b/include/babeltrace/graph/component.h @@ -31,7 +31,7 @@ #include #include #include -#include +#include #ifdef __cplusplus extern "C" { @@ -80,21 +80,21 @@ extern enum bt_component_class_type bt_component_get_class_type( struct bt_component *component); static inline -bool bt_component_is_source(struct bt_component *component) +bt_bool bt_component_is_source(struct bt_component *component) { return bt_component_get_class_type(component) == BT_COMPONENT_CLASS_TYPE_SOURCE; } static inline -bool bt_component_is_filter(struct bt_component *component) +bt_bool bt_component_is_filter(struct bt_component *component) { return bt_component_get_class_type(component) == BT_COMPONENT_CLASS_TYPE_FILTER; } static inline -bool bt_component_is_sink(struct bt_component *component) +bt_bool bt_component_is_sink(struct bt_component *component) { return bt_component_get_class_type(component) == BT_COMPONENT_CLASS_TYPE_SINK; diff --git a/include/babeltrace/graph/notification-heap.h b/include/babeltrace/graph/notification-heap.h index 8eb2f7f8..51f2b315 100644 --- a/include/babeltrace/graph/notification-heap.h +++ b/include/babeltrace/graph/notification-heap.h @@ -27,9 +27,9 @@ */ #include -#include #include #include +#include /** * bt_notification_time_compare - Compare two notifications' timestamps @@ -40,7 +40,7 @@ * used to order the notifications. This criterion shall ensure a consistent * ordering over multiple runs. */ -typedef bool (*bt_notification_time_compare_func)( +typedef bt_bool (*bt_notification_time_compare_func)( struct bt_notification *a, struct bt_notification *b, void *user_data); diff --git a/include/babeltrace/graph/notification-internal.h b/include/babeltrace/graph/notification-internal.h index 01eb5967..e13f660c 100644 --- a/include/babeltrace/graph/notification-internal.h +++ b/include/babeltrace/graph/notification-internal.h @@ -27,12 +27,12 @@ * SOFTWARE. */ -#include #include #include #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -45,7 +45,7 @@ struct bt_notification { struct bt_object base; enum bt_notification_type type; get_stream_func get_stream; - bool frozen; + bt_bool frozen; }; BT_HIDDEN @@ -56,7 +56,7 @@ void bt_notification_init(struct bt_notification *notification, BT_HIDDEN static inline void bt_notification_freeze(struct bt_notification *notification) { - notification->frozen = true; + notification->frozen = BT_TRUE; } #ifdef __cplusplus diff --git a/include/babeltrace/graph/notification-iterator-internal.h b/include/babeltrace/graph/notification-iterator-internal.h index 90a8ee47..e1f9f211 100644 --- a/include/babeltrace/graph/notification-iterator-internal.h +++ b/include/babeltrace/graph/notification-iterator-internal.h @@ -32,6 +32,7 @@ #include #include #include +#include struct bt_port; @@ -85,7 +86,7 @@ struct bt_notification_iterator { */ uint32_t subscription_mask; - bool is_ended; + bt_bool is_ended; void *user_data; }; diff --git a/include/babeltrace/graph/port.h b/include/babeltrace/graph/port.h index 7569961b..069daba1 100644 --- a/include/babeltrace/graph/port.h +++ b/include/babeltrace/graph/port.h @@ -28,7 +28,7 @@ */ #include -#include +#include #ifdef __cplusplus extern "C" { @@ -58,13 +58,13 @@ extern int bt_port_disconnect(struct bt_port *port); extern int bt_port_is_connected(struct bt_port *port); static inline -bool bt_port_is_input(struct bt_port *port) +bt_bool bt_port_is_input(struct bt_port *port) { return bt_port_get_type(port) == BT_PORT_TYPE_INPUT; } static inline -bool bt_port_is_output(struct bt_port *port) +bt_bool bt_port_is_output(struct bt_port *port) { return bt_port_get_type(port) == BT_PORT_TYPE_OUTPUT; } diff --git a/include/babeltrace/plugin/plugin-internal.h b/include/babeltrace/plugin/plugin-internal.h index 7b38a2d3..539fe141 100644 --- a/include/babeltrace/plugin/plugin-internal.h +++ b/include/babeltrace/plugin/plugin-internal.h @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include enum bt_plugin_type { @@ -41,7 +41,7 @@ enum bt_plugin_type { struct bt_plugin { struct bt_object base; enum bt_plugin_type type; - bool frozen; + bt_bool frozen; /* Array of pointers to bt_component_class (owned by this) */ GPtrArray *comp_classes; @@ -59,12 +59,12 @@ struct bt_plugin { unsigned int patch; GString *extra; } version; - bool path_set; - bool name_set; - bool author_set; - bool license_set; - bool description_set; - bool version_set; + bt_bool path_set; + bt_bool name_set; + bt_bool author_set; + bt_bool license_set; + bt_bool description_set; + bt_bool version_set; } info; /* Value depends on the specific plugin type */ @@ -188,7 +188,7 @@ void bt_plugin_set_path(struct bt_plugin *plugin, const char *path) assert(plugin); assert(path); g_string_assign(plugin->info.path, path); - plugin->info.path_set = true; + plugin->info.path_set = BT_TRUE; } static inline @@ -197,7 +197,7 @@ void bt_plugin_set_name(struct bt_plugin *plugin, const char *name) assert(plugin); assert(name); g_string_assign(plugin->info.name, name); - plugin->info.name_set = true; + plugin->info.name_set = BT_TRUE; } static inline @@ -207,7 +207,7 @@ void bt_plugin_set_description(struct bt_plugin *plugin, assert(plugin); assert(description); g_string_assign(plugin->info.description, description); - plugin->info.description_set = true; + plugin->info.description_set = BT_TRUE; } static inline @@ -216,7 +216,7 @@ void bt_plugin_set_author(struct bt_plugin *plugin, const char *author) assert(plugin); assert(author); g_string_assign(plugin->info.author, author); - plugin->info.author_set = true; + plugin->info.author_set = BT_TRUE; } static inline @@ -225,7 +225,7 @@ void bt_plugin_set_license(struct bt_plugin *plugin, const char *license) assert(plugin); assert(license); g_string_assign(plugin->info.license, license); - plugin->info.license_set = true; + plugin->info.license_set = BT_TRUE; } static inline @@ -241,14 +241,14 @@ void bt_plugin_set_version(struct bt_plugin *plugin, unsigned int major, g_string_assign(plugin->info.version.extra, extra); } - plugin->info.version_set = true; + plugin->info.version_set = BT_TRUE; } static inline void bt_plugin_freeze(struct bt_plugin *plugin) { assert(plugin); - plugin->frozen = true; + plugin->frozen = BT_TRUE; } static diff --git a/include/babeltrace/plugin/plugin-so-internal.h b/include/babeltrace/plugin/plugin-so-internal.h index 9c511769..07df7422 100644 --- a/include/babeltrace/plugin/plugin-so-internal.h +++ b/include/babeltrace/plugin/plugin-so-internal.h @@ -30,6 +30,7 @@ #include #include +#include struct bt_plugin; struct bt_component_class; @@ -40,7 +41,7 @@ struct bt_plugin_so_shared_lib_handle { GModule *module; /* True if initialization function was called */ - bool init_called; + bt_bool init_called; bt_plugin_exit_func exit; }; diff --git a/include/babeltrace/plugin/plugin.h b/include/babeltrace/plugin/plugin.h index 1738c27d..b9be6743 100644 --- a/include/babeltrace/plugin/plugin.h +++ b/include/babeltrace/plugin/plugin.h @@ -30,8 +30,8 @@ #include #include -#include #include +#include #ifdef __cplusplus extern "C" { @@ -62,7 +62,7 @@ extern struct bt_component_class *bt_plugin_find_component_class( extern struct bt_plugin_set *bt_plugin_create_all_from_file(const char *path); extern struct bt_plugin_set *bt_plugin_create_all_from_dir(const char *path, - bool recurse); + bt_bool recurse); extern struct bt_plugin_set *bt_plugin_create_all_from_static(void); diff --git a/include/babeltrace/types.h b/include/babeltrace/types.h new file mode 100644 index 00000000..f0bf0f10 --- /dev/null +++ b/include/babeltrace/types.h @@ -0,0 +1,81 @@ +#ifndef BABELTRACE_TYPES_H +#define BABELTRACE_TYPES_H + +/* + * Copyright (c) 2017 Philippe Proulx + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** +@defgroup ctypes Babeltrace C types +@ingroup apiref +@brief Babeltrace C types. + +@code +#include +@endcode + +This header contains custom type definitions used across the library. + +@file +@brief Babeltrace C types. +@sa ctypes + +@addtogroup ctypes +@{ +*/ + +/// False boolean value for the #bt_bool type. +#define BT_FALSE 0 + +/// True boolean value for the #bt_bool type. +#define BT_TRUE 1 + +/** +@brief Babeltrace's boolean type. + +Use only the #BT_FALSE and #BT_TRUE definitions for #bt_bool parameters. +It is guaranteed that the library functions which return a #bt_bool +value return either #BT_FALSE or #BT_TRUE. + +You can always test the truthness of a #bt_bool value directly, without +comparing it to #BT_TRUE directly: + +@code +bt_bool ret = bt_some_function(...); + +if (ret) { + // ret is true +} +@endcode +*/ +typedef int bt_bool; + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* BABELTRACE_TYPES_H */ diff --git a/include/babeltrace/values.h b/include/babeltrace/values.h index b0544ec2..d4a2214b 100644 --- a/include/babeltrace/values.h +++ b/include/babeltrace/values.h @@ -27,9 +27,9 @@ */ #include -#include #include #include +#include #ifdef __cplusplus extern "C" { @@ -235,7 +235,7 @@ enum bt_value_type { /// Null value object. BT_VALUE_TYPE_NULL = 0, - /// Boolean value object (holds \c true or \c false). + /// Boolean value object (holds #BT_TRUE or #BT_FALSE). BT_VALUE_TYPE_BOOL = 1, /// Integer value object (holds a signed 64-bit integer raw value). @@ -292,7 +292,7 @@ An alternative to calling this function is to directly compare the value object pointer to the \ref bt_value_null variable. @param[in] object Value object to check. -@returns \c true if \p object is the null value object. +@returns #BT_TRUE if \p object is the null value object. @prenotnull{object} @postrefcountsame{object} @@ -300,7 +300,7 @@ object pointer to the \ref bt_value_null variable. @sa bt_value_get_type(): Returns the type of a given value object. */ static inline -bool bt_value_is_null(const struct bt_value *object) +bt_bool bt_value_is_null(const struct bt_value *object) { return bt_value_get_type(object) == BT_VALUE_TYPE_NULL; } @@ -310,7 +310,7 @@ bool bt_value_is_null(const struct bt_value *object) value object. @param[in] object Value object to check. -@returns \c true if \p object is a boolean value object. +@returns #BT_TRUE if \p object is a boolean value object. @prenotnull{object} @postrefcountsame{object} @@ -318,7 +318,7 @@ bool bt_value_is_null(const struct bt_value *object) @sa bt_value_get_type(): Returns the type of a given value object. */ static inline -bool bt_value_is_bool(const struct bt_value *object) +bt_bool bt_value_is_bool(const struct bt_value *object) { return bt_value_get_type(object) == BT_VALUE_TYPE_BOOL; } @@ -328,12 +328,12 @@ bool bt_value_is_bool(const struct bt_value *object) value object. @param[in] object Value object to check. -@returns \c true if \p object is an integer value object. +@returns #BT_TRUE if \p object is an integer value object. @sa bt_value_get_type(): Returns the type of a given value object. */ static inline -bool bt_value_is_integer(const struct bt_value *object) +bt_bool bt_value_is_integer(const struct bt_value *object) { return bt_value_get_type(object) == BT_VALUE_TYPE_INTEGER; } @@ -343,7 +343,7 @@ bool bt_value_is_integer(const struct bt_value *object) point number value object. @param[in] object Value object to check. -@returns \c true if \p object is a floating point +@returns #BT_TRUE if \p object is a floating point number value object. @prenotnull{object} @@ -352,7 +352,7 @@ bool bt_value_is_integer(const struct bt_value *object) @sa bt_value_get_type(): Returns the type of a given value object. */ static inline -bool bt_value_is_float(const struct bt_value *object) +bt_bool bt_value_is_float(const struct bt_value *object) { return bt_value_get_type(object) == BT_VALUE_TYPE_FLOAT; } @@ -362,7 +362,7 @@ bool bt_value_is_float(const struct bt_value *object) value object. @param[in] object Value object to check. -@returns \c true if \p object is a string value object. +@returns #BT_TRUE if \p object is a string value object. @prenotnull{object} @postrefcountsame{object} @@ -370,7 +370,7 @@ bool bt_value_is_float(const struct bt_value *object) @sa bt_value_get_type(): Returns the type of a given value object. */ static inline -bool bt_value_is_string(const struct bt_value *object) +bt_bool bt_value_is_string(const struct bt_value *object) { return bt_value_get_type(object) == BT_VALUE_TYPE_STRING; } @@ -380,7 +380,7 @@ bool bt_value_is_string(const struct bt_value *object) value object. @param[in] object Value object to check. -@returns \c true if \p object is an array value object. +@returns #BT_TRUE if \p object is an array value object. @prenotnull{object} @postrefcountsame{object} @@ -388,7 +388,7 @@ bool bt_value_is_string(const struct bt_value *object) @sa bt_value_get_type(): Returns the type of a given value object. */ static inline -bool bt_value_is_array(const struct bt_value *object) +bt_bool bt_value_is_array(const struct bt_value *object) { return bt_value_get_type(object) == BT_VALUE_TYPE_ARRAY; } @@ -398,7 +398,7 @@ bool bt_value_is_array(const struct bt_value *object) object. @param[in] object Value object to check. -@returns \c true if \p object is a map value object. +@returns #BT_TRUE if \p object is a map value object. @prenotnull{object} @postrefcountsame{object} @@ -406,7 +406,7 @@ bool bt_value_is_array(const struct bt_value *object) @sa bt_value_get_type(): Returns the type of a given value object. */ static inline -bool bt_value_is_map(const struct bt_value *object) +bt_bool bt_value_is_map(const struct bt_value *object) { return bt_value_get_type(object) == BT_VALUE_TYPE_MAP; } @@ -451,12 +451,12 @@ extern enum bt_value_status bt_value_freeze(struct bt_value *object); @brief Returns whether or not the value object \p object is frozen. @param[in] object Value object to check. -@returns \c true if \p object is frozen. +@returns #BT_TRUE if \p object is frozen. @prenotnull{object} @postrefcountsame{object} */ -extern bool bt_value_is_frozen(const struct bt_value *object); +extern bt_bool bt_value_is_frozen(const struct bt_value *object); /** @brief Creates a \em deep copy of the value object \p object. @@ -477,19 +477,19 @@ extern struct bt_value *bt_value_copy(const struct bt_value *object); /** @brief Recursively compares the value objects \p object_a and - \p object_b and returns \c true if they have the same + \p object_b and returns #BT_TRUE if they have the same \em content (raw values). @param[in] object_a Value object A to compare to \p object_b. @param[in] object_b Value object B to compare to \p object_a. -@returns \c true if \p object_a and \p object_b have the - same \em content, or \c false if they differ +@returns #BT_TRUE if \p object_a and \p object_b have the + same \em content, or #BT_FALSE if they differ or on error. @postrefcountsame{object_a} @postrefcountsame{object_b} */ -extern bool bt_value_compare(const struct bt_value *object_a, +extern bt_bool bt_value_compare(const struct bt_value *object_a, const struct bt_value *object_b); /** @} */ @@ -502,7 +502,7 @@ extern bool bt_value_compare(const struct bt_value *object_a, /** @brief Creates a default boolean value object. -The created boolean value object's initial raw value is \c false. +The created boolean value object's initial raw value is #BT_FALSE. @returns Created boolean value object on success, or \c NULL on error. @@ -526,7 +526,7 @@ extern struct bt_value *bt_value_bool_create(void); @sa bt_value_bool_create(): Creates a default boolean value object. */ -extern struct bt_value *bt_value_bool_create_init(bool val); +extern struct bt_value *bt_value_bool_create_init(bt_bool val); /** @brief Returns the boolean raw value of the boolean value object @@ -545,7 +545,7 @@ extern struct bt_value *bt_value_bool_create_init(bool val); @sa bt_value_bool_set(): Sets the raw value of a boolean value object. */ extern enum bt_value_status bt_value_bool_get( - const struct bt_value *bool_obj, bool *val); + const struct bt_value *bool_obj, bt_bool *val); /** @brief Sets the boolean raw value of the boolean value object @@ -565,7 +565,7 @@ extern enum bt_value_status bt_value_bool_get( value object. */ extern enum bt_value_status bt_value_bool_set(struct bt_value *bool_obj, - bool val); + bt_bool val); /** @} */ @@ -850,7 +850,7 @@ extern int64_t bt_value_array_size(const struct bt_value *array_obj); is empty. @param[in] array_obj Array value object to check. -@returns \c true if \p array_obj is empty. +@returns #BT_TRUE if \p array_obj is empty. @prenotnull{array_obj} @pre \p array_obj is an array value object. @@ -859,7 +859,7 @@ extern int64_t bt_value_array_size(const struct bt_value *array_obj); @sa bt_value_array_size(): Returns the size of a given array value object. */ -extern bool bt_value_array_is_empty(const struct bt_value *array_obj); +extern bt_bool bt_value_array_is_empty(const struct bt_value *array_obj); /** @brief Returns the value object contained in the array value object @@ -934,7 +934,7 @@ value object before appending it. array value object. */ extern enum bt_value_status bt_value_array_append_bool( - struct bt_value *array_obj, bool val); + struct bt_value *array_obj, bt_bool val); /** @brief Appends the integer raw value \p val to the array value object @@ -1117,7 +1117,7 @@ extern int64_t bt_value_map_size(const struct bt_value *map_obj); @brief Checks whether or not the map value object \p map_obj is empty. @param[in] map_obj Map value object to check. -@returns \c true if \p map_obj is empty. +@returns #BT_TRUE if \p map_obj is empty. @prenotnull{map_obj} @pre \p map_obj is a map value object. @@ -1125,7 +1125,7 @@ extern int64_t bt_value_map_size(const struct bt_value *map_obj); @sa bt_value_map_size(): Returns the size of a given map value object. */ -extern bool bt_value_map_is_empty(const struct bt_value *map_obj); +extern bt_bool bt_value_map_is_empty(const struct bt_value *map_obj); /** @brief Returns the value object associated with the key \p key within @@ -1152,20 +1152,20 @@ extern struct bt_value *bt_value_map_get(const struct bt_value *map_obj, \p object is a weak reference: you \em must pass it to bt_get() if you need to keep a reference after this function returns. -This function \em must return \c true to continue the map value object -traversal, or \c false to break it. +This function \em must return #BT_TRUE to continue the map value object +traversal, or #BT_FALSE to break it. @param[in] key Key of map entry. @param[in] object Value object of map entry (weak reference). @param[in] data User data. -@returns \c true to continue the loop, or \c false to break it. +@returns #BT_TRUE to continue the loop, or #BT_FALSE to break it. @prenotnull{key} @prenotnull{object} @post The reference count of \p object is not lesser than what it is when the function is called. */ -typedef bool (* bt_value_map_foreach_cb)(const char *key, +typedef bt_bool (* bt_value_map_foreach_cb)(const char *key, struct bt_value *object, void *data); /** @@ -1179,8 +1179,8 @@ reference after the user function returns. The key passed to the user function is only valid in the scope of this user function call. -The user function \em must return \c true to continue the traversal of -\p map_obj, or \c false to break it. +The user function \em must return #BT_TRUE to continue the traversal of +\p map_obj, or #BT_FALSE to break it. @param[in] map_obj Map value object on which to iterate. @param[in] cb User function to call back. @@ -1205,8 +1205,8 @@ extern enum bt_value_status bt_value_map_foreach( @param[in] map_obj Map value object to check. @param[in] key Key to check. -@returns \c true if \p map_obj has an entry mapped to the - key \p key, or \c false if it does not or +@returns #BT_TRUE if \p map_obj has an entry mapped to the + key \p key, or #BT_FALSE if it does not or on error. @prenotnull{map_obj} @@ -1214,7 +1214,7 @@ extern enum bt_value_status bt_value_map_foreach( @pre \p map_obj is a map value object. @postrefcountsame{map_obj} */ -extern bool bt_value_map_has_key(const struct bt_value *map_obj, +extern bt_bool bt_value_map_has_key(const struct bt_value *map_obj, const char *key); /** @@ -1287,7 +1287,7 @@ On success, \p key is copied. value object. */ extern enum bt_value_status bt_value_map_insert_bool( - struct bt_value *map_obj, const char *key, bool val); + struct bt_value *map_obj, const char *key, bt_bool val); /** @brief Inserts the integer raw value \p val mapped to the key \p key diff --git a/lib/babeltrace.c b/lib/babeltrace.c index 090fc3bc..2b675eb2 100644 --- a/lib/babeltrace.c +++ b/lib/babeltrace.c @@ -27,18 +27,18 @@ */ #include +#include #include -#include -bool babeltrace_verbose, babeltrace_debug; +bt_bool babeltrace_verbose, babeltrace_debug; static void __attribute__((constructor)) init_babeltrace_lib(void) { if (getenv("BABELTRACE_VERBOSE")) - babeltrace_verbose = 1; + babeltrace_verbose = BT_TRUE; if (getenv("BABELTRACE_DEBUG")) - babeltrace_debug = 1; + babeltrace_debug = BT_TRUE; } int bt_version_get_major(void) diff --git a/lib/ctf-ir/clock-class.c b/lib/ctf-ir/clock-class.c index eca2c264..0c27f1ad 100644 --- a/lib/ctf-ir/clock-class.c +++ b/lib/ctf-ir/clock-class.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #define BT_LOG_TAG "CLOCK-CLASS" @@ -40,7 +41,7 @@ static void bt_ctf_clock_class_destroy(struct bt_object *obj); BT_HIDDEN -bool bt_ctf_clock_class_is_valid(struct bt_ctf_clock_class *clock_class) +bt_bool bt_ctf_clock_class_is_valid(struct bt_ctf_clock_class *clock_class) { return clock_class && clock_class->name; } diff --git a/lib/ctf-ir/event-class.c b/lib/ctf-ir/event-class.c index 8dc4619d..49cca8c6 100644 --- a/lib/ctf-ir/event-class.c +++ b/lib/ctf-ir/event-class.c @@ -39,6 +39,7 @@ #include #include #include +#include #include static @@ -656,7 +657,7 @@ int bt_ctf_event_class_serialize(struct bt_ctf_event_class *event_class, default: /* should never happen */ - assert(false); + assert(BT_FALSE); break; } diff --git a/lib/ctf-ir/field-types.c b/lib/ctf-ir/field-types.c index 3ce3758b..6f46f2cb 100644 --- a/lib/ctf-ir/field-types.c +++ b/lib/ctf-ir/field-types.c @@ -356,7 +356,7 @@ gint compare_enumeration_mappings_unsigned(struct enumeration_mapping **a, } static -void bt_ctf_field_type_init(struct bt_ctf_field_type *type, bool init_bo) +void bt_ctf_field_type_init(struct bt_ctf_field_type *type, bt_bool init_bo) { assert(type && (type->id > BT_CTF_FIELD_TYPE_ID_UNKNOWN) && (type->id < BT_CTF_NR_TYPE_IDS)); @@ -491,7 +491,7 @@ void set_enumeration_range_overlap( <= mapping[1]->range_end._signed && mapping[0]->range_end._signed >= mapping[1]->range_start._signed) { - enumeration_type->has_overlapping_ranges = true; + enumeration_type->has_overlapping_ranges = BT_TRUE; return; } } else { @@ -499,7 +499,7 @@ void set_enumeration_range_overlap( <= mapping[1]->range_end._unsigned && mapping[0]->range_end._unsigned >= mapping[1]->range_start._unsigned) { - enumeration_type->has_overlapping_ranges = true; + enumeration_type->has_overlapping_ranges = BT_TRUE; return; } } @@ -620,7 +620,7 @@ end: } static -bool bt_ctf_field_type_enumeration_has_overlapping_ranges( +bt_bool bt_ctf_field_type_enumeration_has_overlapping_ranges( struct bt_ctf_field_type_enumeration *enumeration_type) { if (!enumeration_type->parent.frozen) { diff --git a/lib/ctf-ir/fields.c b/lib/ctf-ir/fields.c index 28a5e937..5223d778 100644 --- a/lib/ctf-ir/fields.c +++ b/lib/ctf-ir/fields.c @@ -164,17 +164,17 @@ static void bt_ctf_field_sequence_freeze(struct bt_ctf_field *); static -bool bt_ctf_field_generic_is_set(struct bt_ctf_field *); +bt_bool bt_ctf_field_generic_is_set(struct bt_ctf_field *); static -bool bt_ctf_field_structure_is_set(struct bt_ctf_field *); +bt_bool bt_ctf_field_structure_is_set(struct bt_ctf_field *); static -bool bt_ctf_field_variant_is_set(struct bt_ctf_field *); +bt_bool bt_ctf_field_variant_is_set(struct bt_ctf_field *); static -bool bt_ctf_field_enumeration_is_set(struct bt_ctf_field *); +bt_bool bt_ctf_field_enumeration_is_set(struct bt_ctf_field *); static -bool bt_ctf_field_array_is_set(struct bt_ctf_field *); +bt_bool bt_ctf_field_array_is_set(struct bt_ctf_field *); static -bool bt_ctf_field_sequence_is_set(struct bt_ctf_field *); +bt_bool bt_ctf_field_sequence_is_set(struct bt_ctf_field *); static int increase_packet_size(struct bt_ctf_stream_pos *pos); @@ -270,7 +270,7 @@ void (* const field_freeze_funcs[])(struct bt_ctf_field *) = { }; static -bool (* const field_is_set_funcs[])(struct bt_ctf_field *) = { +bt_bool (* const field_is_set_funcs[])(struct bt_ctf_field *) = { [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_generic_is_set, [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_is_set, [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_generic_is_set, @@ -1269,9 +1269,9 @@ end: BT_HIDDEN -bool bt_ctf_field_is_set(struct bt_ctf_field *field) +bt_bool bt_ctf_field_is_set(struct bt_ctf_field *field) { - bool is_set = false; + bt_bool is_set = BT_FALSE; enum bt_ctf_field_type_id type_id; if (!field) { @@ -2423,15 +2423,15 @@ end: } static -bool bt_ctf_field_generic_is_set(struct bt_ctf_field *field) +bt_bool bt_ctf_field_generic_is_set(struct bt_ctf_field *field) { return field && field->payload_set; } static -bool bt_ctf_field_enumeration_is_set(struct bt_ctf_field *field) +bt_bool bt_ctf_field_enumeration_is_set(struct bt_ctf_field *field) { - bool is_set = false; + bt_bool is_set = BT_FALSE; struct bt_ctf_field_enumeration *enumeration; if (!field) { @@ -2450,9 +2450,9 @@ end: } static -bool bt_ctf_field_structure_is_set(struct bt_ctf_field *field) +bt_bool bt_ctf_field_structure_is_set(struct bt_ctf_field *field) { - bool is_set = false; + bt_bool is_set = BT_FALSE; size_t i; struct bt_ctf_field_structure *structure; @@ -2472,9 +2472,9 @@ end: } static -bool bt_ctf_field_variant_is_set(struct bt_ctf_field *field) +bt_bool bt_ctf_field_variant_is_set(struct bt_ctf_field *field) { - bool is_set = false; + bt_bool is_set = BT_FALSE; struct bt_ctf_field_variant *variant; if (!field) { @@ -2488,10 +2488,10 @@ end: } static -bool bt_ctf_field_array_is_set(struct bt_ctf_field *field) +bt_bool bt_ctf_field_array_is_set(struct bt_ctf_field *field) { size_t i; - bool is_set = false; + bt_bool is_set = BT_FALSE; struct bt_ctf_field_array *array; if (!field) { @@ -2510,10 +2510,10 @@ end: } static -bool bt_ctf_field_sequence_is_set(struct bt_ctf_field *field) +bt_bool bt_ctf_field_sequence_is_set(struct bt_ctf_field *field) { size_t i; - bool is_set = false; + bt_bool is_set = BT_FALSE; struct bt_ctf_field_sequence *sequence; if (!field) { diff --git a/lib/ctf-ir/resolve.c b/lib/ctf-ir/resolve.c index f72652ef..2ab457ab 100644 --- a/lib/ctf-ir/resolve.c +++ b/lib/ctf-ir/resolve.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -170,7 +171,7 @@ end: * Checks whether or not `stack` is empty. */ static -bool type_stack_empty(type_stack *stack) +bt_bool type_stack_empty(type_stack *stack) { return stack->len == 0; } @@ -384,7 +385,7 @@ int ptokens_to_field_path(GList *ptokens, struct bt_ctf_field_path *field_path, { int ret = 0; GList *cur_ptoken = ptokens; - bool first_level_done = false; + bt_bool first_level_done = BT_FALSE; /* Get our own reference */ bt_get(type); @@ -422,7 +423,7 @@ int ptokens_to_field_path(GList *ptokens, struct bt_ctf_field_path *field_path, /* Next path token */ cur_ptoken = g_list_next(cur_ptoken); - first_level_done = true; + first_level_done = BT_TRUE; } /* Create new field path entry */ @@ -527,7 +528,7 @@ int relative_ptokens_to_field_path(GList *ptokens, int tail_field_path_len = tail_field_path->indexes->len; - while (true) { + while (BT_TRUE) { struct bt_ctf_field_type *cur_type = type_stack_at(ctx->type_stack, i)->type; int index = type_stack_at( @@ -764,7 +765,7 @@ int get_field_paths_lca_index(struct bt_ctf_field_path *field_path1, field_path1_len = field_path1->indexes->len; field_path2_len = field_path2->indexes->len; - while (true) { + while (BT_TRUE) { int target_index, ctx_index; if (lca_index == field_path2_len || @@ -893,7 +894,7 @@ int validate_target_field_path(struct bt_ctf_field_path *target_field_path, goto end; } } else { - assert(false); + assert(BT_FALSE); } end: @@ -927,7 +928,7 @@ int resolve_sequence_or_variant_type(struct bt_ctf_field_type *type, bt_ctf_field_type_variant_get_tag_name(type); break; default: - assert(false); + assert(BT_FALSE); ret = -1; goto end; } @@ -980,7 +981,7 @@ int resolve_sequence_or_variant_type(struct bt_ctf_field_type *type, goto end; } } else { - assert(false); + assert(BT_FALSE); } end: diff --git a/lib/ctf-ir/stream.c b/lib/ctf-ir/stream.c index 84d7c684..67b6ea3b 100644 --- a/lib/ctf-ir/stream.c +++ b/lib/ctf-ir/stream.c @@ -919,13 +919,13 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) struct bt_ctf_stream_pos packet_context_pos; struct bt_ctf_trace *trace; enum bt_ctf_byte_order native_byte_order; - bool empty_packet; + bt_bool empty_packet; uint64_t packet_size_bits; struct { - bool timestamp_begin; - bool timestamp_end; - bool content_size; - bool packet_size; + bt_bool timestamp_begin; + bt_bool timestamp_end; + bt_bool content_size; + bt_bool packet_size; } auto_set_fields = { 0 }; if (!stream || stream->pos.fd < 0) { @@ -1201,7 +1201,7 @@ void bt_ctf_stream_destroy(struct bt_object *obj) static int _set_structure_field_integer(struct bt_ctf_field *structure, char *name, - uint64_t value, bool force) + uint64_t value, bt_bool force) { int ret = 0; struct bt_ctf_field_type *field_type = NULL; @@ -1253,7 +1253,7 @@ static int set_structure_field_integer(struct bt_ctf_field *structure, char *name, uint64_t value) { - return _set_structure_field_integer(structure, name, value, true); + return _set_structure_field_integer(structure, name, value, BT_TRUE); } /* @@ -1266,7 +1266,7 @@ static int try_set_structure_field_integer(struct bt_ctf_field *structure, char *name, uint64_t value) { - return _set_structure_field_integer(structure, name, value, false); + return _set_structure_field_integer(structure, name, value, BT_FALSE); } const char *bt_ctf_stream_get_name(struct bt_ctf_stream *stream) diff --git a/lib/ctf-ir/trace.c b/lib/ctf-ir/trace.c index ba18eab8..d36d4981 100644 --- a/lib/ctf-ir/trace.c +++ b/lib/ctf-ir/trace.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -175,7 +176,7 @@ int bt_ctf_trace_set_uuid(struct bt_ctf_trace *trace, const unsigned char *uuid) } memcpy(trace->uuid, uuid, sizeof(uuid_t)); - trace->uuid_set = true; + trace->uuid_set = BT_TRUE; end: return ret; @@ -867,7 +868,7 @@ end: } BT_HIDDEN -bool bt_ctf_trace_has_clock_class(struct bt_ctf_trace *trace, +bt_bool bt_ctf_trace_has_clock_class(struct bt_ctf_trace *trace, struct bt_ctf_clock_class *clock_class) { struct search_query query = { .value = clock_class, .found = 0 }; @@ -895,7 +896,7 @@ const char *get_byte_order_string(enum bt_ctf_byte_order byte_order) string = "native"; break; default: - assert(false); + assert(BT_FALSE); } return string; @@ -1292,9 +1293,9 @@ void bt_ctf_trace_freeze(struct bt_ctf_trace *trace) trace->frozen = 1; } -bool bt_ctf_trace_is_static(struct bt_ctf_trace *trace) +bt_bool bt_ctf_trace_is_static(struct bt_ctf_trace *trace) { - bool is_static = false; + bt_bool is_static = BT_FALSE; if (!trace) { goto end; @@ -1315,7 +1316,7 @@ int bt_ctf_trace_set_is_static(struct bt_ctf_trace *trace) goto end; } - trace->is_static = true; + trace->is_static = BT_TRUE; bt_ctf_trace_freeze(trace); end: diff --git a/lib/ctf-writer/serialize.c b/lib/ctf-writer/serialize.c index e0239f65..e2fa56d7 100644 --- a/lib/ctf-writer/serialize.c +++ b/lib/ctf-writer/serialize.c @@ -30,7 +30,6 @@ #include #include -#include #include #include #include @@ -41,6 +40,7 @@ #include #include #include +#include #include #if (FLT_RADIX != 2) @@ -60,9 +60,9 @@ union intval { static int aligned_integer_write(struct bt_ctf_stream_pos *pos, union intval value, unsigned int alignment, unsigned int size, - bool is_signed, enum bt_ctf_byte_order byte_order) + bt_bool is_signed, enum bt_ctf_byte_order byte_order) { - bool rbo = (byte_order != BT_CTF_MY_BYTE_ORDER); /* reverse byte order */ + bt_bool rbo = (byte_order != BT_CTF_MY_BYTE_ORDER); /* reverse byte order */ if (!bt_ctf_stream_pos_align(pos, alignment)) return -EFAULT; @@ -108,7 +108,7 @@ int aligned_integer_write(struct bt_ctf_stream_pos *pos, break; } default: - assert(false); + assert(BT_FALSE); } } else { switch (size) { @@ -147,7 +147,7 @@ int aligned_integer_write(struct bt_ctf_stream_pos *pos, break; } default: - assert(false); + assert(BT_FALSE); } } @@ -158,7 +158,7 @@ int aligned_integer_write(struct bt_ctf_stream_pos *pos, static int integer_write(struct bt_ctf_stream_pos *pos, union intval value, - unsigned int alignment, unsigned int size, bool is_signed, + unsigned int alignment, unsigned int size, bt_bool is_signed, enum bt_ctf_byte_order byte_order) { if (!(alignment % CHAR_BIT) @@ -259,7 +259,7 @@ int bt_ctf_field_floating_point_write( return -EINVAL; } - return integer_write(pos, value, type->alignment, size, false, + return integer_write(pos, value, type->alignment, size, BT_FALSE, byte_order); } @@ -275,7 +275,7 @@ void bt_ctf_stream_pos_packet_seek(struct bt_ctf_stream_pos *pos, size_t index, /* unmap old base */ ret = munmap_align(pos->base_mma); if (ret) { - assert(false); + assert(BT_FALSE); } pos->base_mma = NULL; } @@ -295,6 +295,6 @@ void bt_ctf_stream_pos_packet_seek(struct bt_ctf_stream_pos *pos, size_t index, pos->base_mma = mmap_align(pos->packet_size / CHAR_BIT, pos->prot, pos->flags, pos->fd, pos->mmap_offset); if (pos->base_mma == MAP_FAILED) { - assert(false); + assert(BT_FALSE); } } diff --git a/lib/ctf-writer/writer.c b/lib/ctf-writer/writer.c index 6c4bbded..c005993b 100644 --- a/lib/ctf-writer/writer.c +++ b/lib/ctf-writer/writer.c @@ -217,7 +217,7 @@ struct bt_ctf_stream *bt_ctf_writer_create_stream(struct bt_ctf_writer *writer, { struct bt_ctf_stream *stream = NULL; int stream_class_count; - bool stream_class_found = false; + bt_bool stream_class_found = BT_FALSE; int i; if (!writer || !stream_class) { @@ -236,7 +236,7 @@ struct bt_ctf_stream *bt_ctf_writer_create_stream(struct bt_ctf_writer *writer, writer->trace, i); if (existing_stream_class == stream_class) { - stream_class_found = true; + stream_class_found = BT_TRUE; } BT_PUT(existing_stream_class); diff --git a/lib/graph/component-class.c b/lib/graph/component-class.c index b438f104..b4613a23 100644 --- a/lib/graph/component-class.c +++ b/lib/graph/component-class.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include static @@ -529,7 +529,7 @@ int bt_component_class_freeze( goto end; } - component_class->frozen = true; + component_class->frozen = BT_TRUE; end: return ret; diff --git a/lib/graph/component.c b/lib/graph/component.c index c4f26a89..c541985b 100644 --- a/lib/graph/component.c +++ b/lib/graph/component.c @@ -41,6 +41,7 @@ #include #include #include +#include #include static @@ -272,20 +273,20 @@ struct bt_component *bt_component_create_with_init_method_data( goto end; } - component->initializing = true; + component->initializing = BT_TRUE; if (component_class->methods.init) { ret = component_class->methods.init( bt_private_component_from_component(component), params, init_method_data); - component->initializing = false; + component->initializing = BT_FALSE; if (ret != BT_COMPONENT_STATUS_OK) { BT_PUT(component); goto end; } } - component->initializing = false; + component->initializing = BT_FALSE; ret = component_validation_funcs[type](component); if (ret != BT_COMPONENT_STATUS_OK) { BT_PUT(component); diff --git a/lib/graph/graph.c b/lib/graph/graph.c index 35ccde70..8e4dbf68 100644 --- a/lib/graph/graph.c +++ b/lib/graph/graph.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -155,8 +156,8 @@ struct bt_connection *bt_graph_connect_ports(struct bt_graph *graph, struct bt_component *upstream_component = NULL; struct bt_component *downstream_component = NULL; enum bt_component_status component_status; - bool upstream_was_already_in_graph; - bool downstream_was_already_in_graph; + bt_bool upstream_was_already_in_graph; + bt_bool downstream_was_already_in_graph; if (!graph || !upstream_port || !downstream_port) { goto end; @@ -324,7 +325,7 @@ enum bt_component_status get_component_port_counts( } break; default: - assert(false); + assert(BT_FALSE); break; } ret = BT_COMPONENT_STATUS_OK; diff --git a/lib/graph/iterator.c b/lib/graph/iterator.c index c76293a9..36098200 100644 --- a/lib/graph/iterator.c +++ b/lib/graph/iterator.c @@ -44,12 +44,13 @@ #include #include #include +#include #include struct stream_state { struct bt_ctf_stream *stream; /* owned by this */ struct bt_ctf_packet *cur_packet; /* owned by this */ - bool is_ended; + bt_bool is_ended; }; enum action_type { @@ -141,7 +142,7 @@ void destroy_action(struct action *action) case ACTION_TYPE_SET_STREAM_STATE_IS_ENDED: break; default: - assert(false); + assert(BT_FALSE); } } @@ -219,7 +220,7 @@ void apply_actions(struct bt_notification_iterator *iterator) bt_ctf_stream_add_destroy_listener( action->payload.set_stream_state_is_ended.stream_state->stream, stream_destroy_listener, iterator); - action->payload.set_stream_state_is_ended.stream_state->is_ended = true; + action->payload.set_stream_state_is_ended.stream_state->is_ended = BT_TRUE; BT_PUT(action->payload.set_stream_state_is_ended.stream_state->stream); break; case ACTION_TYPE_SET_STREAM_STATE_CUR_PACKET: @@ -228,7 +229,7 @@ void apply_actions(struct bt_notification_iterator *iterator) action->payload.set_stream_state_cur_packet.packet); break; default: - assert(false); + assert(BT_FALSE); } } @@ -543,19 +544,19 @@ bt_notification_iterator_notif_type_from_notif_type( iter_notif_type = BT_NOTIFICATION_ITERATOR_NOTIF_TYPE_PACKET_END; break; default: - assert(false); + assert(BT_FALSE); } return iter_notif_type; } static -bool validate_notification(struct bt_notification_iterator *iterator, +bt_bool validate_notification(struct bt_notification_iterator *iterator, struct bt_notification *notif, struct bt_ctf_stream *notif_stream, struct bt_ctf_packet *notif_packet) { - bool is_valid = true; + bt_bool is_valid = BT_TRUE; struct stream_state *stream_state; struct bt_port *stream_comp_cur_port; @@ -589,7 +590,7 @@ bool validate_notification(struct bt_notification_iterator *iterator, * bad: the API guarantees that it can never * happen. */ - is_valid = false; + is_valid = BT_FALSE; goto end; } @@ -607,7 +608,7 @@ bool validate_notification(struct bt_notification_iterator *iterator, * bad: the API guarantees that it can never * happen. */ - is_valid = false; + is_valid = BT_FALSE; goto end; } @@ -618,12 +619,12 @@ bool validate_notification(struct bt_notification_iterator *iterator, * we already returned a "stream begin" * notification: this is an invalid duplicate. */ - is_valid = false; + is_valid = BT_FALSE; goto end; case BT_NOTIFICATION_TYPE_PACKET_BEGIN: if (notif_packet == stream_state->cur_packet) { /* Duplicate "packet begin" notification */ - is_valid = false; + is_valid = BT_FALSE; goto end; } break; @@ -637,14 +638,14 @@ end: } static -bool is_subscribed_to_notification_type(struct bt_notification_iterator *iterator, +bt_bool is_subscribed_to_notification_type(struct bt_notification_iterator *iterator, enum bt_notification_type notif_type) { uint32_t iter_notif_type = (uint32_t) bt_notification_iterator_notif_type_from_notif_type( notif_type); - return (iter_notif_type & iterator->subscription_mask) ? true : false; + return (iter_notif_type & iterator->subscription_mask) ? BT_TRUE : BT_FALSE; } static @@ -1290,7 +1291,7 @@ enum bt_notification_iterator_status ensure_queue_has_notifications( break; } default: - assert(false); + assert(BT_FALSE); break; } @@ -1319,7 +1320,7 @@ enum bt_notification_iterator_status ensure_queue_has_notifications( status = BT_NOTIFICATION_ITERATOR_STATUS_END; } - iterator->is_ended = true; + iterator->is_ended = BT_TRUE; goto end; case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN: status = BT_NOTIFICATION_ITERATOR_STATUS_AGAIN; @@ -1345,7 +1346,7 @@ enum bt_notification_iterator_status ensure_queue_has_notifications( break; default: /* Unknown non-error status */ - assert(false); + assert(BT_FALSE); } } diff --git a/lib/graph/notification/event.c b/lib/graph/notification/event.c index 8d9d6f3d..8e5d6724 100644 --- a/lib/graph/notification/event.c +++ b/lib/graph/notification/event.c @@ -33,6 +33,7 @@ #include #include #include +#include static void bt_notification_event_destroy(struct bt_object *obj) @@ -46,7 +47,7 @@ void bt_notification_event_destroy(struct bt_object *obj) } static -bool validate_clock_classes(struct bt_notification_event *notif) +bt_bool validate_clock_classes(struct bt_notification_event *notif) { /* * For each clock class found in the notification's clock class @@ -54,7 +55,7 @@ bool validate_clock_classes(struct bt_notification_event *notif) * this clock class. Also make sure that those clock classes * are part of the trace to which the event belongs. */ - bool is_valid = true; + bt_bool is_valid = BT_TRUE; int trace_cc_count; int cc_prio_map_cc_count; size_t cc_prio_map_cc_i, trace_cc_i; @@ -81,13 +82,13 @@ bool validate_clock_classes(struct bt_notification_event *notif) bt_clock_class_priority_map_get_clock_class_by_index( notif->cc_prio_map, cc_prio_map_cc_i); struct bt_ctf_clock_value *clock_value; - bool found_in_trace = false; + bt_bool found_in_trace = BT_FALSE; assert(clock_class); clock_value = bt_ctf_event_get_clock_value(notif->event, clock_class); if (!clock_value) { - is_valid = false; + is_valid = BT_FALSE; goto end; } @@ -102,7 +103,7 @@ bool validate_clock_classes(struct bt_notification_event *notif) assert(trace_clock_class); if (trace_clock_class == clock_class) { - found_in_trace = true; + found_in_trace = BT_TRUE; break; } } @@ -110,7 +111,7 @@ bool validate_clock_classes(struct bt_notification_event *notif) bt_put(clock_class); if (!found_in_trace) { - is_valid = false; + is_valid = BT_FALSE; goto end; } } diff --git a/lib/plugin/plugin-so.c b/lib/plugin/plugin-so.c index 7b152e2c..ab2f4860 100644 --- a/lib/plugin/plugin-so.c +++ b/lib/plugin/plugin-so.c @@ -34,8 +34,8 @@ #include #include #include +#include #include -#include #include #include @@ -431,7 +431,7 @@ enum bt_plugin_status bt_plugin_so_init( } } - spec->shared_lib_handle->init_called = true; + spec->shared_lib_handle->init_called = BT_TRUE; /* Add described component classes to plugin */ for (i = 0; i < comp_class_full_descriptors->len; i++) { @@ -621,7 +621,7 @@ enum bt_plugin_status bt_plugin_so_init( case BT_COMPONENT_CLASS_TYPE_SINK: break; default: - assert(false); + assert(BT_FALSE); break; } @@ -813,7 +813,7 @@ struct bt_plugin_set *bt_plugin_so_create_all_from_file(const char *path) struct __bt_plugin_component_class_descriptor const * const *cc_descriptors_end = NULL; struct __bt_plugin_component_class_descriptor_attribute const * const *cc_descr_attrs_begin = NULL; struct __bt_plugin_component_class_descriptor_attribute const * const *cc_descr_attrs_end = NULL; - bool is_libtool_wrapper = false, is_shared_object = false; + bt_bool is_libtool_wrapper = BT_FALSE, is_shared_object = BT_FALSE; struct bt_plugin_so_shared_lib_handle *shared_lib_handle = NULL; if (!path) { diff --git a/lib/plugin/plugin.c b/lib/plugin/plugin.c index 4a36fd69..d219fe89 100644 --- a/lib/plugin/plugin.c +++ b/lib/plugin/plugin.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -222,7 +223,7 @@ struct bt_plugin *bt_plugin_find(const char *plugin_name) printf_verbose("Trying to load plugins from directory `%s`\n", dir->str); BT_PUT(plugin_set); - plugin_set = bt_plugin_create_all_from_dir(dir->str, false); + plugin_set = bt_plugin_create_all_from_dir(dir->str, BT_FALSE); if (!plugin_set) { continue; } @@ -308,7 +309,7 @@ struct dirent *alloc_dirent(const char *path) static enum bt_plugin_status bt_plugin_create_append_all_from_dir( struct bt_plugin_set *plugin_set, const char *path, - bool recurse) + bt_bool recurse) { DIR *directory = NULL; struct dirent *entry = NULL, *result = NULL; @@ -382,7 +383,7 @@ enum bt_plugin_status bt_plugin_create_append_all_from_dir( if (S_ISDIR(st.st_mode) && recurse) { ret = bt_plugin_create_append_all_from_dir(plugin_set, - file_path, true); + file_path, BT_TRUE); if (ret < 0) { goto end; } @@ -421,7 +422,7 @@ end: } struct bt_plugin_set *bt_plugin_create_all_from_dir(const char *path, - bool recurse) + bt_bool recurse) { struct bt_plugin_set *plugin_set; enum bt_plugin_status status; diff --git a/lib/values.c b/lib/values.c index 8c942963..abe36fd2 100644 --- a/lib/values.c +++ b/lib/values.c @@ -35,6 +35,7 @@ #include #include #include +#include #define BT_LOG_TAG "VALUES" #include @@ -50,7 +51,7 @@ struct bt_value { struct bt_object base; enum bt_value_type type; - bool is_frozen; + bt_bool is_frozen; }; static @@ -64,14 +65,14 @@ struct bt_value bt_value_null_instance = { .parent = NULL, }, .type = BT_VALUE_TYPE_NULL, - .is_frozen = true, + .is_frozen = BT_TRUE, }; struct bt_value *bt_value_null = &bt_value_null_instance; struct bt_value_bool { struct bt_value base; - bool value; + bt_bool value; }; struct bt_value_integer { @@ -292,19 +293,19 @@ struct bt_value *(* const copy_funcs[])(const struct bt_value *) = { }; static -bool bt_value_null_compare(const struct bt_value *object_a, +bt_bool bt_value_null_compare(const struct bt_value *object_a, const struct bt_value *object_b) { /* - * Always true since bt_value_compare() already checks if both + * Always BT_TRUE since bt_value_compare() already checks if both * object_a and object_b have the same type, and in the case of * null value objects, they're always the same if it is so. */ - return true; + return BT_TRUE; } static -bool bt_value_bool_compare(const struct bt_value *object_a, +bt_bool bt_value_bool_compare(const struct bt_value *object_a, const struct bt_value *object_b) { return BT_VALUE_TO_BOOL(object_a)->value == @@ -312,7 +313,7 @@ bool bt_value_bool_compare(const struct bt_value *object_a, } static -bool bt_value_integer_compare(const struct bt_value *object_a, +bt_bool bt_value_integer_compare(const struct bt_value *object_a, const struct bt_value *object_b) { return BT_VALUE_TO_INTEGER(object_a)->value == @@ -320,7 +321,7 @@ bool bt_value_integer_compare(const struct bt_value *object_a, } static -bool bt_value_float_compare(const struct bt_value *object_a, +bt_bool bt_value_float_compare(const struct bt_value *object_a, const struct bt_value *object_b) { return BT_VALUE_TO_FLOAT(object_a)->value == @@ -328,7 +329,7 @@ bool bt_value_float_compare(const struct bt_value *object_a, } static -bool bt_value_string_compare(const struct bt_value *object_a, +bt_bool bt_value_string_compare(const struct bt_value *object_a, const struct bt_value *object_b) { return !strcmp(BT_VALUE_TO_STRING(object_a)->gstr->str, @@ -336,11 +337,11 @@ bool bt_value_string_compare(const struct bt_value *object_a, } static -bool bt_value_array_compare(const struct bt_value *object_a, +bt_bool bt_value_array_compare(const struct bt_value *object_a, const struct bt_value *object_b) { int i; - bool ret = true; + bt_bool ret = BT_TRUE; const struct bt_value_array *array_obj_a = BT_VALUE_TO_ARRAY(object_a); @@ -351,7 +352,7 @@ bool bt_value_array_compare(const struct bt_value *object_a, object_a, object_b, bt_value_array_size(object_a), bt_value_array_size(object_b)); - ret = false; + ret = BT_FALSE; goto end; } @@ -368,7 +369,7 @@ bool bt_value_array_compare(const struct bt_value *object_a, element_obj_a, element_obj_b, index); BT_PUT(element_obj_a); BT_PUT(element_obj_b); - ret = false; + ret = BT_FALSE; goto end; } @@ -381,10 +382,10 @@ end: } static -bool bt_value_map_compare(const struct bt_value *object_a, +bt_bool bt_value_map_compare(const struct bt_value *object_a, const struct bt_value *object_b) { - bool ret = true; + bt_bool ret = BT_TRUE; GHashTableIter iter; gpointer key, element_obj_a; const struct bt_value_map *map_obj_a = BT_VALUE_TO_MAP(object_a); @@ -396,7 +397,7 @@ bool bt_value_map_compare(const struct bt_value *object_a, object_a, object_b, bt_value_map_size(object_a), bt_value_map_size(object_b)); - ret = false; + ret = BT_FALSE; goto end; } @@ -413,7 +414,7 @@ bool bt_value_map_compare(const struct bt_value *object_a, "value-a-addr=%p, value-b-addr=%p, key=\"%s\"", element_obj_a, element_obj_b, key_str); BT_PUT(element_obj_b); - ret = false; + ret = BT_FALSE; goto end; } @@ -425,7 +426,7 @@ end: } static -bool (* const compare_funcs[])(const struct bt_value *, +bt_bool (* const compare_funcs[])(const struct bt_value *, const struct bt_value *) = { [BT_VALUE_TYPE_NULL] = bt_value_null_compare, [BT_VALUE_TYPE_BOOL] = bt_value_bool_compare, @@ -442,7 +443,7 @@ void bt_value_null_freeze(struct bt_value *object) void bt_value_generic_freeze(struct bt_value *object) { - object->is_frozen = true; + object->is_frozen = BT_TRUE; } void bt_value_array_freeze(struct bt_value *object) @@ -530,7 +531,7 @@ end: return ret; } -bool bt_value_is_frozen(const struct bt_value *object) +bt_bool bt_value_is_frozen(const struct bt_value *object) { return object && object->is_frozen; } @@ -551,12 +552,12 @@ struct bt_value bt_value_create_base(enum bt_value_type type) struct bt_value base; base.type = type; - base.is_frozen = false; + base.is_frozen = BT_FALSE; bt_object_init(&base, bt_value_destroy); return base; } -struct bt_value *bt_value_bool_create_init(bool val) +struct bt_value *bt_value_bool_create_init(bt_bool val) { struct bt_value_bool *bool_obj; @@ -578,7 +579,7 @@ end: struct bt_value *bt_value_bool_create(void) { - return bt_value_bool_create_init(false); + return bt_value_bool_create_init(BT_FALSE); } struct bt_value *bt_value_integer_create_init(int64_t val) @@ -733,7 +734,7 @@ end: } enum bt_value_status bt_value_bool_get(const struct bt_value *bool_obj, - bool *val) + bt_bool *val) { enum bt_value_status ret = BT_VALUE_STATUS_OK; struct bt_value_bool *typed_bool_obj = BT_VALUE_TO_BOOL(bool_obj); @@ -759,7 +760,7 @@ end: return ret; } -enum bt_value_status bt_value_bool_set(struct bt_value *bool_obj, bool val) +enum bt_value_status bt_value_bool_set(struct bt_value *bool_obj, bt_bool val) { enum bt_value_status ret = BT_VALUE_STATUS_OK; struct bt_value_bool *typed_bool_obj = BT_VALUE_TO_BOOL(bool_obj); @@ -1008,7 +1009,7 @@ end: return ret; } -bool bt_value_array_is_empty(const struct bt_value *array_obj) +bt_bool bt_value_array_is_empty(const struct bt_value *array_obj) { return bt_value_array_size(array_obj) == 0; } @@ -1089,7 +1090,7 @@ end: } enum bt_value_status bt_value_array_append_bool(struct bt_value *array_obj, - bool val) + bt_bool val) { enum bt_value_status ret; struct bt_value *bool_obj = NULL; @@ -1231,7 +1232,7 @@ end: return ret; } -bool bt_value_map_is_empty(const struct bt_value *map_obj) +bt_bool bt_value_map_is_empty(const struct bt_value *map_obj) { return bt_value_map_size(map_obj) == 0; } @@ -1268,23 +1269,23 @@ end: return ret; } -bool bt_value_map_has_key(const struct bt_value *map_obj, const char *key) +bt_bool bt_value_map_has_key(const struct bt_value *map_obj, const char *key) { - bool ret; + bt_bool ret; GQuark quark; struct bt_value_map *typed_map_obj = BT_VALUE_TO_MAP(map_obj); if (!map_obj || !key) { BT_LOGW("Invalid parameter: value object or key is NULL: " "value-addr=%p, key-addr=%p", map_obj, key); - ret = false; + ret = BT_FALSE; goto end; } if (!bt_value_is_map(map_obj)) { BT_LOGW("Invalid parameter: value is not a map value: addr=%p, " "type=%d", map_obj, map_obj->type); - ret = false; + ret = BT_FALSE; goto end; } @@ -1338,7 +1339,7 @@ end: } enum bt_value_status bt_value_map_insert_bool(struct bt_value *map_obj, - const char *key, bool val) + const char *key, bt_bool val) { enum bt_value_status ret; struct bt_value *bool_obj = NULL; @@ -1451,14 +1452,14 @@ end: struct extend_map_element_data { struct bt_value *extended_obj; - bool got_error; + bt_bool got_error; }; static -bool extend_map_element(const char *key, +bt_bool extend_map_element(const char *key, struct bt_value *extension_obj_elem, void *data) { - bool ret = true; + bt_bool ret = BT_TRUE; struct extend_map_element_data *extend_data = data; @@ -1479,8 +1480,8 @@ bool extend_map_element(const char *key, goto end; error: - ret = false; - extend_data->got_error = true; + ret = BT_FALSE; + extend_data->got_error = BT_TRUE; end: BT_PUT(extension_obj_elem_copy); @@ -1575,10 +1576,10 @@ end: return copy_obj; } -bool bt_value_compare(const struct bt_value *object_a, +bt_bool bt_value_compare(const struct bt_value *object_a, const struct bt_value *object_b) { - bool ret = false; + bt_bool ret = BT_FALSE; if (!object_a || !object_b) { BT_LOGW("Invalid parameter: value A or value B is NULL: " diff --git a/plugins/ctf/common/metadata/visitor-generate-ir.c b/plugins/ctf/common/metadata/visitor-generate-ir.c index b6d9fc26..01177f79 100644 --- a/plugins/ctf/common/metadata/visitor-generate-ir.c +++ b/plugins/ctf/common/metadata/visitor-generate-ir.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/plugins/ctf/fs-src/fs.c b/plugins/ctf/fs-src/fs.c index 2abd9b57..a20e7d6c 100644 --- a/plugins/ctf/fs-src/fs.c +++ b/plugins/ctf/fs-src/fs.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include "fs.h" #include "metadata.h" diff --git a/plugins/ctf/fs-src/fs.h b/plugins/ctf/fs-src/fs.h index 4619e79b..acc14a1a 100644 --- a/plugins/ctf/fs-src/fs.h +++ b/plugins/ctf/fs-src/fs.h @@ -28,6 +28,7 @@ * SOFTWARE. */ +#include #include #include #include diff --git a/plugins/lttng-utils/plugin.c b/plugins/lttng-utils/plugin.c index e7cffbd1..2578dd96 100644 --- a/plugins/lttng-utils/plugin.c +++ b/plugins/lttng-utils/plugin.c @@ -419,14 +419,17 @@ enum bt_component_status init_from_params( value = bt_value_map_get(params, "full-path"); if (value) { enum bt_value_status value_ret; + bt_bool bool_val; value_ret = bt_value_bool_get(value, - &debug_info_component->arg_full_path); + &bool_val); if (value_ret) { ret = BT_COMPONENT_STATUS_INVALID; printf_error("Failed to retrieve full-path value. " "Expecting a boolean"); } + + debug_info_component->arg_full_path = bool_val; } bt_put(value); if (ret != BT_COMPONENT_STATUS_OK) { diff --git a/plugins/text/pretty/pretty.c b/plugins/text/pretty/pretty.c index 043ba4fc..ece1f1e6 100644 --- a/plugins/text/pretty/pretty.c +++ b/plugins/text/pretty/pretty.c @@ -235,7 +235,7 @@ end: } static -bool check_param_exists(const char *key, struct bt_value *object, void *data) +bt_bool check_param_exists(const char *key, struct bt_value *object, void *data) { struct pretty_component *pretty = data; struct bt_value *plugin_opt_map = pretty->plugin_opt_map; @@ -244,7 +244,7 @@ bool check_param_exists(const char *key, struct bt_value *object, void *data) fprintf(pretty->err, "[warning] Parameter \"%s\" unknown to \"text.pretty\" sink component\n", key); } - return true; + return BT_TRUE; } static @@ -287,12 +287,13 @@ enum bt_component_status apply_one_bool(const char *key, enum bt_component_status ret = BT_COMPONENT_STATUS_OK; struct bt_value *value = NULL; enum bt_value_status status; + bt_bool bool_val; value = bt_value_map_get(params, key); if (!value) { goto end; } - status = bt_value_bool_get(value, option); + status = bt_value_bool_get(value, &bool_val); switch (status) { case BT_VALUE_STATUS_OK: break; @@ -300,6 +301,7 @@ enum bt_component_status apply_one_bool(const char *key, ret = BT_COMPONENT_STATUS_ERROR; goto end; } + *option = (bool) bool_val; if (found) { *found = true; } diff --git a/plugins/utils/muxer/muxer.c b/plugins/utils/muxer/muxer.c index b98a74e0..67ba0a99 100644 --- a/plugins/utils/muxer/muxer.c +++ b/plugins/utils/muxer/muxer.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #define IGNORE_ABSOLUTE_PARAM_NAME "ignore-absolute" @@ -246,6 +247,7 @@ int configure_muxer_comp(struct muxer_comp *muxer_comp, struct bt_value *params) struct bt_value *real_params = NULL; struct bt_value *ignore_absolute = NULL; int ret = 0; + bt_bool bool_val; default_params = get_default_params(); if (!default_params) { @@ -263,10 +265,12 @@ int configure_muxer_comp(struct muxer_comp *muxer_comp, struct bt_value *params) goto error; } - if (bt_value_bool_get(ignore_absolute, &muxer_comp->ignore_absolute)) { + if (bt_value_bool_get(ignore_absolute, &bool_val)) { goto error; } + muxer_comp->ignore_absolute = (bool) bool_val; + goto end; error: diff --git a/plugins/utils/trimmer/trimmer.c b/plugins/utils/trimmer/trimmer.c index 8ec1332f..b938bd51 100644 --- a/plugins/utils/trimmer/trimmer.c +++ b/plugins/utils/trimmer/trimmer.c @@ -84,7 +84,7 @@ void finalize_trimmer(struct bt_private_component *component) */ static int timestamp_from_arg(const char *arg, struct trimmer *trimmer, - struct trimmer_bound *result_bound, bool gmt) + struct trimmer_bound *result_bound, bt_bool gmt) { int ret; int64_t value; @@ -292,7 +292,7 @@ enum bt_component_status init_from_params(struct trimmer *trimmer, struct bt_value *params) { struct bt_value *value = NULL; - bool gmt = false; + bt_bool gmt = BT_FALSE; enum bt_component_status ret = BT_COMPONENT_STATUS_OK; assert(params); diff --git a/tests/lib/test_bt_ctf_field_type_validation.c b/tests/lib/test_bt_ctf_field_type_validation.c index 1448566c..dd1ed7b6 100644 --- a/tests/lib/test_bt_ctf_field_type_validation.c +++ b/tests/lib/test_bt_ctf_field_type_validation.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/tests/lib/test_bt_notification_heap.c b/tests/lib/test_bt_notification_heap.c index 3bffb711..d4767b1b 100644 --- a/tests/lib/test_bt_notification_heap.c +++ b/tests/lib/test_bt_notification_heap.c @@ -20,7 +20,6 @@ */ #include "tap/tap.h" -#include #include #include #include @@ -71,7 +70,7 @@ error: } static -bool compare_notifications(struct bt_notification *a, struct bt_notification *b, +bt_bool compare_notifications(struct bt_notification *a, struct bt_notification *b, void *unused) { uint64_t val_a = ((struct dummy_notification *) a)->value; diff --git a/tests/lib/test_bt_notification_iterator.c b/tests/lib/test_bt_notification_iterator.c index 99664498..656d84ac 100644 --- a/tests/lib/test_bt_notification_iterator.c +++ b/tests/lib/test_bt_notification_iterator.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include diff --git a/tests/lib/test_bt_values.c b/tests/lib/test_bt_values.c index 5f93a679..e56af802 100644 --- a/tests/lib/test_bt_values.c +++ b/tests/lib/test_bt_values.c @@ -51,18 +51,18 @@ static void test_bool(void) { int ret; - bool value; + bt_bool value; struct bt_value *obj; obj = bt_value_bool_create(); ok(obj && bt_value_is_bool(obj), "bt_value_bool_create() returns a boolean value object"); - value = true; + value = BT_TRUE; ret = bt_value_bool_get(obj, &value); - ok(!ret && !value, "default boolean value object value is false"); + ok(!ret && !value, "default boolean value object value is BT_FALSE"); - ret = bt_value_bool_set(NULL, true); + ret = bt_value_bool_set(NULL, BT_TRUE); ok(ret == BT_VALUE_STATUS_INVAL, "bt_value_bool_set() fails with an value object set to NULL"); ret = bt_value_bool_get(NULL, &value); @@ -72,8 +72,8 @@ void test_bool(void) ok(ret == BT_VALUE_STATUS_INVAL, "bt_value_bool_get() fails with a return value set to NULL"); - assert(!bt_value_bool_set(obj, false)); - ret = bt_value_bool_set(obj, true); + assert(!bt_value_bool_set(obj, BT_FALSE)); + ret = bt_value_bool_set(obj, BT_TRUE); ok(!ret, "bt_value_bool_set() succeeds"); ret = bt_value_bool_get(obj, &value); ok(!ret && value, "bt_value_bool_set() works"); @@ -81,8 +81,8 @@ void test_bool(void) BT_PUT(obj); pass("putting an existing boolean value object does not cause a crash") - value = false; - obj = bt_value_bool_create_init(true); + value = BT_FALSE; + obj = bt_value_bool_create_init(BT_TRUE); ok(obj && bt_value_is_bool(obj), "bt_value_bool_create_init() returns a boolean value object"); ret = bt_value_bool_get(obj, &value); @@ -90,9 +90,9 @@ void test_bool(void) "bt_value_bool_create_init() sets the appropriate initial value"); assert(!bt_value_freeze(obj)); - ok(bt_value_bool_set(obj, false) == BT_VALUE_STATUS_FROZEN, + ok(bt_value_bool_set(obj, BT_FALSE) == BT_VALUE_STATUS_FROZEN, "bt_value_bool_set() cannot be called on a frozen boolean value object"); - value = false; + value = BT_FALSE; ret = bt_value_bool_get(obj, &value); ok(!ret && value, "bt_value_bool_set() does not alter a frozen floating point number value object"); @@ -264,7 +264,7 @@ static void test_array(void) { int ret; - bool bool_value; + bt_bool bool_value; int64_t int_value; double float_value; struct bt_value *obj; @@ -274,8 +274,8 @@ void test_array(void) array_obj = bt_value_array_create(); ok(array_obj && bt_value_is_array(array_obj), "bt_value_array_create() returns an array value object"); - ok(bt_value_array_is_empty(NULL) == false, - "bt_value_array_is_empty() returns false with an value object set to NULL"); + ok(bt_value_array_is_empty(NULL) == BT_FALSE, + "bt_value_array_is_empty() returns BT_FALSE with an value object set to NULL"); ok(bt_value_array_is_empty(array_obj), "initial array value object size is 0"); ok(bt_value_array_size(NULL) == BT_VALUE_STATUS_INVAL, @@ -293,7 +293,7 @@ void test_array(void) obj = bt_value_float_create_init(-17.45); ret |= bt_value_array_append(array_obj, obj); BT_PUT(obj); - obj = bt_value_bool_create_init(true); + obj = bt_value_bool_create_init(BT_TRUE); ret |= bt_value_array_append(array_obj, obj); BT_PUT(obj); ret |= bt_value_array_append(array_obj, bt_value_null); @@ -356,9 +356,9 @@ void test_array(void) "bt_value_array_set() inserts an value object with the appropriate value"); BT_PUT(obj); - ret = bt_value_array_append_bool(array_obj, false); + ret = bt_value_array_append_bool(array_obj, BT_FALSE); ok(!ret, "bt_value_array_append_bool() succeeds"); - ok(bt_value_array_append_bool(NULL, true) == BT_VALUE_STATUS_INVAL, + ok(bt_value_array_append_bool(NULL, BT_TRUE) == BT_VALUE_STATUS_INVAL, "bt_value_array_append_bool() fails with an array value object set to NULL"); ret = bt_value_array_append_integer(array_obj, 98765); ok(!ret, "bt_value_array_append_integer() succeeds"); @@ -434,7 +434,7 @@ void test_array(void) ok(bt_value_array_append(array_obj, bt_value_null) == BT_VALUE_STATUS_FROZEN, "bt_value_array_append() fails with a frozen array value object"); - ok(bt_value_array_append_bool(array_obj, false) == + ok(bt_value_array_append_bool(array_obj, BT_FALSE) == BT_VALUE_STATUS_FROZEN, "bt_value_array_append_bool() fails with a frozen array value object"); ok(bt_value_array_append_integer(array_obj, 23) == @@ -469,54 +469,54 @@ void test_array(void) } static -bool test_map_foreach_cb_count(const char *key, struct bt_value *object, +bt_bool test_map_foreach_cb_count(const char *key, struct bt_value *object, void *data) { int *count = data; if (*count == 3) { - return false; + return BT_FALSE; } (*count)++; - return true; + return BT_TRUE; } struct map_foreach_checklist { - bool bool1; - bool int1; - bool float1; - bool null1; - bool bool2; - bool int2; - bool float2; - bool string2; - bool array2; - bool map2; + bt_bool bool1; + bt_bool int1; + bt_bool float1; + bt_bool null1; + bt_bool bool2; + bt_bool int2; + bt_bool float2; + bt_bool string2; + bt_bool array2; + bt_bool map2; }; static -bool test_map_foreach_cb_check(const char *key, struct bt_value *object, +bt_bool test_map_foreach_cb_check(const char *key, struct bt_value *object, void *data) { int ret; struct map_foreach_checklist *checklist = data; - if (!strcmp(key, "bool")) { + if (!strcmp(key, "bt_bool")) { if (checklist->bool1) { - fail("test_map_foreach_cb_check(): duplicate key \"bool\""); + fail("test_map_foreach_cb_check(): duplicate key \"bt_bool\""); } else { - bool val = false; + bt_bool val = BT_FALSE; ret = bt_value_bool_get(object, &val); - ok(!ret, "test_map_foreach_cb_check(): success getting \"bool\" value"); + ok(!ret, "test_map_foreach_cb_check(): success getting \"bt_bool\" value"); if (val) { - pass("test_map_foreach_cb_check(): \"bool\" value object has the right value"); - checklist->bool1 = true; + pass("test_map_foreach_cb_check(): \"bt_bool\" value object has the right value"); + checklist->bool1 = BT_TRUE; } else { - fail("test_map_foreach_cb_check(): \"bool\" value object has the wrong value"); + fail("test_map_foreach_cb_check(): \"bt_bool\" value object has the wrong value"); } } } else if (!strcmp(key, "int")) { @@ -530,7 +530,7 @@ bool test_map_foreach_cb_check(const char *key, struct bt_value *object, if (val == 19457) { pass("test_map_foreach_cb_check(): \"int\" value object has the right value"); - checklist->int1 = true; + checklist->int1 = BT_TRUE; } else { fail("test_map_foreach_cb_check(): \"int\" value object has the wrong value"); } @@ -546,30 +546,30 @@ bool test_map_foreach_cb_check(const char *key, struct bt_value *object, if (val == 5.444) { pass("test_map_foreach_cb_check(): \"float\" value object has the right value"); - checklist->float1 = true; + checklist->float1 = BT_TRUE; } else { fail("test_map_foreach_cb_check(): \"float\" value object has the wrong value"); } } } else if (!strcmp(key, "null")) { if (checklist->null1) { - fail("test_map_foreach_cb_check(): duplicate key \"bool\""); + fail("test_map_foreach_cb_check(): duplicate key \"bt_bool\""); } else { ok(bt_value_is_null(object), "test_map_foreach_cb_check(): success getting \"null\" value object"); - checklist->null1 = true; + checklist->null1 = BT_TRUE; } } else if (!strcmp(key, "bool2")) { if (checklist->bool2) { fail("test_map_foreach_cb_check(): duplicate key \"bool2\""); } else { - bool val = false; + bt_bool val = BT_FALSE; ret = bt_value_bool_get(object, &val); ok(!ret, "test_map_foreach_cb_check(): success getting \"bool2\" value"); if (val) { pass("test_map_foreach_cb_check(): \"bool2\" value object has the right value"); - checklist->bool2 = true; + checklist->bool2 = BT_TRUE; } else { fail("test_map_foreach_cb_check(): \"bool2\" value object has the wrong value"); } @@ -585,7 +585,7 @@ bool test_map_foreach_cb_check(const char *key, struct bt_value *object, if (val == 98765) { pass("test_map_foreach_cb_check(): \"int2\" value object has the right value"); - checklist->int2 = true; + checklist->int2 = BT_TRUE; } else { fail("test_map_foreach_cb_check(): \"int2\" value object has the wrong value"); } @@ -601,7 +601,7 @@ bool test_map_foreach_cb_check(const char *key, struct bt_value *object, if (val == -49.0001) { pass("test_map_foreach_cb_check(): \"float2\" value object has the right value"); - checklist->float2 = true; + checklist->float2 = BT_TRUE; } else { fail("test_map_foreach_cb_check(): \"float2\" value object has the wrong value"); } @@ -617,7 +617,7 @@ bool test_map_foreach_cb_check(const char *key, struct bt_value *object, if (val && !strcmp(val, "bt_value")) { pass("test_map_foreach_cb_check(): \"string2\" value object has the right value"); - checklist->string2 = true; + checklist->string2 = BT_TRUE; } else { fail("test_map_foreach_cb_check(): \"string2\" value object has the wrong value"); } @@ -629,7 +629,7 @@ bool test_map_foreach_cb_check(const char *key, struct bt_value *object, ok(bt_value_is_array(object), "test_map_foreach_cb_check(): success getting \"array2\" value object"); ok(bt_value_array_is_empty(object), "test_map_foreach_cb_check(): \"array2\" value object is empty"); - checklist->array2 = true; + checklist->array2 = BT_TRUE; } } else if (!strcmp(key, "map2")) { if (checklist->map2) { @@ -638,13 +638,13 @@ bool test_map_foreach_cb_check(const char *key, struct bt_value *object, ok(bt_value_is_map(object), "test_map_foreach_cb_check(): success getting \"map2\" value object"); ok(bt_value_map_is_empty(object), "test_map_foreach_cb_check(): \"map2\" value object is empty"); - checklist->map2 = true; + checklist->map2 = BT_TRUE; } } else { fail("test_map_foreach_cb_check(): unknown map key \"%s\"", key); } - return true; + return BT_TRUE; } static @@ -652,7 +652,7 @@ void test_map(void) { int ret; int count = 0; - bool bool_value; + bt_bool bool_value; int64_t int_value; double float_value; struct bt_value *obj; @@ -684,21 +684,21 @@ void test_map(void) ret |= bt_value_map_insert(map_obj, "float", obj); BT_PUT(obj); obj = bt_value_bool_create(); - ret |= bt_value_map_insert(map_obj, "bool", obj); + ret |= bt_value_map_insert(map_obj, "bt_bool", obj); BT_PUT(obj); ret |= bt_value_map_insert(map_obj, "null", bt_value_null); ok(!ret, "bt_value_map_insert() succeeds"); ok(bt_value_map_size(map_obj) == 4, "inserting an element into a map value object increment its size"); - obj = bt_value_bool_create_init(true); - ret = bt_value_map_insert(map_obj, "bool", obj); + obj = bt_value_bool_create_init(BT_TRUE); + ret = bt_value_map_insert(map_obj, "bt_bool", obj); BT_PUT(obj); ok(!ret, "bt_value_map_insert() accepts an existing key"); obj = bt_value_map_get(map_obj, NULL); ok(!obj, "bt_value_map_get() fails with a key set to NULL"); - obj = bt_value_map_get(NULL, "bool"); + obj = bt_value_map_get(NULL, "bt_bool"); ok(!obj, "bt_value_map_get() fails with a map value object set to NULL"); obj = bt_value_map_get(map_obj, "life"); @@ -720,7 +720,7 @@ void test_map(void) obj = bt_value_map_get(map_obj, "null"); ok(obj && bt_value_is_null(obj), "bt_value_map_get() returns an value object with the appropriate type (null)"); - obj = bt_value_map_get(map_obj, "bool"); + obj = bt_value_map_get(map_obj, "bt_bool"); ok(obj && bt_value_is_bool(obj), "bt_value_map_get() returns an value object with the appropriate type (boolean)"); ret = bt_value_bool_get(obj, &bool_value); @@ -728,9 +728,9 @@ void test_map(void) "bt_value_map_get() returns an value object with the appropriate value (boolean)"); BT_PUT(obj); - ret = bt_value_map_insert_bool(map_obj, "bool2", true); + ret = bt_value_map_insert_bool(map_obj, "bool2", BT_TRUE); ok(!ret, "bt_value_map_insert_bool() succeeds"); - ok(bt_value_map_insert_bool(NULL, "bool2", false) == + ok(bt_value_map_insert_bool(NULL, "bool2", BT_FALSE) == BT_VALUE_STATUS_INVAL, "bt_value_map_insert_bool() fails with a map value object set to NULL"); ret = bt_value_map_insert_integer(map_obj, "int2", 98765); @@ -762,8 +762,8 @@ void test_map(void) ok(!bt_value_map_has_key(map_obj, "hello"), "map value object does not have key \"hello\""); - ok(bt_value_map_has_key(map_obj, "bool"), - "map value object has key \"bool\""); + ok(bt_value_map_has_key(map_obj, "bt_bool"), + "map value object has key \"bt_bool\""); ok(bt_value_map_has_key(map_obj, "int"), "map value object has key \"int\""); ok(bt_value_map_has_key(map_obj, "float"), @@ -791,7 +791,7 @@ void test_map(void) "bt_value_map_foreach() fails with a user function set to NULL"); ret = bt_value_map_foreach(map_obj, test_map_foreach_cb_count, &count); ok(ret == BT_VALUE_STATUS_CANCELLED && count == 3, - "bt_value_map_foreach() breaks the loop when the user function returns false"); + "bt_value_map_foreach() breaks the loop when the user function returns BT_FALSE"); memset(&checklist, 0, sizeof(checklist)); ret = bt_value_map_foreach(map_obj, test_map_foreach_cb_check, @@ -808,7 +808,7 @@ void test_map(void) ok(bt_value_map_insert(map_obj, "allo", bt_value_null) == BT_VALUE_STATUS_FROZEN, "bt_value_map_insert() fails with a frozen map value object"); - ok(bt_value_map_insert_bool(map_obj, "duh", false) == + ok(bt_value_map_insert_bool(map_obj, "duh", BT_FALSE) == BT_VALUE_STATUS_FROZEN, "bt_value_map_insert_bool() fails with a frozen array value object"); ok(bt_value_map_insert_integer(map_obj, "duh", 23) == @@ -859,17 +859,17 @@ void test_compare_null(void) static void test_compare_bool(void) { - struct bt_value *bool1 = bt_value_bool_create_init(false); - struct bt_value *bool2 = bt_value_bool_create_init(true); - struct bt_value *bool3 = bt_value_bool_create_init(false); + struct bt_value *bool1 = bt_value_bool_create_init(BT_FALSE); + struct bt_value *bool2 = bt_value_bool_create_init(BT_TRUE); + struct bt_value *bool3 = bt_value_bool_create_init(BT_FALSE); assert(bool1 && bool2 && bool3); ok(!bt_value_compare(bt_value_null, bool1), - "cannot compare null value object and bool value object"); + "cannot compare null value object and bt_bool value object"); ok(!bt_value_compare(bool1, bool2), - "integer value objects are not equivalent (false and true)"); + "boolean value objects are not equivalent (BT_FALSE and BT_TRUE)"); ok(bt_value_compare(bool1, bool3), - "integer value objects are equivalent (false and false)"); + "boolean value objects are equivalent (BT_FALSE and BT_FALSE)"); BT_PUT(bool1); BT_PUT(bool2); @@ -952,13 +952,13 @@ void test_compare_array(void) assert(!bt_value_array_append_integer(array1, 23)); assert(!bt_value_array_append_float(array1, 14.2)); - assert(!bt_value_array_append_bool(array1, false)); + assert(!bt_value_array_append_bool(array1, BT_FALSE)); assert(!bt_value_array_append_float(array2, 14.2)); assert(!bt_value_array_append_integer(array2, 23)); - assert(!bt_value_array_append_bool(array2, false)); + assert(!bt_value_array_append_bool(array2, BT_FALSE)); assert(!bt_value_array_append_integer(array3, 23)); assert(!bt_value_array_append_float(array3, 14.2)); - assert(!bt_value_array_append_bool(array3, false)); + assert(!bt_value_array_append_bool(array3, BT_FALSE)); assert(bt_value_array_size(array1) == 3); assert(bt_value_array_size(array2) == 3); assert(bt_value_array_size(array3) == 3); @@ -966,9 +966,9 @@ void test_compare_array(void) ok(!bt_value_compare(bt_value_null, array1), "cannot compare null value object and array value object"); ok(!bt_value_compare(array1, array2), - "array value objects are not equivalent ([23, 14.2, false] and [14.2, 23, false])"); + "array value objects are not equivalent ([23, 14.2, BT_FALSE] and [14.2, 23, BT_FALSE])"); ok(bt_value_compare(array1, array3), - "array value objects are equivalent ([23, 14.2, false] and [23, 14.2, false])"); + "array value objects are equivalent ([23, 14.2, BT_FALSE] and [23, 14.2, BT_FALSE])"); BT_PUT(array1); BT_PUT(array2); @@ -989,11 +989,11 @@ void test_compare_map(void) assert(!bt_value_map_insert_integer(map1, "one", 23)); assert(!bt_value_map_insert_float(map1, "two", 14.2)); - assert(!bt_value_map_insert_bool(map1, "three", false)); + assert(!bt_value_map_insert_bool(map1, "three", BT_FALSE)); assert(!bt_value_map_insert_float(map2, "one", 14.2)); assert(!bt_value_map_insert_integer(map2, "two", 23)); - assert(!bt_value_map_insert_bool(map2, "three", false)); - assert(!bt_value_map_insert_bool(map3, "three", false)); + assert(!bt_value_map_insert_bool(map2, "three", BT_FALSE)); + assert(!bt_value_map_insert_bool(map3, "three", BT_FALSE)); assert(!bt_value_map_insert_integer(map3, "one", 23)); assert(!bt_value_map_insert_float(map3, "two", 14.2)); assert(bt_value_map_size(map1) == 3); @@ -1031,7 +1031,7 @@ void test_copy(void) /* * Here's the deal here. If we make sure that each value object * of our deep copy has a different address than its source, - * and that bt_value_compare() returns true for the top-level + * and that bt_value_compare() returns BT_TRUE for the top-level * value object, taking into account that we test the correctness of * bt_value_compare() elsewhere, then the deep copy is a * success. @@ -1044,7 +1044,7 @@ void test_copy(void) struct bt_value *array_obj, *array_copy_obj; struct bt_value *map_obj, *map_copy_obj; - bool_obj = bt_value_bool_create_init(true); + bool_obj = bt_value_bool_create_init(BT_TRUE); integer_obj = bt_value_integer_create_init(23); float_obj = bt_value_float_create_init(-3.1416); string_obj = bt_value_string_create_init("test"); @@ -1079,7 +1079,7 @@ void test_copy(void) "bt_value_copy() returns a different pointer (array)"); bool_copy_obj = bt_value_array_get(array_copy_obj, 0); ok(bool_copy_obj != bool_obj, - "bt_value_copy() returns a different pointer (bool)"); + "bt_value_copy() returns a different pointer (bt_bool)"); integer_copy_obj = bt_value_array_get(array_copy_obj, 1); ok(integer_copy_obj != integer_obj, "bt_value_copy() returns a different pointer (integer)"); @@ -1108,12 +1108,12 @@ void test_copy(void) } static -bool compare_map_elements(struct bt_value *map_a, struct bt_value *map_b, +bt_bool compare_map_elements(struct bt_value *map_a, struct bt_value *map_b, const char *key) { struct bt_value *elem_a = NULL; struct bt_value *elem_b = NULL; - bool equal; + bt_bool equal; elem_a = bt_value_map_get(map_a, key); elem_b = bt_value_map_get(map_b, key); @@ -1136,15 +1136,15 @@ void test_extend(void) assert(base_map); assert(extension_map); assert(array); - status = bt_value_map_insert_bool(base_map, "file", true); + status = bt_value_map_insert_bool(base_map, "file", BT_TRUE); assert(status == BT_VALUE_STATUS_OK); - status = bt_value_map_insert_bool(base_map, "edit", false); + status = bt_value_map_insert_bool(base_map, "edit", BT_FALSE); assert(status == BT_VALUE_STATUS_OK); status = bt_value_map_insert_integer(base_map, "selection", 17); assert(status == BT_VALUE_STATUS_OK); status = bt_value_map_insert_integer(base_map, "find", -34); assert(status == BT_VALUE_STATUS_OK); - status = bt_value_map_insert_bool(extension_map, "edit", true); + status = bt_value_map_insert_bool(extension_map, "edit", BT_TRUE); assert(status == BT_VALUE_STATUS_OK); status = bt_value_map_insert_integer(extension_map, "find", 101); assert(status == BT_VALUE_STATUS_OK); @@ -1219,12 +1219,12 @@ void test_freeze(void) obj = bt_value_integer_create(); assert(obj); ok(!bt_value_is_frozen(obj), - "bt_value_is_frozen() returns false with a fresh value object"); + "bt_value_is_frozen() returns BT_FALSE with a fresh value object"); assert(!bt_value_freeze(obj)); ok(!bt_value_freeze(obj), "bt_value_freeze() passes with a frozen value object"); ok(bt_value_is_frozen(obj), - "bt_value_is_frozen() returns true with a frozen value object"); + "bt_value_is_frozen() returns BT_TRUE with a frozen value object"); BT_PUT(obj); } diff --git a/tests/lib/test_ir_visit.c b/tests/lib/test_ir_visit.c index 68534812..2c06fed8 100644 --- a/tests/lib/test_ir_visit.c +++ b/tests/lib/test_ir_visit.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include diff --git a/tests/lib/test_plugin.c b/tests/lib/test_plugin.c index a256b7cb..603eb29b 100644 --- a/tests/lib/test_plugin.c +++ b/tests/lib/test_plugin.c @@ -70,7 +70,7 @@ static void test_invalid(const char *plugin_dir) ok(!bt_plugin_create_all_from_file(NULL), "bt_plugin_create_all_from_file() handles NULL correctly"); - ok(!bt_plugin_create_all_from_dir(NULL, false), + ok(!bt_plugin_create_all_from_dir(NULL, BT_FALSE), "bt_plugin_create_all_from_dir() handles NULL correctly"); ok(!bt_plugin_get_name(NULL), "bt_plugin_get_name() handles NULL correctly"); @@ -245,11 +245,11 @@ static void test_create_all_from_dir(const char *plugin_dir) diag("create from all test below"); - plugin_set = bt_plugin_create_all_from_dir(NON_EXISTING_PATH, false); + plugin_set = bt_plugin_create_all_from_dir(NON_EXISTING_PATH, BT_FALSE); ok(!plugin_set, "bt_plugin_create_all_from_dir() fails with an invalid path"); - plugin_set = bt_plugin_create_all_from_dir(plugin_dir, false); + plugin_set = bt_plugin_create_all_from_dir(plugin_dir, BT_FALSE); ok(plugin_set, "bt_plugin_create_all_from_dir() succeeds with a valid path"); /* 2 or 4, if `.la` files are considered or not */ diff --git a/tests/plugins/test-utils-muxer.c b/tests/plugins/test-utils-muxer.c index 2fd584c9..f5eac77c 100644 --- a/tests/plugins/test-utils-muxer.c +++ b/tests/plugins/test-utils-muxer.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include