summaryrefslogtreecommitdiff
path: root/masm/reftab.c
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-10-21 12:27:18 -0400
committerFreya Murphy <freya@freyacat.org>2024-10-21 12:27:18 -0400
commit37a4e740133f8e4d669cafc8468dd13107a4810a (patch)
tree116b001142b5c0aea03ae46ef299f5fc220c4e5e /masm/reftab.c
parentadd mips1 and mips32r2 isa definitions (diff)
downloadmips-37a4e740133f8e4d669cafc8468dd13107a4810a.tar.gz
mips-37a4e740133f8e4d669cafc8468dd13107a4810a.tar.bz2
mips-37a4e740133f8e4d669cafc8468dd13107a4810a.zip
save dev statedev
Diffstat (limited to 'masm/reftab.c')
-rw-r--r--masm/reftab.c43
1 files changed, 0 insertions, 43 deletions
diff --git a/masm/reftab.c b/masm/reftab.c
deleted file mode 100644
index f8793e1..0000000
--- a/masm/reftab.c
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <stdlib.h>
-#include <merror.h>
-
-#include "tab.h"
-
-#define REFTAB_INIT_LEN 8
-
-int reftab_init(struct reference_table *reftab)
-{
- reftab->size = REFTAB_INIT_LEN;
- reftab->len = 0;
- reftab->references = malloc(sizeof(struct reference)
- * REFTAB_INIT_LEN);
-
- if (reftab->references == NULL) {
- PERROR("cannot alloc");
- return M_ERROR;
- }
-
- return M_SUCCESS;
-}
-
-void reftab_free(struct reference_table *reftab)
-{
- free(reftab->references);
-}
-
-int reftab_push(struct reference_table *reftab, struct reference *ref)
-{
- if (reftab->len >= reftab->size) {
- reftab->size *= 2;
- reftab->references = realloc(reftab->references,
- sizeof(struct reference) * reftab->size);
-
- if (reftab->references == NULL) {
- PERROR("cannot realloc");
- return M_ERROR;
- }
- }
-
- reftab->references[reftab->len++] = *ref;
- return M_SUCCESS;
-}