unit-tests: remove unnecesary field from struct bbunit_listelem
authorBartosz Golaszewski <bartekgola@gmail.com>
Thu, 13 Aug 2015 13:57:21 +0000 (15:57 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 17 Aug 2015 15:00:10 +0000 (17:00 +0200)
In the initial submission struct bbunit_listelem was manipulated by
custom list functions implemented in bbunit.c. Since the tests are now
added to the list by llist_add_to_end(), which allocates the llist_t
objects behind the scenes, there's no need for the *next field.

function                                             old     new   delta
unit_main                                            142     141      -1
bbunit_strrstr_elem                                   24      16      -8
bbunit_obscure_weak_pass_elem                         24      16      -8
bbunit_obscure_strong_pass_elem                       24      16      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-25)             Total: -25 bytes

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
include/libbb.h
libbb/bbunit.c

index 54d01b75a09da4ba816d42f86ca3dc1b5a29b5cf..136d4fd87e39ce0454026aa08e8bbaa9d0f16653 100644 (file)
@@ -1983,7 +1983,6 @@ static ALWAYS_INLINE unsigned char bb_ascii_tolower(unsigned char a)
 typedef void (*bbunit_testfunc)(void);
 
 struct bbunit_listelem {
-       struct bbunit_listelem* next;
        const char* name;
        bbunit_testfunc testfunc;
 };
index 4c692d59f5092806f01f9ec1865a82f9b8f0ae18..66a7df945cd2c652039f03d323e74c64a503c8f7 100644 (file)
@@ -71,7 +71,6 @@ int unit_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
                        tests_failed++;
                }
                tests_run++;
-               el = el->next;
        }
 
 #if WANT_TIMING