Commit 0511d153 authored by marko's avatar marko

branches/zip: UT_LIST_VALIDATE(): Assert that the link is non-NULL

before dereferencing it.  In this way, ut_list_node_313 will be
pointing to the last non-NULL list item at the time of the assertion
failure.  (gcc-4.3.2 -O3 seems to optimize the common subexpressions
and make the variable NULL, though.)
parent ee2b2dc7
...@@ -216,14 +216,14 @@ and ASSERTION is a condition on ut_list_node_313. */ ...@@ -216,14 +216,14 @@ and ASSERTION is a condition on ut_list_node_313. */
#define UT_LIST_VALIDATE(NAME, TYPE, BASE, ASSERTION) \ #define UT_LIST_VALIDATE(NAME, TYPE, BASE, ASSERTION) \
do { \ do { \
ulint ut_list_i_313; \ ulint ut_list_i_313; \
TYPE * ut_list_node_313; \ TYPE* ut_list_node_313; \
\ \
ut_list_node_313 = (BASE).start; \ ut_list_node_313 = (BASE).start; \
\ \
for (ut_list_i_313 = 0; ut_list_i_313 < (BASE).count; \ for (ut_list_i_313 = (BASE).count; ut_list_i_313--; ) { \
ut_list_i_313++) { \
ut_a(ut_list_node_313); \ ut_a(ut_list_node_313); \
ASSERTION; \ ASSERTION; \
ut_ad((ut_list_node_313->NAME).next || !ut_list_i_313); \
ut_list_node_313 = (ut_list_node_313->NAME).next; \ ut_list_node_313 = (ut_list_node_313->NAME).next; \
} \ } \
\ \
...@@ -231,10 +231,10 @@ do { \ ...@@ -231,10 +231,10 @@ do { \
\ \
ut_list_node_313 = (BASE).end; \ ut_list_node_313 = (BASE).end; \
\ \
for (ut_list_i_313 = 0; ut_list_i_313 < (BASE).count; \ for (ut_list_i_313 = (BASE).count; ut_list_i_313--; ) { \
ut_list_i_313++) { \
ut_a(ut_list_node_313); \ ut_a(ut_list_node_313); \
ASSERTION; \ ASSERTION; \
ut_ad((ut_list_node_313->NAME).prev || !ut_list_i_313); \
ut_list_node_313 = (ut_list_node_313->NAME).prev; \ ut_list_node_313 = (ut_list_node_313->NAME).prev; \
} \ } \
\ \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment