mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-02-21 10:51:10 +00:00
Sanity check
This commit is contained in:
parent
db879bd626
commit
422c085fba
2 changed files with 9 additions and 4 deletions
1
gmqcc.h
1
gmqcc.h
|
@ -93,7 +93,6 @@
|
|||
typedef char uint8_size_is_correct [sizeof(uint8_t) == 1?1:-1];
|
||||
typedef char uint16_size_if_correct [sizeof(uint16_t) == 2?1:-1];
|
||||
typedef char uint32_size_is_correct [sizeof(uint32_t) == 4?1:-1];
|
||||
//typedef char int8_size_is_correct [sizeof(int8_t) == 1?1:-1];
|
||||
typedef char int16_size_if_correct [sizeof(int16_t) == 2?1:-1];
|
||||
typedef char int32_size_is_correct [sizeof(int32_t) == 4?1:-1];
|
||||
/* intptr_t / uintptr_t correct size check */
|
||||
|
|
12
typedef.c
12
typedef.c
|
@ -63,15 +63,21 @@ int typedef_add(struct lex_file *file, const char *from, const char *to) {
|
|||
strncmp(from, "entity", sizeof("entity")) == 0 ||
|
||||
strncmp(from, "void", sizeof("void")) == 0) {
|
||||
|
||||
typedef_table[hash] = mem_a(sizeof(typedef_node));
|
||||
typedef_table[hash]->name = util_strdup(from);
|
||||
typedef_table[hash] = mem_a(sizeof(typedef_node));
|
||||
if (typedef_table[hash])
|
||||
typedef_table[hash]->name = util_strdup(from);
|
||||
else
|
||||
return error(file, ERROR_PARSE, "ran out of resources for typedef %s\n", to);
|
||||
return -100;
|
||||
} else {
|
||||
/* search the typedefs for it (typedef-a-typedef?) */
|
||||
typedef_node *find = typedef_table[typedef_hash(from)];
|
||||
if (find) {
|
||||
typedef_table[hash] = mem_a(sizeof(typedef_node));
|
||||
typedef_table[hash]->name = util_strdup(find->name);
|
||||
if (typedef_table[hash])
|
||||
typedef_table[hash]->name = util_strdup(find->name);
|
||||
else
|
||||
return error(file, ERROR_PARSE, "ran out of resources for typedef %s\n", to);
|
||||
return -100;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue