From 4201f560485de6501f7336a1d18239376373061d Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Thu, 13 Feb 2025 08:09:55 +0000 Subject: [PATCH] callocMagic has same API argument convention as calloc() --- bplane/bpBins.c | 2 +- grouter/grouteDens.c | 2 +- grouter/grouteMain.c | 2 +- mzrouter/mzTech.c | 4 ++-- utils/ihash.c | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bplane/bpBins.c b/bplane/bpBins.c index 141cd886..22a73b56 100644 --- a/bplane/bpBins.c +++ b/bplane/bpBins.c @@ -93,7 +93,7 @@ static BinArray *bpBinArrayNew(int dx, /* x diameter of bins */ /* allocate array */ size = sizeof(BinArray) + numBins*(sizeof(void *)); - new = (BinArray *)callocMagic(size); + new = (BinArray *)callocMagic(1, size); /* initial */ new->ba_bbox = *bbox; diff --git a/grouter/grouteDens.c b/grouter/grouteDens.c index 89b122cb..432fa33a 100644 --- a/grouter/grouteDens.c +++ b/grouter/grouteDens.c @@ -194,7 +194,7 @@ glDMAlloc(dm, top, cap) dm->dm_max = 0; dm->dm_size = top + 1; dm->dm_cap = cap; - dm->dm_value = (short *) callocMagic((unsigned) (sizeof (short) * dm->dm_size)); + dm->dm_value = (short *) callocMagic(dm->dm_size, (unsigned) (sizeof (short))); } /* diff --git a/grouter/grouteMain.c b/grouter/grouteMain.c index eb0f4e94..4e3f6e29 100644 --- a/grouter/grouteMain.c +++ b/grouter/grouteMain.c @@ -192,7 +192,7 @@ glClientInit(chanList, netList) } for (net = netList->nnl_nets; net; net = net->nnet_next) - net->nnet_cdata = (ClientData) callocMagic((unsigned) (sizeof (NetClient))); + net->nnet_cdata = (ClientData) callocMagic(1, (unsigned) (sizeof (NetClient))); } /* diff --git a/mzrouter/mzTech.c b/mzrouter/mzTech.c index 250af032..7fd82d47 100644 --- a/mzrouter/mzTech.c +++ b/mzrouter/mzTech.c @@ -609,7 +609,7 @@ mzTechLayer(argc, argv) } /* Allocate new route layer */ - new = (RouteLayer *) callocMagic((unsigned) (sizeof (RouteLayer))); + new = (RouteLayer *) callocMagic(1, (unsigned) (sizeof (RouteLayer))); /* Initialize RouteType section */ mzInitRouteType(&(new->rl_routeType),tileType); @@ -1143,7 +1143,7 @@ mzTechContact(argc, argv) if(tileType < 0) return; /* allocate new route contact */ - new = (RouteContact *) callocMagic((unsigned) (sizeof (RouteContact))); + new = (RouteContact *) callocMagic(1, (unsigned) (sizeof (RouteContact))); /* initialize RouteType section: * sets route type, initializes spacing array, etc. diff --git a/utils/ihash.c b/utils/ihash.c index 13dec78d..67358954 100644 --- a/utils/ihash.c +++ b/utils/ihash.c @@ -73,7 +73,7 @@ extern IHashTable *IHashInit( IHashTable *table; table = (IHashTable *)mallocMagic(sizeof(IHashTable)); - table->iht_table = (void **)callocMagic(sizeof(void *)*nBuckets); + table->iht_table = (void **)callocMagic(nBuckets, sizeof(void *)); table->iht_nBucketsInit = nBuckets; table->iht_nBuckets = nBuckets; table->iht_nEntries = 0; @@ -99,7 +99,7 @@ void IHashClear(IHashTable *table) { /* reinitial bucket array */ freeMagic((char *) table->iht_table); - table->iht_table = (void **)callocMagic(sizeof(void *)*table->iht_nBucketsInit); + table->iht_table = (void **)callocMagic(table->iht_nBucketsInit, sizeof(void *)); table->iht_nBuckets = table->iht_nBucketsInit; table->iht_nEntries = 0; @@ -217,7 +217,7 @@ static void iHashResize(IHashTable *table) int bucket; /* alloc a new table */ - table->iht_table = (void **)callocMagic(sizeof(void *)*newSize); + table->iht_table = (void **)callocMagic(newSize, sizeof(void *)); table->iht_nBuckets = newSize; table->iht_nEntries = 0;