type: Make an assert()ion independent of the last entry of an enum.
authorChristoph Mallon <christoph.mallon@gmx.de>
Tue, 25 Dec 2012 12:08:07 +0000 (13:08 +0100)
committerChristoph Mallon <christoph.mallon@gmx.de>
Thu, 27 Dec 2012 11:58:43 +0000 (12:58 +0100)
type.c

diff --git a/type.c b/type.c
index fd3b4ce..5a71c31 100644 (file)
--- a/type.c
+++ b/type.c
@@ -50,8 +50,7 @@ static size_t get_type_struct_size(type_kind_t kind)
                [TYPE_TYPEDEF]         = sizeof(typedef_type_t),
                [TYPE_TYPEOF]          = sizeof(typeof_type_t),
        };
-       assert(lengthof(sizes) == (int)TYPE_TYPEOF + 1);
-       assert(kind <= TYPE_TYPEOF);
+       assert((size_t)kind < lengthof(sizes));
        assert(sizes[kind] != 0);
        return sizes[kind];
 }