aboutsummaryrefslogtreecommitdiff
path: root/match.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-07-30 14:44:00 -0700
committerBruce Hill <bruce@bruce-hill.com>2021-07-30 14:44:00 -0700
commit3445982b16a3f8bf910d5ab679d840bb8d9ec20e (patch)
tree52df7e3b15d06dcb1289011c1ee9fb7aed1d3893 /match.c
parentad640caac60bcb000ea0647b77f809a714aaaad2 (diff)
Ergonomic improvement: xcalloc -> new(), xrealloc -> grow()
Diffstat (limited to 'match.c')
-rw-r--r--match.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/match.c b/match.c
index 2531163..b91cfda 100644
--- a/match.c
+++ b/match.c
@@ -136,7 +136,7 @@ static void cache_save(match_t *m)
} else {
cache_t old_cache = cache;
cache.size = old_cache.size == 0 ? 16 : 2*old_cache.size;
- cache.matches = xcalloc(cache.size, sizeof(match_t*));
+ cache.matches = new(match_t*[cache.size]);
// Rehash:
if (old_cache.matches) {
@@ -377,7 +377,7 @@ static match_t *match(def_t *defs, file_t *f, const char *str, pat_t *pat, bool
if (s != NULL) {
str = s->end;
if (nchildren+2 >= child_cap) {
- m->children = xrealloc(m->children, sizeof(match_t*)*(child_cap += 5));
+ m->children = grow(m->children, child_cap += 5);
for (size_t i = nchildren; i < child_cap; i++) m->children[i] = NULL;
}
add_owner(&m->children[nchildren++], s);
@@ -432,14 +432,14 @@ static match_t *match(def_t *defs, file_t *f, const char *str, pat_t *pat, bool
}
if (msep) {
if (nchildren+2 >= child_cap) {
- m->children = xrealloc(m->children, sizeof(match_t*)*(child_cap += 5));
+ m->children = grow(m->children, child_cap += 5);
for (size_t i = nchildren; i < child_cap; i++) m->children[i] = NULL;
}
add_owner(&m->children[nchildren++], msep);
}
if (nchildren+2 >= child_cap) {
- m->children = xrealloc(m->children, sizeof(match_t*)*(child_cap += 5));
+ m->children = grow(m->children, child_cap += 5);
for (size_t i = nchildren; i < child_cap; i++) m->children[i] = NULL;
}
add_owner(&m->children[nchildren++], mp);