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 */
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;
}
}