[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/9] dfa: use MALLOC/REALLOC always
From: |
Paolo Bonzini |
Subject: |
[PATCH 3/9] dfa: use MALLOC/REALLOC always |
Date: |
Tue, 3 Jan 2012 09:38:16 +0100 |
src/dfa.c (dfastate, enlist, dfamust): Use MALLOC and REALLOC.
---
src/dfa.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/dfa.c b/src/dfa.c
index d2c24f7..aa87f87 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -2367,8 +2367,8 @@ dfastate (int s, struct dfa *d, int trans[])
int next_isnt_1st_byte = 0; /* Flag if we can't add state0. */
int i, j, k;
- grps = xnmalloc (NOTCHAR, sizeof *grps);
- labels = xnmalloc (NOTCHAR, sizeof *labels);
+ MALLOC (grps, NOTCHAR);
+ MALLOC (labels, NOTCHAR);
/* Initialize the set of letters, if necessary. */
if (! initialized)
@@ -3659,7 +3659,7 @@ enlist (char **cpp, char *new, size_t len)
cpp[i] = NULL;
}
/* Add the new string. */
- cpp = xnrealloc(cpp, i + 2, sizeof *cpp);
+ REALLOC(cpp, i + 2);
cpp[i] = new;
cpp[i + 1] = NULL;
return cpp;
@@ -3792,7 +3792,7 @@ dfamust (struct dfa *d)
result = empty_string;
exact = 0;
- musts = xnmalloc(d->tindex + 1, sizeof *musts);
+ MALLOC (musts, d->tindex + 1);
mp = musts;
for (i = 0; i <= d->tindex; ++i)
mp[i] = must0;
--
1.7.7.1
- [PATCH 0/9] dfa refactorings, Paolo Bonzini, 2012/01/03
- [PATCH 1/9] dfa: x2nrealloc starting from a NULL pointer works, Paolo Bonzini, 2012/01/03
- [PATCH 2/9] dfa: remove unnecessary braces, Paolo Bonzini, 2012/01/03
- [PATCH 3/9] dfa: use MALLOC/REALLOC always,
Paolo Bonzini <=
- [PATCH 4/9] dfa: use a separate data type for grps, Paolo Bonzini, 2012/01/03
- [PATCH 5/9] dfa: introduce alloc_posset, Paolo Bonzini, 2012/01/03
- [PATCH 6/9] dfa: remove dead assignment, Paolo Bonzini, 2012/01/03