fix a bunch of segfaults

This commit is contained in:
Bill Currie 2003-08-20 22:36:02 +00:00
parent 93cafe878a
commit a2300387de
3 changed files with 21 additions and 19 deletions

View File

@ -131,7 +131,7 @@ bi_Hash_NewTable (progs_t *pr)
static void
bi_Hash_SetHashCompare (progs_t *pr)
{
bi_hashtab_t *ht = &G_STRUCT (pr, bi_hashtab_t, 0);
bi_hashtab_t *ht = &P_STRUCT (pr, bi_hashtab_t, 0);
unsigned long (*gh)(void*,void*);
int (*cmp)(void*,void*,void*);
@ -145,7 +145,7 @@ bi_Hash_SetHashCompare (progs_t *pr)
static void
bi_Hash_DelTable (progs_t *pr)
{
bi_hashtab_t *ht = &G_STRUCT (pr, bi_hashtab_t, 0);
bi_hashtab_t *ht = &P_STRUCT (pr, bi_hashtab_t, 0);
Hash_DelTable (ht->tab);
*ht->prev = ht->next;
@ -155,7 +155,7 @@ bi_Hash_DelTable (progs_t *pr)
static void
bi_Hash_FlushTable (progs_t *pr)
{
bi_hashtab_t *ht = &G_STRUCT (pr, bi_hashtab_t, 0);
bi_hashtab_t *ht = &P_STRUCT (pr, bi_hashtab_t, 0);
Hash_FlushTable (ht->tab);
}
@ -163,7 +163,7 @@ bi_Hash_FlushTable (progs_t *pr)
static void
bi_Hash_Add (progs_t *pr)
{
bi_hashtab_t *ht = &G_STRUCT (pr, bi_hashtab_t, 0);
bi_hashtab_t *ht = &P_STRUCT (pr, bi_hashtab_t, 0);
R_INT (pr) = Hash_Add (ht->tab, (void *) (long) P_INT (pr, 1));
}
@ -171,15 +171,15 @@ bi_Hash_Add (progs_t *pr)
static void
bi_Hash_AddElement (progs_t *pr)
{
bi_hashtab_t *ht = &G_STRUCT (pr, bi_hashtab_t, 0);
bi_hashtab_t *ht = &P_STRUCT (pr, bi_hashtab_t, 0);
R_INT (pr) = Hash_Add (ht->tab, (void *) (long) P_INT (pr, 1));
R_INT (pr) = Hash_AddElement (ht->tab, (void *) (long) P_INT (pr, 1));
}
static void
bi_Hash_Find (progs_t *pr)
{
bi_hashtab_t *ht = &G_STRUCT (pr, bi_hashtab_t, 0);
bi_hashtab_t *ht = &P_STRUCT (pr, bi_hashtab_t, 0);
R_INT (pr) = (long) Hash_Find (ht->tab, P_GSTRING (pr, 1));
}
@ -187,7 +187,7 @@ bi_Hash_Find (progs_t *pr)
static void
bi_Hash_FindElement (progs_t *pr)
{
bi_hashtab_t *ht = &G_STRUCT (pr, bi_hashtab_t, 0);
bi_hashtab_t *ht = &P_STRUCT (pr, bi_hashtab_t, 0);
R_INT (pr) = (long) Hash_FindElement (ht->tab,
(void *) (long) P_INT (pr, 1));
@ -196,7 +196,7 @@ bi_Hash_FindElement (progs_t *pr)
static void
bi_Hash_FindList (progs_t *pr)
{
bi_hashtab_t *ht = &G_STRUCT (pr, bi_hashtab_t, 0);
bi_hashtab_t *ht = &P_STRUCT (pr, bi_hashtab_t, 0);
void **list, **l;
pr_type_t *pr_list;
int count;
@ -214,7 +214,7 @@ bi_Hash_FindList (progs_t *pr)
static void
bi_Hash_FindElementList (progs_t *pr)
{
bi_hashtab_t *ht = &G_STRUCT (pr, bi_hashtab_t, 0);
bi_hashtab_t *ht = &P_STRUCT (pr, bi_hashtab_t, 0);
void **list, **l;
pr_type_t *pr_list;
int count;
@ -232,7 +232,7 @@ bi_Hash_FindElementList (progs_t *pr)
static void
bi_Hash_Del (progs_t *pr)
{
bi_hashtab_t *ht = &G_STRUCT (pr, bi_hashtab_t, 0);
bi_hashtab_t *ht = &P_STRUCT (pr, bi_hashtab_t, 0);
R_INT (pr) = (long) Hash_Del (ht->tab, P_GSTRING (pr, 1));
}
@ -240,7 +240,7 @@ bi_Hash_Del (progs_t *pr)
static void
bi_Hash_DelElement (progs_t *pr)
{
bi_hashtab_t *ht = &G_STRUCT (pr, bi_hashtab_t, 0);
bi_hashtab_t *ht = &P_STRUCT (pr, bi_hashtab_t, 0);
R_INT (pr) = (long) Hash_DelElement (ht->tab,
(void *) (long) P_INT (pr, 1));
@ -249,7 +249,7 @@ bi_Hash_DelElement (progs_t *pr)
static void
bi_Hash_Free (progs_t *pr)
{
bi_hashtab_t *ht = &G_STRUCT (pr, bi_hashtab_t, 0);
bi_hashtab_t *ht = &P_STRUCT (pr, bi_hashtab_t, 0);
Hash_Free (ht->tab, (void *) (long) P_INT (pr, 1));
}
@ -269,7 +269,7 @@ bi_Hash_Buffer (progs_t *pr)
static void
bi_Hash_GetList (progs_t *pr)
{
bi_hashtab_t *ht = &G_STRUCT (pr, bi_hashtab_t, 0);
bi_hashtab_t *ht = &P_STRUCT (pr, bi_hashtab_t, 0);
void **list, **l;
pr_type_t *pr_list;
int count;
@ -287,7 +287,7 @@ bi_Hash_GetList (progs_t *pr)
static void
bi_Hash_Stats (progs_t *pr)
{
bi_hashtab_t *ht = &G_STRUCT (pr, bi_hashtab_t, 0);
bi_hashtab_t *ht = &P_STRUCT (pr, bi_hashtab_t, 0);
Hash_Stats (ht->tab);
}

View File

@ -2512,7 +2512,8 @@ super_expr (class_type_t *class_type)
class_type_t _class_type;
if (!class_type)
return error (0, "`super' used outside of class implementation");
return error (new_expr (),
"`super' used outside of class implementation");
if (class_type->is_class)
class = class_type->c.class;
@ -2520,7 +2521,7 @@ super_expr (class_type_t *class_type)
class = class_type->c.category->class;
if (!class->super_class)
return error (0, "%s has no super class", class->name);
return error (new_expr (), "%s has no super class", class->name);
super_d = get_def (type_Super.aux_type, ".super", current_func->scope,
st_local);

View File

@ -806,8 +806,9 @@ undefined_def (qfo_def_t *def)
qfo_reloc_t *reloc = relocs.relocs + def->relocs;
for (i = 0; i < def->num_relocs; i++, reloc++) {
if (reloc->type == rel_op_a_def || reloc->type == rel_op_b_def
|| reloc->type == rel_op_c_def) {
if ((reloc->type == rel_op_a_def || reloc->type == rel_op_b_def
|| reloc->type == rel_op_c_def)
&& lines.lines) {
qfo_func_t *func = funcs.funcs;
qfo_func_t *best = func;
int best_dist = reloc->ofs - func->code;