Skip to content

ListCopyInit

Description

Deep-copy init callback wired into the list, or NULL if the list was initialised without deep-copy semantics.

Parameters

Name Direction Description
l in List to query.

Usage example (Cross-references)

Usage examples (Cross-references)
        ValidateList(&list_d);
    
        bool result = (ListCopyInit(&list_a) == NULL) && (ListCopyDeinit(&list_a) == NULL) && (ListLen(&list_a) == 0);
        result      = result && (ListCopyInit(&list_b) == NULL) && (ListCopyDeinit(&list_b) == NULL) && (ListLen(&list_b) == 0);
        result      = result && (ListCopyInit(&list_c) == tracked_copy_init) && (ListCopyDeinit(&list_c) == tracked_copy_deinit);
    
        bool result = (ListCopyInit(&list_a) == NULL) && (ListCopyDeinit(&list_a) == NULL) && (ListLen(&list_a) == 0);
        result      = result && (ListCopyInit(&list_b) == NULL) && (ListCopyDeinit(&list_b) == NULL) && (ListLen(&list_b) == 0);
        result      = result && (ListCopyInit(&list_c) == tracked_copy_init) && (ListCopyDeinit(&list_c) == tracked_copy_deinit);
        result      = result && (ListCopyInit(&list_d) == tracked_copy_init) && (ListCopyDeinit(&list_d) == tracked_copy_deinit);
        bool result = (ListCopyInit(&list_a) == NULL) && (ListCopyDeinit(&list_a) == NULL) && (ListLen(&list_a) == 0);
        result      = result && (ListCopyInit(&list_b) == NULL) && (ListCopyDeinit(&list_b) == NULL) && (ListLen(&list_b) == 0);
        result      = result && (ListCopyInit(&list_c) == tracked_copy_init) && (ListCopyDeinit(&list_c) == tracked_copy_deinit);
        result      = result && (ListCopyInit(&list_d) == tracked_copy_init) && (ListCopyDeinit(&list_d) == tracked_copy_deinit);
        result      = result && (ListCopyInit(&list_b) == NULL) && (ListCopyDeinit(&list_b) == NULL) && (ListLen(&list_b) == 0);
        result      = result && (ListCopyInit(&list_c) == tracked_copy_init) && (ListCopyDeinit(&list_c) == tracked_copy_deinit);
        result      = result && (ListCopyInit(&list_d) == tracked_copy_init) && (ListCopyDeinit(&list_d) == tracked_copy_deinit);
    
        ListDeinit(&list_a);
        bool result = (ListAllocator(&list_a)->retry_limit == 23) && (ListAllocator(&list_b)->retry_limit == 23);
        result      = result && (ListAllocator(&list_c)->retry_limit == 23) && (ListAllocator(&list_d)->retry_limit == 23);
        result      = result && (ListCopyInit(&list_c) == tracked_copy_init) && (ListCopyDeinit(&list_d) == tracked_copy_deinit);
    
        ListDeinit(&list_a);
        result = result && (ListHead(&list) == NULL) && (ListTail(&list) == NULL) && (ListLen(&list) == 0);
        // Verifying ListDeinit clears the hook fields.
        result = result && (ListCopyInit(&list) == NULL) && (ListCopyDeinit(&list) == NULL);
        DefaultAllocatorDeinit(&alloc);
        return result;
        result      = result && list_matches(GENERIC_LIST(&dest), (const int[]) {1003, 1004}, 2);
        result      = result && (ListLen(&src) == 0) && (ListHead(&src) == NULL) && (ListTail(&src) == NULL);
        result      = result && (ListCopyInit(&src) == tracked_copy_init) && (ListCopyDeinit(&src) == tracked_copy_deinit);
    
        ListPushBackR(&src, 5);
        // `__magic` is verifying the private magic-value invariant the validator depends on
        // (intentional bypass for that field; the rest go through public accessors).
        bool result = (ListHead(&list) == NULL) && (ListTail(&list) == NULL) && (ListCopyInit(&list) == NULL) &&
                      (ListCopyDeinit(&list) == NULL) && (ListLen(&list) == 0) && (list.__magic == LIST_MAGIC);
Last updated on