Skip to content

Commit

Permalink
Renamed fftw_malloc -> MALLOC, X(free) -> X(ifree), X(free0) ->
Browse files Browse the repository at this point in the history
X(ifree0), non_fftw_malloc -> NATIVE_MALLOC
  • Loading branch information
matteo-frigo committed Jan 13, 2003
1 parent ab8d02f commit 2f236bb
Show file tree
Hide file tree
Showing 44 changed files with 239 additions and 239 deletions.
4 changes: 2 additions & 2 deletions api/apiplan.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ apiplan *X(mkapiplan)(unsigned int flags, problem *prb)
AWAKE(pln, 1);

/* build apiplan */
p = (apiplan *)fftw_malloc(sizeof(apiplan), PLANS);
p = (apiplan *)MALLOC(sizeof(apiplan), PLANS);
p->pln = pln;
p->prb = prb;

Expand All @@ -62,6 +62,6 @@ void X(destroy_plan)(X(plan) p)
AWAKE(p->pln, 0);
X(plan_destroy_internal)(p->pln);
X(problem_destroy)(p->prb);
X(free)(p);
X(ifree)(p);
}
}
2 changes: 1 addition & 1 deletion api/export-wisdom-to-string.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ char *X(export_wisdom_to_string)(void)
plnr->adt->exprt(plnr, p);
X(printer_destroy)(p);

s = (char *) non_fftw_malloc(sizeof(char) * (cnt + 1), OTHER);
s = (char *) NATIVE_MALLOC(sizeof(char) * (cnt + 1), OTHER);
if (s) {
p = mkprinter_str(s);
plnr->adt->exprt(plnr, p);
Expand Down
16 changes: 8 additions & 8 deletions api/f77api.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static uint *reverse_n(uint rnk, const uint *n)
{
uint *nrev, i;
A(FINITE_RNK(rnk));
nrev = fftw_malloc(sizeof(uint) * rnk, PROBLEMS);
nrev = MALLOC(sizeof(uint) * rnk, PROBLEMS);
for (i = 0; i < rnk; ++i)
nrev[rnk-i-1] = n[i];
return nrev;
Expand All @@ -52,7 +52,7 @@ static X(iodim) *make_dims(uint rnk, const uint *n,
X(iodim) *dims;
uint i;
A(FINITE_RNK(rnk));
dims = fftw_malloc(sizeof(X(iodim)) * rnk, PROBLEMS);
dims = MALLOC(sizeof(X(iodim)) * rnk, PROBLEMS);
for (i = 0; i < rnk; ++i) {
dims[i].n = n[i];
dims[i].is = is[i];
Expand All @@ -73,7 +73,7 @@ void F77(plan_dft, PLAN_DFT)(X(plan) *p,
{
unsigned int *nrev = reverse_n(*rank, n);
*p = X(plan_dft)(*rank, nrev, in, out, *sign, *flags);
X(free0)(nrev);
X(ifree0)(nrev);
}

void F77(plan_dft_1d, PLAN_DFT_1D)(
Expand Down Expand Up @@ -117,9 +117,9 @@ void F77(plan_many_dft, PLAN_MANY_DFT)(
in, inembedrev, *istride, *idist,
out, onembedrev, *ostride, *odist,
*sign, *flags);
X(free0)(onembedrev);
X(free0)(inembedrev);
X(free0)(nrev);
X(ifree0)(onembedrev);
X(ifree0)(inembedrev);
X(ifree0)(nrev);
}

void F77(plan_guru_dft, PLAN_GURU_DFT)(
Expand All @@ -135,8 +135,8 @@ void F77(plan_guru_dft, PLAN_GURU_DFT)(
*p = X(plan_guru_dft)(*rank, dims, *howmany_rank, howmany_dims,
ri, ii, ro, io,
*flags);
X(free0)(howmany_dims);
X(free0)(dims);
X(ifree0)(howmany_dims);
X(ifree0)(dims);
}

void F77(execute_dft, EXECUTE_DFT)(X(plan) *p, R *ri, R *ii, R *ro, R *io)
Expand Down
2 changes: 1 addition & 1 deletion api/map-r2r-kind.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ rdft_kind *X(map_r2r_kind)(uint rank, const X(r2r_kind) *kind)
rdft_kind *k;

A(FINITE_RNK(rank));
k = (rdft_kind *) fftw_malloc(rank * sizeof(rdft_kind), PROBLEMS);
k = (rdft_kind *) MALLOC(rank * sizeof(rdft_kind), PROBLEMS);
for (i = 0; i < rank; ++i)
switch (kind[i]) {
case FFTW_R2HC: k[i] = R2HC; break;
Expand Down
2 changes: 1 addition & 1 deletion api/plan-guru-r2r.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ X(plan) X(plan_guru_r2r)(unsigned int rank, const X(iodim) *dims,
X(mkproblem_rdft_d)(X(mktensor_iodims)(rank, dims),
X(mktensor_iodims)(howmany_rank, howmany_dims),
in, out, k));
X(free0)(k);
X(ifree0)(k);
return p;
}
4 changes: 2 additions & 2 deletions api/plan-many-dft-c2r.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ X(plan) X(plan_many_dft_c2r)(unsigned int rank, const unsigned int *n,
X(mktensor_1d)(howmany, 2*idist, odist),
out, ri, ii, HC2R));

X(free0)(nfi);
X(free0)(nfo);
X(ifree0)(nfi);
X(ifree0)(nfo);
return p;
}
4 changes: 2 additions & 2 deletions api/plan-many-dft-r2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ X(plan) X(plan_many_dft_r2c)(unsigned int rank, const unsigned int *n,
X(mktensor_1d)(howmany, idist, 2*odist),
in, ro, io, R2HC));

X(free0)(nfi);
X(free0)(nfo);
X(ifree0)(nfi);
X(ifree0)(nfo);
return p;
}
2 changes: 1 addition & 1 deletion api/plan-many-r2r.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ X(plan) X(plan_many_r2r)(unsigned int rank, const unsigned int *n,
istride, ostride),
X(mktensor_1d)(howmany, idist, odist),
in, out, k));
X(free0)(k);
X(ifree0)(k);
return p;
}
2 changes: 1 addition & 1 deletion api/rdft2-pad.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const uint *X(rdft2_pad)(uint rnk, const uint *n, const uint *nembed,
*nfree = 0;
if (!nembed && rnk > 0) {
if (inplace || cmplx) {
uint *np = (uint *) fftw_malloc(sizeof(uint) * rnk, PROBLEMS);
uint *np = (uint *) MALLOC(sizeof(uint) * rnk, PROBLEMS);
memcpy(np, n, sizeof(uint) * rnk);
np[rnk-1] = (n[rnk-1]/2 + 1) * (1 + !cmplx);
nembed = *nfree = np;
Expand Down
12 changes: 6 additions & 6 deletions dft/buffered.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

/* $Id: buffered.c,v 1.41 2003-01-11 14:17:34 athena Exp $ */
/* $Id: buffered.c,v 1.42 2003-01-13 09:20:36 athena Exp $ */

#include "dft.h"

Expand Down Expand Up @@ -51,7 +51,7 @@ static void apply(plan *ego_, R *ri, R *ii, R *ro, R *io)
{
P *ego = (P *) ego_;
uint nbuf = ego->nbuf;
R *bufs = (R *)fftw_malloc(sizeof(R) * nbuf * ego->bufdist * 2, BUFFERS);
R *bufs = (R *)MALLOC(sizeof(R) * nbuf * ego->bufdist * 2, BUFFERS);

plan_dft *cld = (plan_dft *) ego->cld;
plan_dft *cldcpy = (plan_dft *) ego->cldcpy;
Expand Down Expand Up @@ -79,7 +79,7 @@ static void apply(plan *ego_, R *ri, R *ii, R *ro, R *io)
cldrest = (plan_dft *) ego->cldrest;
cldrest->apply((plan *) cldrest, ri, ii, ro, io);

X(free)(bufs);
X(ifree)(bufs);
}


Expand Down Expand Up @@ -221,7 +221,7 @@ static plan *mkplan(const solver *ego_, const problem *p_, planner *plnr)
ioffset = 1 - roffset;

/* initial allocation for the purpose of planning */
bufs = (R *) fftw_malloc(sizeof(R) * nbuf * bufdist * 2, BUFFERS);
bufs = (R *) MALLOC(sizeof(R) * nbuf * bufdist * 2, BUFFERS);

cld = X(mkplan_d)(plnr,
X(mkproblem_dft_d)(
Expand All @@ -242,7 +242,7 @@ static plan *mkplan(const solver *ego_, const problem *p_, planner *plnr)
goto nada;

/* deallocate buffers, let apply() allocate them for real */
X(free)(bufs);
X(ifree)(bufs);
bufs = 0;

/* plan the leftover transforms (cldrest): */
Expand Down Expand Up @@ -278,7 +278,7 @@ static plan *mkplan(const solver *ego_, const problem *p_, planner *plnr)
return &(pln->super.super);

nada:
X(free0)(bufs);
X(ifree0)(bufs);
X(plan_destroy_internal)(cldrest);
X(plan_destroy_internal)(cldcpy);
X(plan_destroy_internal)(cld);
Expand Down
2 changes: 1 addition & 1 deletion dft/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ static plan *mkplan(const solver *ego, const problem *p_, planner *plnr)

nada:
X(plan_destroy_internal)(cld);
X(free0)(pln);
X(ifree0)(pln);
return (plan *) 0;
}

Expand Down
4 changes: 2 additions & 2 deletions dft/problem.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

/* $Id: problem.c,v 1.25 2003-01-09 05:02:35 stevenj Exp $ */
/* $Id: problem.c,v 1.26 2003-01-13 09:20:36 athena Exp $ */

#include "dft.h"
#include <stddef.h>
Expand All @@ -27,7 +27,7 @@ static void destroy(problem *ego_)
{
problem_dft *ego = (problem_dft *) ego_;
X(tensor_destroy2)(ego->vecsz, ego->sz);
X(free)(ego_);
X(ifree)(ego_);
}

static void hash(const problem *p_, md5 *m)
Expand Down
2 changes: 1 addition & 1 deletion dft/rader-omega.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ R *X(dft_rader_mkomega)(plan *p_, uint n, uint ginv)
if ((omega = X(rader_tl_find)(n, n, ginv, omegas)))
return omega;

omega = (R *)fftw_malloc(sizeof(R) * (n - 1) * 2, TWIDDLES);
omega = (R *)MALLOC(sizeof(R) * (n - 1) * 2, TWIDDLES);

scale = n - 1.0; /* normalization for convolution */

Expand Down
20 changes: 10 additions & 10 deletions dft/rader.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static void apply(plan *ego_, R *ri, R *ii, R *ro, R *io)
R *buf;

r = ego->n; is = ego->is; g = ego->g;
buf = (R *) fftw_malloc(sizeof(R) * (r - 1) * 2, BUFFERS);
buf = (R *) MALLOC(sizeof(R) * (r - 1) * 2, BUFFERS);

/* First, permute the input, storing in buf: */
for (gpower = 1, k = 0; k < r - 1; ++k, gpower = MULMOD(gpower, g, r)) {
Expand All @@ -132,7 +132,7 @@ static void apply(plan *ego_, R *ri, R *ii, R *ro, R *io)
apply_aux(r, ego->ginv, ego->cld1, ego->cld2, ego->omega,
buf, ri[0], ii[0], ro, io, ego->os);

X(free)(buf);
X(ifree)(buf);
}

static void apply_dit(plan *ego_, R *ri, R *ii, R *ro, R *io)
Expand Down Expand Up @@ -164,7 +164,7 @@ static void apply_dit(plan *ego_, R *ri, R *ii, R *ro, R *io)
osm = ego->os;
gpower = 1;

buf = (R *) fftw_malloc(sizeof(R) * (r - 1) * 2, BUFFERS);
buf = (R *) MALLOC(sizeof(R) * (r - 1) * 2, BUFFERS);

for (j = 0; j < m; ++j, ro += os, io += os, W += 2*(r - 1)) {
/* First, permute the input and multiply by W, storing in buf: */
Expand All @@ -184,7 +184,7 @@ static void apply_dit(plan *ego_, R *ri, R *ii, R *ro, R *io)
buf, ro[0], io[0], ro, io, osm);
}

X(free)(buf);
X(ifree)(buf);
}

static R *mktwiddle(uint m, uint r, uint g)
Expand All @@ -196,7 +196,7 @@ static R *mktwiddle(uint m, uint r, uint g)
if ((W = X(rader_tl_find)(m, r, g, twiddles)))
return W;

W = (R *)fftw_malloc(sizeof(R) * (r - 1) * m * 2, TWIDDLES);
W = (R *)MALLOC(sizeof(R) * (r - 1) * m * 2, TWIDDLES);
for (i = 0; i < m; ++i) {
for (gpower = 1, j = 0; j < r - 1;
++j, gpower = MULMOD(gpower, g, r)) {
Expand Down Expand Up @@ -339,7 +339,7 @@ static int mkP(P *pln, uint n, int is, int os, R *ro, R *io,
R *buf = (R *) 0;

/* initial allocation for the purpose of planning */
buf = (R *) fftw_malloc(sizeof(R) * (n - 1) * 2, BUFFERS);
buf = (R *) MALLOC(sizeof(R) * (n - 1) * 2, BUFFERS);

cld1 = X(mkplan_d)(plnr,
X(mkproblem_dft_d)(X(mktensor_1d)(n - 1, 2, os),
Expand All @@ -362,7 +362,7 @@ static int mkP(P *pln, uint n, int is, int os, R *ro, R *io,
if (!cld_omega) goto nada;

/* deallocate buffers; let awake() or apply() allocate them for real */
X(free)(buf);
X(ifree)(buf);
buf = 0;

pln->cld1 = cld1;
Expand All @@ -384,7 +384,7 @@ static int mkP(P *pln, uint n, int is, int os, R *ro, R *io,
return 1;

nada:
X(free0)(buf);
X(ifree0)(buf);
X(plan_destroy_internal)(cld_omega);
X(plan_destroy_internal)(cld2);
X(plan_destroy_internal)(cld1);
Expand All @@ -411,7 +411,7 @@ static plan *mkplan(const solver *ego, const problem *p_, planner *plnr)

pln = MKPLAN_DFT(P, &padt, apply);
if (!mkP(pln, n, is, os, p->ro, p->io, plnr)) {
X(free)(pln);
X(ifree)(pln);
return (plan *) 0;
}
return &(pln->super.super);
Expand Down Expand Up @@ -463,7 +463,7 @@ static plan *mkplan_dit(const solver *ego, const problem *p_, planner *plnr)

nada:
X(plan_destroy_internal)(cld);
X(free0)(pln);
X(ifree0)(pln);
return (plan *) 0;
}

Expand Down
12 changes: 6 additions & 6 deletions kernel/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

/* $Id: alloc.c,v 1.22 2003-01-12 17:45:26 stevenj Exp $ */
/* $Id: alloc.c,v 1.23 2003-01-13 09:20:36 athena Exp $ */

#include "ifftw.h"

Expand Down Expand Up @@ -118,7 +118,7 @@ static struct minfo *minfo[HASHSZ] = {0};
int X(in_thread) = 0;
#endif

void *X(malloc_debug)(size_t n, enum fftw_malloc_what what,
void *X(malloc_debug)(size_t n, enum malloc_tag what,
const char *file, int line)
{
char *p;
Expand Down Expand Up @@ -179,7 +179,7 @@ void *X(malloc_debug)(size_t n, enum fftw_malloc_what what,
return (void *) p;
}

void X(free)(void *p)
void X(ifree)(void *p)
{
char *q;

Expand Down Expand Up @@ -303,15 +303,15 @@ void *X(malloc_plain)(size_t n)
return p;
}

void X(free)(void *p)
void X(ifree)(void *p)
{
real_free(p);
}

#endif

void X(free0)(void *p)
void X(ifree0)(void *p)
{
/* common pattern */
if (p) X(free)(p);
if (p) X(ifree)(p);
}
Loading

0 comments on commit 2f236bb

Please sign in to comment.