diff --git a/src/object.c b/src/object.c index deb4cde..0d352b8 100644 --- a/src/object.c +++ b/src/object.c @@ -57,7 +57,7 @@ cfw_new(CFWClass *class, ...) } void* -cfw_new_p(CFWClass *class, ...) +cfw_create(CFWClass *class, ...) { CFWObject *obj; diff --git a/src/object.h b/src/object.h index 00a19f0..eab18c7 100644 --- a/src/object.h +++ b/src/object.h @@ -36,7 +36,7 @@ typedef struct CFWObject { extern CFWClass *cfw_object; extern void* cfw_new(CFWClass*, ...); -extern void* cfw_new_p(CFWClass*, ...); +extern void* cfw_create(CFWClass*, ...); extern void* cfw_ref(void*); extern void cfw_unref(void*); extern void cfw_free(void*); diff --git a/tests/tests.c b/tests/tests.c index 65e484c..90a4bfe 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -59,57 +59,57 @@ print_map(CFWMap *map) int main() { - CFWRefPool *p; - CFWArray *a; - CFWString *s, *s2; - CFWMap *m; + CFWRefPool *pool; + CFWArray *array; + CFWString *str, *str2; + CFWMap *map; size_t i; - p = cfw_new(cfw_refpool); + pool = cfw_new(cfw_refpool); - a = cfw_new_p(cfw_array, - cfw_new_p(cfw_string, "Hallo"), - cfw_new_p(cfw_string, " Welt"), - cfw_new_p(cfw_string, "!"), NULL); + array = cfw_create(cfw_array, + cfw_create(cfw_string, "Hallo"), + cfw_create(cfw_string, " Welt"), + cfw_create(cfw_string, "!"), NULL); - s = cfw_new(cfw_string, NULL); + str = cfw_new(cfw_string, NULL); - for (i = 0; i < cfw_array_size(a); i++) - cfw_string_append(s, cfw_array_get(a, i)); + for (i = 0; i < cfw_array_size(array); i++) + cfw_string_append(str, cfw_array_get(array, i)); - cfw_unref(p); + cfw_unref(pool); - puts(cfw_string_c(s)); + puts(cfw_string_c(str)); - p = cfw_new(cfw_refpool); - s2 = cfw_new_p(cfw_string, "ll"); - printf("%zd\n", cfw_string_find(s, s2, cfw_range_all)); + pool = cfw_new(cfw_refpool); + str2 = cfw_create(cfw_string, "ll"); + printf("%zd\n", cfw_string_find(str, str2, cfw_range_all)); - cfw_unref(p); - cfw_unref(s); + cfw_unref(pool); + cfw_unref(str); - p = cfw_new(cfw_refpool); + pool = cfw_new(cfw_refpool); - m = cfw_new_p(cfw_map, - cfw_new_p(cfw_string, "Hallo"), - cfw_new_p(cfw_string, "Welt!"), - cfw_new_p(cfw_string, "Test"), - cfw_new_p(cfw_string, "success!"), - cfw_new_p(cfw_string, "int"), - cfw_new_p(cfw_int, INTMAX_C(1234)), NULL); + map = cfw_create(cfw_map, + cfw_create(cfw_string, "Hallo"), + cfw_create(cfw_string, "Welt!"), + cfw_create(cfw_string, "Test"), + cfw_create(cfw_string, "success!"), + cfw_create(cfw_string, "int"), + cfw_create(cfw_int, INTMAX_C(1234)), NULL); - print_map(m); + print_map(map); - cfw_map_set(m, - cfw_new_p(cfw_string, "Hallo"), - cfw_new_p(cfw_string, "Test")); + cfw_map_set(map, + cfw_create(cfw_string, "Hallo"), + cfw_create(cfw_string, "Test")); - print_map(m); + print_map(map); - cfw_map_set(m, cfw_new_p(cfw_string, "Hallo"), NULL); - print_map(m); + cfw_map_set(map, cfw_create(cfw_string, "Hallo"), NULL); + print_map(map); - cfw_unref(p); + cfw_unref(pool); return 0; }