@@ -865,40 +865,6 @@ static void test_talloc_bstr_realloc(void)
865865 talloc_free (ctx );
866866}
867867
868- /*
869- * talloc_memcmp_array - compare uint8_t arrays
870- */
871- static void test_talloc_memcmp_array (void )
872- {
873- TALLOC_CTX * ctx ;
874- uint8_t * a , * b ;
875- uint8_t data3 [] = {1 , 2 , 3 };
876- uint8_t data4a [] = {1 , 2 , 3 , 4 };
877- uint8_t data4b [] = {1 , 2 , 4 , 4 };
878-
879- ctx = talloc_init_const ("test" );
880-
881- TEST_CASE ("Equal arrays" );
882- a = talloc_typed_memdup (ctx , data3 , sizeof (data3 ));
883- b = talloc_typed_memdup (ctx , data3 , sizeof (data3 ));
884- TEST_CHECK (talloc_memcmp_array (a , b ) == 0 );
885-
886- TEST_CASE ("First array longer" );
887- talloc_free (a );
888- a = talloc_typed_memdup (ctx , data4a , sizeof (data4a ));
889- TEST_CHECK (talloc_memcmp_array (a , b ) > 0 );
890-
891- TEST_CASE ("Second array longer" );
892- TEST_CHECK (talloc_memcmp_array (b , a ) < 0 );
893-
894- TEST_CASE ("Same length, different content" );
895- talloc_free (b );
896- b = talloc_typed_memdup (ctx , data4b , sizeof (data4b ));
897- TEST_CHECK (talloc_memcmp_array (a , b ) < 0 ); /* 3 < 4 */
898-
899- talloc_free (ctx );
900- }
901-
902868/*
903869 * talloc_memcmp_bstr - compare char arrays
904870 */
@@ -944,7 +910,7 @@ static void test_talloc_typed_memdup(void)
944910}
945911
946912/*
947- * talloc_array_null_terminate / talloc_array_null_strip
913+ * talloc_array_null_terminate
948914 */
949915static void test_talloc_array_null_terminate (void )
950916{
@@ -964,17 +930,9 @@ static void test_talloc_array_null_terminate(void)
964930 TEST_CHECK (result [3 ] == NULL );
965931 TEST_CHECK (result [0 ] == (void * )1 );
966932
967- TEST_CASE ("Strip NULL termination" );
968- result = talloc_array_null_strip (result );
969- TEST_ASSERT (result != NULL );
970- TEST_CHECK (talloc_array_length (result ) == 3 );
971-
972933 TEST_CASE ("NULL terminate NULL returns NULL" );
973934 TEST_CHECK (talloc_array_null_terminate (NULL ) == NULL );
974935
975- TEST_CASE ("NULL strip NULL returns NULL" );
976- TEST_CHECK (talloc_array_null_strip (NULL ) == NULL );
977-
978936 talloc_free (ctx );
979937}
980938
@@ -1056,61 +1014,6 @@ static void test_talloc_hdr_size(void)
10561014 TEST_CHECK (talloc_hdr_size () == hdr );
10571015}
10581016
1059- /*
1060- * talloc_child_ctx - ordered allocation and deallocation
1061- */
1062- static int child_free_order [4 ];
1063- static int child_free_idx ;
1064-
1065- static int _track_free_order (int * ptr )
1066- {
1067- int val = * ptr ;
1068- if (child_free_idx < 4 ) child_free_order [child_free_idx ++ ] = val ;
1069- return 0 ;
1070- }
1071-
1072- static void test_talloc_child_ctx (void )
1073- {
1074- TALLOC_CTX * ctx ;
1075- TALLOC_CHILD_CTX * list , * c1 , * c2 , * c3 ;
1076- int * v1 , * v2 , * v3 ;
1077-
1078- ctx = talloc_init_const ("test" );
1079-
1080- TEST_CASE ("Child ctx init" );
1081- list = talloc_child_ctx_init (ctx );
1082- TEST_ASSERT (list != NULL );
1083-
1084- TEST_CASE ("Allocate children in order" );
1085- c1 = talloc_child_ctx_alloc (list );
1086- TEST_ASSERT (c1 != NULL );
1087- v1 = talloc (c1 , int );
1088- * v1 = 1 ;
1089- talloc_set_destructor (v1 , _track_free_order );
1090-
1091- c2 = talloc_child_ctx_alloc (list );
1092- TEST_ASSERT (c2 != NULL );
1093- v2 = talloc (c2 , int );
1094- * v2 = 2 ;
1095- talloc_set_destructor (v2 , _track_free_order );
1096-
1097- c3 = talloc_child_ctx_alloc (list );
1098- TEST_ASSERT (c3 != NULL );
1099- v3 = talloc (c3 , int );
1100- * v3 = 3 ;
1101- talloc_set_destructor (v3 , _track_free_order );
1102-
1103- TEST_CASE ("Children freed in FILO order" );
1104- child_free_idx = 0 ;
1105- memset (child_free_order , 0 , sizeof (child_free_order ));
1106- talloc_free (ctx );
1107-
1108- /* FILO: c3 (newest) freed first, then c2, then c1 */
1109- TEST_CHECK (child_free_order [0 ] == 3 );
1110- TEST_CHECK (child_free_order [1 ] == 2 );
1111- TEST_CHECK (child_free_order [2 ] == 1 );
1112- }
1113-
11141017/*
11151018 * talloc_realloc_zero - realloc that zeros new memory
11161019 */
@@ -1230,14 +1133,12 @@ TEST_LIST = {
12301133 { "talloc_bstrndup" , test_talloc_bstrndup },
12311134 { "talloc_bstr_append" , test_talloc_bstr_append },
12321135 { "talloc_bstr_realloc" , test_talloc_bstr_realloc },
1233- { "talloc_memcmp_array" , test_talloc_memcmp_array },
12341136 { "talloc_memcmp_bstr" , test_talloc_memcmp_bstr },
12351137 { "talloc_typed_memdup" , test_talloc_typed_memdup },
12361138 { "talloc_array_null_terminate" , test_talloc_array_null_terminate },
12371139 { "talloc_destructor_add" , test_talloc_destructor_add },
12381140 { "talloc_link_ctx" , test_talloc_link_ctx },
12391141 { "talloc_hdr_size" , test_talloc_hdr_size },
1240- { "talloc_child_ctx" , test_talloc_child_ctx },
12411142 { "talloc_realloc_zero" , test_talloc_realloc_zero },
12421143 { "talloc_decrease_ref_count" , test_talloc_decrease_ref_count },
12431144 { "talloc_aligned_array" , test_talloc_aligned_array },
0 commit comments