X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=type_hash.c;h=4168dde37513ebc8a324814c3d67f7416a2ba7a2;hb=00fad4c6c28b600fd17a6c3e8320dd6227c28e30;hp=be14de6c7dc1f78e03ca3fd1c6adb6d2ff65485f;hpb=f6c1ead779c365453da484355686e5e23ab0023d;p=cparser diff --git a/type_hash.c b/type_hash.c index be14de6..4168dde 100644 --- a/type_hash.c +++ b/type_hash.c @@ -29,7 +29,7 @@ static unsigned hash_ptr(const void *ptr) static unsigned hash_atomic_type(const atomic_type_t *type) { unsigned some_prime = 27644437; - unsigned result = type->atype * some_prime; + unsigned result = type->akind * some_prime; return result; } @@ -93,6 +93,8 @@ static unsigned hash_type(const type_t *type) case TYPE_INVALID: panic("internalizing void or invalid types not possible"); return 0; + case TYPE_ERROR: + return 0; case TYPE_ATOMIC: hash = hash_atomic_type(&type->atomic); break; @@ -135,7 +137,7 @@ static unsigned hash_type(const type_t *type) static bool atomic_types_equal(const atomic_type_t *type1, const atomic_type_t *type2) { - return type1->atype == type2->atype; + return type1->akind == type2->akind; } static bool function_types_equal(const function_type_t *type1, @@ -239,6 +241,9 @@ static bool types_equal(const type_t *type1, const type_t *type2) return false; switch(type1->kind) { + case TYPE_ERROR: + /* Hmm, the error type is never equal */ + return false; case TYPE_INVALID: return false; case TYPE_ATOMIC: