From: Matthew Fernandez Date: Tue, 16 Jun 2020 00:06:27 +0000 (-0700) Subject: refactor calls to NEW that can tolerate failure into calloc X-Git-Tag: 2.44.1~5^2~1^2~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=46ec161020711d6b304fc9107cbe3a4ade0c8751;p=graphviz refactor calls to NEW that can tolerate failure into calloc We are about to make the NEW wrapper exit on allocation failure, so this preserves the existing semantics of allowing these calls to handle allocation failure locally. --- diff --git a/lib/label/index.c b/lib/label/index.c index 74fdb2857..bd769a699 100644 --- a/lib/label/index.c +++ b/lib/label/index.c @@ -22,7 +22,7 @@ LeafList_t *RTreeNewLeafList(Leaf_t * lp) { LeafList_t *llp; - if ((llp = NEW(LeafList_t))) { + if ((llp = calloc(1, sizeof(LeafList_t)))) { llp->leaf = lp; llp->next = 0; } @@ -57,7 +57,7 @@ void RTreeLeafListFree(LeafList_t * llp) */ static struct ListNode *RTreeNewListNode(void) { - return NEW(struct ListNode); + return calloc(1, sizeof(struct ListNode)); } #if UNUSED @@ -86,7 +86,7 @@ RTree_t *RTreeOpen() { RTree_t *rtp; - if ((rtp = NEW(RTree_t))) + if ((rtp = calloc(1, sizeof(RTree_t)))) rtp->root = RTreeNewIndex(rtp); return rtp; }