#include <stdlib.h>
#include <stdint.h>
+#include <stdbool.h>
#include <babeltrace/values.h>
#include <babeltrace/ref.h>
#include <babeltrace/object-internal.h>
};
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;
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;
"@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" \
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 = \
#include <stdint.h>
#include <stdlib.h>
#include <errno.h>
-#include <stdbool.h>
#include <babeltrace/compat/string-internal.h>
+#include <babeltrace/types.h>
#define PERROR_BUFLEN 200
-extern bool babeltrace_verbose, babeltrace_debug;
+extern bt_bool babeltrace_verbose, babeltrace_debug;
#define printf_verbose(fmt, args...) \
do { \
/* Core API */
#include <babeltrace/logging.h>
#include <babeltrace/ref.h>
+#include <babeltrace/types.h>
#include <babeltrace/values.h>
#include <babeltrace/version.h>
#ifndef BABELTRACE_COMMON_INTERNAL_H
#define BABELTRACE_COMMON_INTERNAL_H
+#include <stdbool.h>
#include <babeltrace/babeltrace-internal.h>
#define BT_COMMON_COLOR_RESET "\033[0m"
#include <babeltrace/ctf-ir/trace-internal.h>
#include <babeltrace/object-internal.h>
#include <babeltrace/babeltrace-internal.h>
-#include <glib.h>
#include <babeltrace/compat/uuid-internal.h>
+#include <babeltrace/types.h>
+#include <glib.h>
struct bt_ctf_clock_class {
struct bt_object base;
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 */
*/
#include <stdint.h>
+#include <babeltrace/types.h>
#ifdef __cplusplus
extern "C" {
#include <babeltrace/ctf-ir/clock-class.h>
#include <babeltrace/babeltrace-internal.h>
#include <babeltrace/object-internal.h>
+#include <babeltrace/types.h>
#include <glib.h>
typedef void (*type_freeze_func)(struct bt_ctf_field_type *);
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;
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 {
#include <babeltrace/ctf-writer/event-fields.h>
#include <babeltrace/object-internal.h>
#include <babeltrace/babeltrace-internal.h>
+#include <babeltrace/types.h>
#include <stdint.h>
#include <glib.h>
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 */
#include <babeltrace/object-internal.h>
#include <babeltrace/babeltrace-internal.h>
#include <babeltrace/values.h>
+#include <babeltrace/types.h>
#include <glib.h>
#include <sys/types.h>
#include <uuid/uuid.h>
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 */
*/
int valid;
GPtrArray *listeners; /* Array of struct listener_wrapper */
- bool is_static;
+ bt_bool is_static;
};
struct metadata_context {
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);
/**
#include <babeltrace/ctf-ir/visitor.h>
#include <babeltrace/values.h>
#include <babeltrace/graph/notification.h>
+#include <babeltrace/types.h>
#include <stdint.h>
#ifdef __cplusplus
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.
#include <babeltrace/ctf-ir/fields-internal.h>
#include <babeltrace/align-internal.h>
#include <babeltrace/mmap-align-internal.h>
+#include <babeltrace/types.h>
struct bt_ctf_stream_pos {
int fd;
pos->flags = MAP_SHARED;
break;
default:
- assert(false);
+ assert(BT_FALSE);
}
return 0;
#include <stdint.h>
#include <stddef.h>
-#include <stdbool.h>
#include <assert.h>
#include <babeltrace/ctf-ir/clock-class.h>
#include <babeltrace/object-internal.h>
+#include <babeltrace/types.h>
#include <glib.h>
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
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 */
#include <babeltrace/graph/component-class-sink.h>
#include <babeltrace/babeltrace-internal.h>
#include <babeltrace/object-internal.h>
-#include <stdbool.h>
+#include <babeltrace/types.h>
#include <glib.h>
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 {
*/
#include <stdint.h>
-#include <stdbool.h>
#include <babeltrace/graph/component-status.h>
#include <babeltrace/graph/notification-iterator.h>
+#include <babeltrace/types.h>
#ifdef __cplusplus
extern "C" {
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;
#include <babeltrace/graph/component-class-internal.h>
#include <babeltrace/graph/port-internal.h>
#include <babeltrace/object-internal.h>
+#include <babeltrace/types.h>
#include <glib.h>
#include <stdio.h>
* 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;
#include <babeltrace/graph/component-class.h>
#include <babeltrace/graph/notification-iterator.h>
#include <babeltrace/values.h>
-#include <stdbool.h>
+#include <babeltrace/types.h>
#ifdef __cplusplus
extern "C" {
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;
*/
#include <stddef.h>
-#include <stdbool.h>
#include <babeltrace/graph/notification.h>
#include <babeltrace/babeltrace-internal.h>
+#include <babeltrace/types.h>
/**
* bt_notification_time_compare - Compare two notifications' timestamps
* 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);
* SOFTWARE.
*/
-#include <stdbool.h>
#include <babeltrace/ref-internal.h>
#include <babeltrace/babeltrace-internal.h>
#include <babeltrace/object-internal.h>
#include <babeltrace/graph/notification.h>
#include <babeltrace/ctf-ir/stream.h>
+#include <babeltrace/types.h>
#ifdef __cplusplus
extern "C" {
struct bt_object base;
enum bt_notification_type type;
get_stream_func get_stream;
- bool frozen;
+ bt_bool frozen;
};
BT_HIDDEN
BT_HIDDEN
static inline void bt_notification_freeze(struct bt_notification *notification)
{
- notification->frozen = true;
+ notification->frozen = BT_TRUE;
}
#ifdef __cplusplus
#include <babeltrace/graph/notification.h>
#include <babeltrace/graph/notification-iterator.h>
#include <babeltrace/graph/private-notification-iterator.h>
+#include <babeltrace/types.h>
struct bt_port;
*/
uint32_t subscription_mask;
- bool is_ended;
+ bt_bool is_ended;
void *user_data;
};
*/
#include <stdint.h>
-#include <stdbool.h>
+#include <babeltrace/types.h>
#ifdef __cplusplus
extern "C" {
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;
}
#include <babeltrace/babeltrace-internal.h>
#include <babeltrace/plugin/plugin-dev.h>
#include <babeltrace/object-internal.h>
-#include <stdbool.h>
+#include <babeltrace/types.h>
#include <glib.h>
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;
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 */
assert(plugin);
assert(path);
g_string_assign(plugin->info.path, path);
- plugin->info.path_set = true;
+ plugin->info.path_set = BT_TRUE;
}
static inline
assert(plugin);
assert(name);
g_string_assign(plugin->info.name, name);
- plugin->info.name_set = true;
+ plugin->info.name_set = BT_TRUE;
}
static inline
assert(plugin);
assert(description);
g_string_assign(plugin->info.description, description);
- plugin->info.description_set = true;
+ plugin->info.description_set = BT_TRUE;
}
static inline
assert(plugin);
assert(author);
g_string_assign(plugin->info.author, author);
- plugin->info.author_set = true;
+ plugin->info.author_set = BT_TRUE;
}
static inline
assert(plugin);
assert(license);
g_string_assign(plugin->info.license, license);
- plugin->info.license_set = true;
+ plugin->info.license_set = BT_TRUE;
}
static inline
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
#include <glib.h>
#include <gmodule.h>
+#include <babeltrace/types.h>
struct bt_plugin;
struct bt_component_class;
GModule *module;
/* True if initialization function was called */
- bool init_called;
+ bt_bool init_called;
bt_plugin_exit_func exit;
};
#include <stdint.h>
#include <stddef.h>
-#include <stdbool.h>
#include <babeltrace/graph/component-class.h>
+#include <babeltrace/types.h>
#ifdef __cplusplus
extern "C" {
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);
--- /dev/null
+#ifndef BABELTRACE_TYPES_H
+#define BABELTRACE_TYPES_H
+
+/*
+ * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * 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 <babeltrace/types.h>
+@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 */
*/
#include <stdint.h>
-#include <stdbool.h>
#include <stddef.h>
#include <babeltrace/ref.h>
+#include <babeltrace/types.h>
#ifdef __cplusplus
extern "C" {
/// 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).
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}
@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;
}
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}
@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;
}
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;
}
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}
@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;
}
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}
@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;
}
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}
@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;
}
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}
@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;
}
@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.
/**
@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);
/** @} */
/**
@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.
@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
@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
value object.
*/
extern enum bt_value_status bt_value_bool_set(struct bt_value *bool_obj,
- bool val);
+ bt_bool val);
/** @} */
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.
@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
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
@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.
@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
\p object is a <em>weak reference</em>: 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);
/**
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.
@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}
@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);
/**
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
*/
#include <babeltrace/babeltrace.h>
+#include <babeltrace/types.h>
#include <stdlib.h>
-#include <stdbool.h>
-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)
#include <babeltrace/ref.h>
#include <babeltrace/object-internal.h>
#include <babeltrace/compiler-internal.h>
+#include <babeltrace/types.h>
#include <inttypes.h>
#define BT_LOG_TAG "CLOCK-CLASS"
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;
}
#include <babeltrace/ctf-ir/attributes-internal.h>
#include <babeltrace/compiler-internal.h>
#include <babeltrace/endian-internal.h>
+#include <babeltrace/types.h>
#include <inttypes.h>
static
default:
/* should never happen */
- assert(false);
+ assert(BT_FALSE);
break;
}
}
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));
<= 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 {
<= 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;
}
}
}
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) {
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);
};
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,
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) {
}
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) {
}
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;
}
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) {
}
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) {
}
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) {
#include <babeltrace/ref.h>
#include <babeltrace/babeltrace-internal.h>
#include <babeltrace/values.h>
+#include <babeltrace/types.h>
#include <limits.h>
#include <glib.h>
* 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;
}
{
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);
/* Next path token */
cur_ptoken = g_list_next(cur_ptoken);
- first_level_done = true;
+ first_level_done = BT_TRUE;
}
/* Create new field path entry */
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(
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 ||
goto end;
}
} else {
- assert(false);
+ assert(BT_FALSE);
}
end:
bt_ctf_field_type_variant_get_tag_name(type);
break;
default:
- assert(false);
+ assert(BT_FALSE);
ret = -1;
goto end;
}
goto end;
}
} else {
- assert(false);
+ assert(BT_FALSE);
}
end:
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) {
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;
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);
}
/*
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)
#include <babeltrace/compiler-internal.h>
#include <babeltrace/values.h>
#include <babeltrace/ref.h>
+#include <babeltrace/types.h>
#include <babeltrace/endian-internal.h>
#include <inttypes.h>
#include <stdint.h>
}
memcpy(trace->uuid, uuid, sizeof(uuid_t));
- trace->uuid_set = true;
+ trace->uuid_set = BT_TRUE;
end:
return ret;
}
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 };
string = "native";
break;
default:
- assert(false);
+ assert(BT_FALSE);
}
return string;
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;
goto end;
}
- trace->is_static = true;
+ trace->is_static = BT_TRUE;
bt_ctf_trace_freeze(trace);
end:
#include <stdio.h>
#include <stdint.h>
-#include <stdbool.h>
#include <babeltrace/ctf-ir/field-types.h>
#include <babeltrace/ctf-ir/field-types-internal.h>
#include <babeltrace/ctf-ir/fields.h>
#include <babeltrace/endian-internal.h>
#include <babeltrace/bitfield-internal.h>
#include <babeltrace/compat/fcntl-internal.h>
+#include <babeltrace/types.h>
#include <glib.h>
#if (FLT_RADIX != 2)
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;
break;
}
default:
- assert(false);
+ assert(BT_FALSE);
}
} else {
switch (size) {
break;
}
default:
- assert(false);
+ assert(BT_FALSE);
}
}
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)
return -EINVAL;
}
- return integer_write(pos, value, type->alignment, size, false,
+ return integer_write(pos, value, type->alignment, size, BT_FALSE,
byte_order);
}
/* unmap old base */
ret = munmap_align(pos->base_mma);
if (ret) {
- assert(false);
+ assert(BT_FALSE);
}
pos->base_mma = NULL;
}
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);
}
}
{
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) {
writer->trace, i);
if (existing_stream_class == stream_class) {
- stream_class_found = true;
+ stream_class_found = BT_TRUE;
}
BT_PUT(existing_stream_class);
#include <babeltrace/compiler-internal.h>
#include <babeltrace/graph/component-class-internal.h>
#include <babeltrace/ref.h>
-#include <stdbool.h>
+#include <babeltrace/types.h>
#include <glib.h>
static
goto end;
}
- component_class->frozen = true;
+ component_class->frozen = BT_TRUE;
end:
return ret;
#include <babeltrace/babeltrace-internal.h>
#include <babeltrace/compiler-internal.h>
#include <babeltrace/ref.h>
+#include <babeltrace/types.h>
#include <stdint.h>
static
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);
#include <babeltrace/graph/component-filter.h>
#include <babeltrace/graph/port.h>
#include <babeltrace/compiler-internal.h>
+#include <babeltrace/types.h>
#include <unistd.h>
#include <glib.h>
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;
}
break;
default:
- assert(false);
+ assert(BT_FALSE);
break;
}
ret = BT_COMPONENT_STATUS_OK;
#include <babeltrace/graph/notification-stream.h>
#include <babeltrace/graph/notification-stream-internal.h>
#include <babeltrace/graph/port.h>
+#include <babeltrace/types.h>
#include <stdint.h>
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 {
case ACTION_TYPE_SET_STREAM_STATE_IS_ENDED:
break;
default:
- assert(false);
+ assert(BT_FALSE);
}
}
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:
action->payload.set_stream_state_cur_packet.packet);
break;
default:
- assert(false);
+ assert(BT_FALSE);
}
}
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;
* bad: the API guarantees that it can never
* happen.
*/
- is_valid = false;
+ is_valid = BT_FALSE;
goto end;
}
* bad: the API guarantees that it can never
* happen.
*/
- is_valid = false;
+ is_valid = BT_FALSE;
goto end;
}
* 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;
}
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
break;
}
default:
- assert(false);
+ assert(BT_FALSE);
break;
}
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;
break;
default:
/* Unknown non-error status */
- assert(false);
+ assert(BT_FALSE);
}
}
#include <babeltrace/graph/clock-class-priority-map.h>
#include <babeltrace/graph/clock-class-priority-map-internal.h>
#include <babeltrace/graph/notification-event-internal.h>
+#include <babeltrace/types.h>
static
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
* 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;
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;
}
assert(trace_clock_class);
if (trace_clock_class == clock_class) {
- found_in_trace = true;
+ found_in_trace = BT_TRUE;
break;
}
}
bt_put(clock_class);
if (!found_in_trace) {
- is_valid = false;
+ is_valid = BT_FALSE;
goto end;
}
}
#include <babeltrace/plugin/plugin-dev.h>
#include <babeltrace/plugin/plugin-internal.h>
#include <babeltrace/graph/component-class-internal.h>
+#include <babeltrace/types.h>
#include <string.h>
-#include <stdbool.h>
#include <glib.h>
#include <gmodule.h>
}
}
- 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++) {
case BT_COMPONENT_CLASS_TYPE_SINK:
break;
default:
- assert(false);
+ assert(BT_FALSE);
break;
}
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) {
#include <babeltrace/common-internal.h>
#include <babeltrace/plugin/plugin-internal.h>
#include <babeltrace/plugin/plugin-so-internal.h>
+#include <babeltrace/types.h>
#include <glib.h>
#include <unistd.h>
#include <stdlib.h>
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;
}
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;
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;
}
}
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;
#include <babeltrace/ref.h>
#include <babeltrace/values.h>
#include <babeltrace/compat/glib-internal.h>
+#include <babeltrace/types.h>
#define BT_LOG_TAG "VALUES"
#include <babeltrace/lib-logging-internal.h>
struct bt_value {
struct bt_object base;
enum bt_value_type type;
- bool is_frozen;
+ bt_bool is_frozen;
};
static
.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 {
};
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 ==
}
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 ==
}
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 ==
}
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,
}
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);
object_a, object_b,
bt_value_array_size(object_a),
bt_value_array_size(object_b));
- ret = false;
+ ret = BT_FALSE;
goto end;
}
element_obj_a, element_obj_b, index);
BT_PUT(element_obj_a);
BT_PUT(element_obj_b);
- ret = false;
+ ret = BT_FALSE;
goto 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);
object_a, object_b,
bt_value_map_size(object_a),
bt_value_map_size(object_b));
- ret = false;
+ ret = BT_FALSE;
goto end;
}
"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;
}
}
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,
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)
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;
}
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;
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)
}
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);
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);
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;
}
}
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;
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;
}
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;
}
}
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;
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;
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);
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: "
#include <stdio.h>
#include <unistd.h>
#include <string.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <ctype.h>
#include <assert.h>
#include <plugins-common.h>
#include <glib.h>
#include <assert.h>
+#include <stdbool.h>
#include <unistd.h>
#include "fs.h"
#include "metadata.h"
* SOFTWARE.
*/
+#include <stdbool.h>
#include <babeltrace/babeltrace-internal.h>
#include <babeltrace/graph/component.h>
#include <babeltrace/graph/clock-class-priority-map.h>
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) {
}
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;
fprintf(pretty->err,
"[warning] Parameter \"%s\" unknown to \"text.pretty\" sink component\n", key);
}
- return true;
+ return BT_TRUE;
}
static
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;
ret = BT_COMPONENT_STATUS_ERROR;
goto end;
}
+ *option = (bool) bool_val;
if (found) {
*found = true;
}
#include <babeltrace/graph/private-port.h>
#include <plugins-common.h>
#include <glib.h>
+#include <stdbool.h>
#include <assert.h>
#define IGNORE_ABSOLUTE_PARAM_NAME "ignore-absolute"
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) {
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:
*/
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;
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);
#include <babeltrace/ctf-ir/stream-class.h>
#include <babeltrace/ctf-ir/trace.h>
#include <assert.h>
+#include <stdbool.h>
#include <string.h>
#include <stdarg.h>
#include <glib.h>
*/
#include "tap/tap.h"
-#include <stdbool.h>
#include <stdlib.h>
#include <babeltrace/compiler-internal.h>
#include <babeltrace/ref.h>
}
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;
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
+#include <stdbool.h>
#include <inttypes.h>
#include <string.h>
#include <assert.h>
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);
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");
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);
"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");
void test_array(void)
{
int ret;
- bool bool_value;
+ bt_bool bool_value;
int64_t int_value;
double float_value;
struct bt_value *obj;
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,
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);
"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");
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) ==
}
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")) {
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");
}
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");
}
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");
}
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");
}
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");
}
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) {
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
{
int ret;
int count = 0;
- bool bool_value;
+ bt_bool bool_value;
int64_t int_value;
double float_value;
struct bt_value *obj;
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");
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);
"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);
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"),
"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,
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) ==
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);
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);
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);
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);
/*
* 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.
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");
"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)");
}
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);
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);
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);
}
#include <babeltrace/ctf-ir/trace.h>
#include <babeltrace/ctf-ir/visitor.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <string.h>
#include <assert.h>
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");
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 */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
+#include <stdbool.h>
#include <inttypes.h>
#include <string.h>
#include <assert.h>