Fix bug #356. Our sorting function was wrong if a value was between two NULL pointers.

This commit is contained in:
Benjamin Kramer
2009-08-22 11:45:20 +02:00
parent 5d0cdd6157
commit 832f9a9c64

View File

@@ -67,8 +67,8 @@ bool var_offset_sort_cb(const VarDeclaration* v1, const VarDeclaration* v2)
{
if (v1 && v2)
return v1->offset < v2->offset;
else
return false;
// sort NULL pointers towards the end
return v1 && !v2;
}
// this is pretty much the exact same thing we need to do for fields in each