Initial garbage colletor implementation
This commit is contained in:
@ -4,7 +4,11 @@
|
||||
#include <refcount/list.h>
|
||||
#include <string.h>
|
||||
|
||||
int main() {
|
||||
void *counting_strdup_callback(const void *str, void *ignored) {
|
||||
return counting_strdup(str);
|
||||
}
|
||||
|
||||
int main(int argc, const char **argv) {
|
||||
refcount_global_allocator = &COUNTING_ALLOCATOR;
|
||||
|
||||
assert(refcount_list_length(NULL) == 0);
|
||||
@ -77,7 +81,7 @@ int main() {
|
||||
assert(strcmp(refcount_list_nth(l, 3), "str4") == 0);
|
||||
assert(strcmp(refcount_list_nth(l, 4), "str5") == 0);
|
||||
|
||||
RefcountList *l2 = refcount_list_copy(l, (void *) counting_strdup);
|
||||
RefcountList *l2 = refcount_list_copy(l, counting_strdup_callback, NULL);
|
||||
|
||||
refcount_list_free(l, counting_free);
|
||||
|
||||
|
Reference in New Issue
Block a user