From 0477b43f80f9d56fb1f1fa86f1be65dd74b6b721 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 7 Jun 2002 18:14:39 +0000 Subject: [PATCH] get rid of PR_GetArray: it's redundant --- tools/qfcc/include/def.h | 3 --- tools/qfcc/source/pr_def.c | 17 ----------------- tools/qfcc/source/switch.c | 9 ++++----- 3 files changed, 4 insertions(+), 25 deletions(-) diff --git a/tools/qfcc/include/def.h b/tools/qfcc/include/def.h index 10af435c1..111543dfb 100644 --- a/tools/qfcc/include/def.h +++ b/tools/qfcc/include/def.h @@ -67,9 +67,6 @@ extern def_t def_ret, def_parms[MAX_PARMS]; extern def_t def_void; extern def_t def_function; -struct def_s *PR_GetArray (struct type_s *etype, const char *name, int size, - struct def_s *scope, int *allocate); - struct def_s *PR_GetDef (struct type_s *type, const char *name, struct def_s *scope, int *allocate); struct def_s *PR_NewDef (struct type_s *type, const char *name, diff --git a/tools/qfcc/source/pr_def.c b/tools/qfcc/source/pr_def.c index fbe785c98..92a6568e1 100644 --- a/tools/qfcc/source/pr_def.c +++ b/tools/qfcc/source/pr_def.c @@ -91,23 +91,6 @@ check_for_name (type_t *type, const char *name, def_t *scope, int *allocate) return 0; } -def_t * -PR_GetArray (type_t *etype, const char *name, int size, def_t *scope, - int *allocate) -{ - type_t *type = pointer_type (etype); - def_t *def = check_for_name (type, name, scope, allocate); - - if (def || !allocate) - return def; - def = PR_NewDef (type, name, scope); - def->ofs = *allocate; - def->initialized = def->constant = 1; - *allocate += type_size (type) * size + 1; - G_INT (def->ofs) = def->ofs + 1; - return def; -} - /* PR_GetDef diff --git a/tools/qfcc/source/switch.c b/tools/qfcc/source/switch.c index 04bf26347..39b335ff1 100644 --- a/tools/qfcc/source/switch.c +++ b/tools/qfcc/source/switch.c @@ -291,17 +291,16 @@ build_switch (expr_t *sw, case_node_t *tree, int op, expr_t *sw_val, int low = tree->low->e.integer_val; int high = tree->high->e.integer_val; def_t *def; - expr_t *table = new_expr (); + expr_t *table; const char *name = new_label_name (); int i; expr_t *range = binary_expr ('-', tree->high, tree->low); range->type = ex_uinteger; - def = PR_GetArray (&type_uinteger, name, high - low + 1, 0, - &pr.num_globals); - table->type = ex_def; - table->e.def = def; + def = PR_GetDef (array_type (&type_uinteger, high - low + 1), name, 0, + &pr.num_globals); + table = new_def_expr (def); if (tree->left) { branch = new_binary_expr (IFB, temp, low_label);