static
void bt_ctf_clock_destroy(struct bt_object *obj);
-struct bt_ctf_clock *bt_ctf_clock_create_empty(void)
-{
- struct bt_ctf_clock *clock = g_new0(
- struct bt_ctf_clock, 1);
-
- if (!clock) {
- goto end;
- }
-
- clock->precision = 1;
- clock->frequency = 1000000000;
- bt_object_init(clock, bt_ctf_clock_destroy);
-end:
- return clock;
-}
-
BT_HIDDEN
bool bt_ctf_clock_is_valid(struct bt_ctf_clock *clock)
{
struct bt_ctf_clock *bt_ctf_clock_create(const char *name)
{
int ret;
- struct bt_ctf_clock *clock = NULL;
+ struct bt_ctf_clock *clock = g_new0(struct bt_ctf_clock, 1);
- clock = bt_ctf_clock_create_empty();
if (!clock) {
goto error;
}
- ret = bt_ctf_clock_set_name(clock, name);
- if (ret) {
- goto error;
+ clock->precision = 1;
+ clock->frequency = 1000000000;
+ bt_object_init(clock, bt_ctf_clock_destroy);
+
+ if (name) {
+ ret = bt_ctf_clock_set_name(clock, name);
+ if (ret) {
+ goto error;
+ }
}
ret = bt_uuid_generate(clock->uuid);
*
* Allocate a new clock setting its reference count to 1.
*
- * @param name Name of the clock (will be copied).
+ * @param name Name of the clock (will be copied); can be set to NULL
+ * for nameless clocks.
*
* Returns an allocated clock on success, NULL on error.
*/
extern struct bt_ctf_clock *bt_ctf_clock_create(const char *name);
-extern struct bt_ctf_clock *bt_ctf_clock_create_empty(void);
-
-extern int bt_ctf_clock_set_name(struct bt_ctf_clock *clock, const char *name);
-
/*
* bt_ctf_clock_get_name: get a clock's name.
*