1
0
mirror of https://gitlab.xiph.org/xiph/icecast-common.git synced 2024-12-04 14:46:31 -05:00

Update: Converted igloo_ro_new_ext() to include a instance parameter

This commit is contained in:
Philipp Schafft 2019-09-14 20:00:58 +00:00
parent 0606e7d475
commit dd0ba39af3
5 changed files with 9 additions and 9 deletions

View File

@ -45,7 +45,7 @@ igloo_RO_FORWARD_TYPE(igloo_buffer_t);
* userdata, name, associated * userdata, name, associated
* See refobject_new(). * See refobject_new().
*/ */
igloo_buffer_t * igloo_buffer_new(ssize_t preallocation, const char *name, igloo_ro_t associated); igloo_buffer_t * igloo_buffer_new(ssize_t preallocation, const char *name, igloo_ro_t associated, igloo_ro_t instance);
/* Depreciated: This creates a new buffer with defaults. /* Depreciated: This creates a new buffer with defaults.
* Do NOT use this. Use refobject_new(igloo_buffer_t) * Do NOT use this. Use refobject_new(igloo_buffer_t)

View File

@ -292,7 +292,7 @@ igloo_ro_t igloo_ro_new__raw(const igloo_ro_type_t *type, const char *name,
igloo_ro_t igloo_ro_new__simple(const igloo_ro_type_t *type, const char *name, igloo_ro_t associated, igloo_ro_t instance, ...); igloo_ro_t igloo_ro_new__simple(const igloo_ro_type_t *type, const char *name, igloo_ro_t associated, igloo_ro_t instance, ...);
#define igloo_ro_new(type, ...) igloo_RO_TO_TYPE(igloo_ro_new__simple(igloo_RO_GET_TYPE_BY_SYMBOL(type), NULL, igloo_RO_NULL, igloo_RO_NULL, ## __VA_ARGS__), type) #define igloo_ro_new(type, ...) igloo_RO_TO_TYPE(igloo_ro_new__simple(igloo_RO_GET_TYPE_BY_SYMBOL(type), NULL, igloo_RO_NULL, igloo_RO_NULL, ## __VA_ARGS__), type)
#define igloo_ro_new_ext(type, name, associated, ...) igloo_RO_TO_TYPE(igloo_ro_new__simple(igloo_RO_GET_TYPE_BY_SYMBOL(type), (name), (associated), igloo_RO_NULL, ## __VA_ARGS__), type) #define igloo_ro_new_ext(type, name, associated, instance, ...) igloo_RO_TO_TYPE(igloo_ro_new__simple(igloo_RO_GET_TYPE_BY_SYMBOL(type), (name), (associated), (instance), ## __VA_ARGS__), type)
/* This increases the reference counter of the object */ /* This increases the reference counter of the object */
igloo_error_t igloo_ro_ref(igloo_ro_t self); igloo_error_t igloo_ro_ref(igloo_ro_t self);

View File

@ -46,9 +46,9 @@ static void __free(igloo_ro_t self)
free(buffer->buffer); free(buffer->buffer);
} }
igloo_buffer_t * igloo_buffer_new(ssize_t preallocation, const char *name, igloo_ro_t associated) igloo_buffer_t * igloo_buffer_new(ssize_t preallocation, const char *name, igloo_ro_t associated, igloo_ro_t instance)
{ {
igloo_buffer_t *buffer = igloo_ro_new_ext(igloo_buffer_t, name, associated); igloo_buffer_t *buffer = igloo_ro_new_ext(igloo_buffer_t, name, associated, instance);
if (!buffer) if (!buffer)
return NULL; return NULL;

View File

@ -22,7 +22,7 @@ static void test_create_ref_unref(void)
{ {
igloo_buffer_t *a; igloo_buffer_t *a;
a = igloo_buffer_new(-1, NULL, igloo_RO_NULL); a = igloo_buffer_new(-1, NULL, igloo_RO_NULL, igloo_RO_NULL);
ctest_test("buffer created", a != NULL); ctest_test("buffer created", a != NULL);
ctest_test("un-referenced", igloo_ro_unref(a) == igloo_ERROR_NONE); ctest_test("un-referenced", igloo_ro_unref(a) == igloo_ERROR_NONE);
@ -38,7 +38,7 @@ static void test_name(void)
const char *name = "test object name"; const char *name = "test object name";
const char *ret; const char *ret;
a = igloo_buffer_new(-1, name, igloo_RO_NULL); a = igloo_buffer_new(-1, name, igloo_RO_NULL, igloo_RO_NULL);
ctest_test("buffer created", a != NULL); ctest_test("buffer created", a != NULL);
ret = igloo_ro_get_name(a); ret = igloo_ro_get_name(a);
@ -57,7 +57,7 @@ static void test_associated(void)
ctest_test("refobject created", !igloo_RO_IS_NULL(a)); ctest_test("refobject created", !igloo_RO_IS_NULL(a));
b = igloo_buffer_new(-1, NULL, a); b = igloo_buffer_new(-1, NULL, a, igloo_RO_NULL);
ctest_test("buffer created with associated", !igloo_RO_IS_NULL(b)); ctest_test("buffer created with associated", !igloo_RO_IS_NULL(b));
ctest_test("un-referenced (1 of 2)", igloo_ro_unref(b) == igloo_ERROR_NONE); ctest_test("un-referenced (1 of 2)", igloo_ro_unref(b) == igloo_ERROR_NONE);

View File

@ -180,7 +180,7 @@ static void test_name(void)
const char *name = "test object name"; const char *name = "test object name";
const char *ret; const char *ret;
a = igloo_ro_new_ext(igloo_ro_base_t, name, igloo_RO_NULL); a = igloo_ro_new_ext(igloo_ro_base_t, name, igloo_RO_NULL, igloo_RO_NULL);
ctest_test("refobject created", !igloo_RO_IS_NULL(a)); ctest_test("refobject created", !igloo_RO_IS_NULL(a));
ret = igloo_ro_get_name(a); ret = igloo_ro_get_name(a);
@ -197,7 +197,7 @@ static void test_associated(void)
a = igloo_ro_new(igloo_ro_base_t); a = igloo_ro_new(igloo_ro_base_t);
ctest_test("refobject created", !igloo_RO_IS_NULL(a)); ctest_test("refobject created", !igloo_RO_IS_NULL(a));
b = igloo_ro_new_ext(igloo_ro_base_t, NULL, a); b = igloo_ro_new_ext(igloo_ro_base_t, NULL, a, igloo_RO_NULL);
ctest_test("refobject created with associated", !igloo_RO_IS_NULL(b)); ctest_test("refobject created with associated", !igloo_RO_IS_NULL(b));
ctest_test("un-referenced (1 of 2)", igloo_ro_unref(b) == igloo_ERROR_NONE); ctest_test("un-referenced (1 of 2)", igloo_ro_unref(b) == igloo_ERROR_NONE);