*/
#define BT_LOG_TAG "VALUES"
+#include <babeltrace/lib-logging-internal.h>
#include <stdlib.h>
#include <string.h>
#include <babeltrace/values.h>
#include <babeltrace/compat/glib-internal.h>
#include <babeltrace/types.h>
-
-#include <babeltrace/lib-logging-internal.h>
#include <babeltrace/object-internal.h>
+#include <babeltrace/values-internal.h>
#define BT_VALUE_FROM_CONCRETE(_concrete) ((struct bt_value *) (_concrete))
#define BT_VALUE_TO_BOOL(_base) ((struct bt_value_bool *) (_base))
value = container_of(obj, struct bt_value, base);
assert(value->type != BT_VALUE_TYPE_UNKNOWN);
-
BT_LOGD("Destroying value: addr=%p", value);
if (bt_value_is_null(value)) {
if (!bt_value_is_bool(bool_obj)) {
BT_LOGW("Invalid parameter: value is not a boolean value: addr=%p, "
- "type=%d", bool_obj, bool_obj->type);
+ "type=%s", bool_obj, bool_obj->type,
+ bt_value_type_string(bool_obj->type));
ret = BT_VALUE_STATUS_INVAL;
goto end;
}
if (!bt_value_is_bool(bool_obj)) {
BT_LOGW("Invalid parameter: value is not a boolean value: addr=%p, "
- "type=%d", bool_obj, bool_obj->type);
+ "type=%s", bool_obj,
+ bt_value_type_string(bool_obj->type));
ret = BT_VALUE_STATUS_INVAL;
goto end;
}
if (!bt_value_is_integer(integer_obj)) {
BT_LOGW("Invalid parameter: value is not an integer value: addr=%p, "
- "type=%d", integer_obj, integer_obj->type);
+ "type=%s", integer_obj,
+ bt_value_type_string(integer_obj->type));
ret = BT_VALUE_STATUS_INVAL;
goto end;
}
if (!bt_value_is_integer(integer_obj)) {
BT_LOGW("Invalid parameter: value is not an integer value: addr=%p, "
- "type=%d", integer_obj, integer_obj->type);
+ "type=%s", integer_obj,
+ bt_value_type_string(integer_obj->type));
ret = BT_VALUE_STATUS_INVAL;
goto end;
}
if (!bt_value_is_float(float_obj)) {
BT_LOGW("Invalid parameter: value is not a floating point number value: addr=%p, "
- "type=%d", float_obj, float_obj->type);
+ "type=%s", float_obj,
+ bt_value_type_string(float_obj->type));
ret = BT_VALUE_STATUS_INVAL;
goto end;
}
if (!bt_value_is_float(float_obj)) {
BT_LOGW("Invalid parameter: value is not a floating point number value: addr=%p, "
- "type=%d", float_obj, float_obj->type);
+ "type=%s", float_obj,
+ bt_value_type_string(float_obj->type));
ret = BT_VALUE_STATUS_INVAL;
goto end;
}
if (!bt_value_is_string(string_obj)) {
BT_LOGW("Invalid parameter: value is not a string value: addr=%p, "
- "type=%d", string_obj, string_obj->type);
+ "type=%s", string_obj,
+ bt_value_type_string(string_obj->type));
ret = BT_VALUE_STATUS_INVAL;
goto end;
}
if (!bt_value_is_string(string_obj)) {
BT_LOGW("Invalid parameter: value is not a string value: addr=%p, "
- "type=%d", string_obj, string_obj->type);
+ "type=%s", string_obj,
+ bt_value_type_string(string_obj->type));
ret = BT_VALUE_STATUS_INVAL;
goto end;
}
if (!bt_value_is_array(array_obj)) {
BT_LOGW("Invalid parameter: value is not an array value: addr=%p, "
- "type=%d", array_obj, array_obj->type);
+ "type=%s", array_obj,
+ bt_value_type_string(array_obj->type));
ret = BT_VALUE_STATUS_INVAL;
goto end;
}
if (!bt_value_is_array(array_obj)) {
BT_LOGW("Invalid parameter: value is not an array value: addr=%p, "
- "type=%d", array_obj, array_obj->type);
+ "type=%s", array_obj,
+ bt_value_type_string(array_obj->type));
ret = NULL;
goto end;
}
if (!bt_value_is_array(array_obj)) {
BT_LOGW("Invalid parameter: value is not an array value: addr=%p, "
- "type=%d", array_obj, array_obj->type);
+ "type=%s", array_obj,
+ bt_value_type_string(array_obj->type));
ret = BT_VALUE_STATUS_INVAL;
goto end;
}
if (!bt_value_is_array(array_obj)) {
BT_LOGW("Invalid parameter: value is not an array value: addr=%p, "
- "type=%d", array_obj, array_obj->type);
+ "type=%s", array_obj,
+ bt_value_type_string(array_obj->type));
ret = BT_VALUE_STATUS_INVAL;
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);
+ "type=%s", map_obj,
+ bt_value_type_string(map_obj->type));
ret = (int64_t) BT_VALUE_STATUS_INVAL;
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);
+ "type=%s", map_obj,
+ bt_value_type_string(map_obj->type));
ret = NULL;
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);
+ "type=%s", map_obj,
+ bt_value_type_string(map_obj->type));
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);
+ "type=%s", map_obj,
+ bt_value_type_string(map_obj->type));
ret = BT_VALUE_STATUS_INVAL;
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);
+ "type=%s", map_obj,
+ bt_value_type_string(map_obj->type));
ret = BT_VALUE_STATUS_INVAL;
goto end;
}
const char *key_str = g_quark_to_string(GPOINTER_TO_UINT(key));
if (!cb(key_str, element_obj, data)) {
- BT_LOGD("User cancelled the loop: key=\"%s\", "
+ BT_LOGV("User cancelled the loop: key=\"%s\", "
"value-addr=%p, data=%p",
key_str, element_obj, data);
ret = BT_VALUE_STATUS_CANCELLED;
if (!bt_value_is_map(base_map_obj)) {
BT_LOGW("Invalid parameter: value is not a map value: addr=%p, "
- "type=%d", base_map_obj, base_map_obj->type);
+ "type=%s", base_map_obj,
+ bt_value_type_string(base_map_obj->type));
goto error;
}
if (!bt_value_is_map(extension_obj)) {
BT_LOGW("Invalid parameter: value is not a map value: addr=%p, "
- "type=%d", extension_obj, extension_obj->type);
+ "type=%s", extension_obj,
+ bt_value_type_string(extension_obj->type));
goto error;
}
if (object_a->type != object_b->type) {
BT_LOGV("Values are different: type mismatch: "
"value-a-addr=%p, value-b-addr=%p, "
- "value-a-type=%d, value-b-type=%d",
+ "value-a-type=%s, value-b-type=%s",
object_a, object_b,
- object_a->type, object_b->type);
+ bt_value_type_string(object_a->type),
+ bt_value_type_string(object_b->type));
goto end;
}