Issue
=====
Field types should always be frozen (in both developer or production
modes) because they are metadata objects. Currently, they are only
frozen in developer mode.
Solution
========
Make the bt_field_type_common_freeze() and bt_field_type_freeze()
functions always called, not through a macro which is only enabled in
developer mode.
Known drawbacks
===============
Very small performance impact because we're trying to freeze a field
type every time bt_field_create() is called, but bt_field_create() is
not called often anyway due to field object pooling. The impact could
become noticeable eventually if we limit the sizes of object pools.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
enum bt_string_encoding encoding;
};
-#ifdef BT_DEV_MODE
-# define bt_field_type_freeze _bt_field_type_freeze
-# define bt_field_type_common_freeze _bt_field_type_common_freeze
-#else
-# define bt_field_type_freeze(_ft)
-# define bt_field_type_common_freeze(_ft)
-#endif
-
typedef struct bt_field_common *(* bt_field_common_create_func)(
struct bt_field_type_common *);
struct bt_field_type_common *ft);
BT_HIDDEN
-void _bt_field_type_common_freeze(struct bt_field_type_common *ft);
+void bt_field_type_common_freeze(struct bt_field_type_common *ft);
BT_HIDDEN
-void _bt_field_type_freeze(struct bt_field_type *ft);
+void bt_field_type_freeze(struct bt_field_type *ft);
BT_HIDDEN
struct bt_field_type_common *
}
BT_HIDDEN
-void _bt_field_type_common_freeze(struct bt_field_type_common *ft)
+void bt_field_type_common_freeze(struct bt_field_type_common *ft)
{
if (!ft || ft->frozen) {
return;
}
BT_HIDDEN
-void _bt_field_type_freeze(struct bt_field_type *ft)
+void bt_field_type_freeze(struct bt_field_type *ft)
{
- _bt_field_type_common_freeze((void *) ft);
+ bt_field_type_common_freeze((void *) ft);
}
BT_HIDDEN