Replace calloc by tcalloc

This commit is contained in:
Holger Vogt 2017-11-05 10:44:08 +01:00
parent 4e263cd14a
commit 1894b10ddd
8 changed files with 16 additions and 16 deletions

View File

@ -38,13 +38,13 @@ extern void txfree(const void *ptr);
#define RALLOC(ptr, type, number) \
do { \
if ((number) && (ptr = (type *)calloc((size_t)(number), sizeof(type))) == NULL) \
if ((number) && (ptr = (type *)tcalloc((size_t)(number), sizeof(type))) == NULL) \
return E_NOMEM; \
} while(0)
#define XALLOC(ptr, type, number) \
do { \
if ((number) && (ptr = (type *)calloc((size_t)(number), sizeof(type))) == NULL) { \
if ((number) && (ptr = (type *)tcalloc((size_t)(number), sizeof(type))) == NULL) { \
SPfrontEnd->IFerrorf(E_PANIC, "Out of Memory"); \
controlled_exit(1); \
} \
@ -52,7 +52,7 @@ extern void txfree(const void *ptr);
#define XCALLOC(ptr, type, number) \
do { \
if ((number) && (ptr = (type *)calloc((size_t)(number), sizeof(type))) == NULL) { \
if ((number) && (ptr = (type *)tcalloc((size_t)(number), sizeof(type))) == NULL) { \
fprintf(stderr, "Out of Memory\n"); \
controlled_exit(1); \
} \

View File

@ -380,7 +380,7 @@ extern void * trealloc(const void *, size_t);
/* A new calloc */
#ifndef HAVE_LIBGC
#define SP_CALLOC(ptr,type,number) \
{ ptr = (type *) calloc((size_t)(number), sizeof(type)); \
{ ptr = (type *) tcalloc((size_t)(number), sizeof(type)); \
}
#else /* HAVE_LIBCG */
#define SP_CALLOC(ptr,type,number) \

View File

@ -539,22 +539,22 @@ new_memory(int dim, int deg, int deg_o)
for (i = 0; i < dim; i++)
for (j = 0; j < dim; j++)
SiSv_1[i][j] = (double *) calloc((size_t) (deg_o+1), sizeof(double));
SiSv_1[i][j] = (double *) tcalloc((size_t) (deg_o+1), sizeof(double));
for (i = 0; i < dim; i++)
for (j = 0; j < dim; j++)
Sip[i][j] = (double *) calloc((size_t) (deg_o+1), sizeof(double));
Sip[i][j] = (double *) tcalloc((size_t) (deg_o+1), sizeof(double));
for (i = 0; i < dim; i++)
for (j = 0; j < dim; j++)
Si_1p[i][j] = (double *) calloc((size_t) (deg_o+1), sizeof(double));
Si_1p[i][j] = (double *) tcalloc((size_t) (deg_o+1), sizeof(double));
for (i = 0; i < dim; i++)
for (j = 0; j < dim; j++)
Sv_1p[i][j] = (double *) calloc((size_t) (deg_o+1), sizeof(double));
Sv_1p[i][j] = (double *) tcalloc((size_t) (deg_o+1), sizeof(double));
for (i = 0; i < dim; i++)
W[i] = (double *) calloc(MAX_DEG, sizeof(double));
W[i] = (double *) tcalloc(MAX_DEG, sizeof(double));
}
/***
@ -1355,7 +1355,7 @@ generate_out(int dim, int deg_o)
continue;
}
}
p = SIV[i][j].Poly = (double *) calloc(7, sizeof(double));
p = SIV[i][j].Poly = (double *) tcalloc(7, sizeof(double));
p[0] = c1;
p[1] = c2;
p[2] = c3;
@ -1486,7 +1486,7 @@ matrix_p_mult(
for (j = 0; j < dim; j++)
for (k = 0; k < dim; k++) {
p = X[i][j].Poly[k] =
(double *) calloc((size_t) (deg_o+1), sizeof(double));
(double *) tcalloc((size_t) (deg_o+1), sizeof(double));
mult_p(A[i][k], T[k][j], p, deg, deg_o, deg_o);
t1 = X[i][j].C_0[k] = p[0];
if (t1 != 0.0) {

View File

@ -17,7 +17,7 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "ngspice/meshext.h"
#define TSCALLOC(var, size, type)\
if (size && (var =(type *)calloc(1, (unsigned)(size)*sizeof(type))) == NULL) {\
if (size && (var =(type *)tcalloc(1, (unsigned)(size)*sizeof(type))) == NULL) {\
return(E_NOMEM);\
}

View File

@ -18,7 +18,7 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "ngspice/suffix.h"
#define TSCALLOC(var, size, type)\
if (size && (var = (type *)calloc(1, (unsigned)(size)*sizeof(type))) == NULL) {\
if (size && (var = (type *)tcalloc(1, (unsigned)(size)*sizeof(type))) == NULL) {\
return(E_NOMEM);\
}

View File

@ -17,7 +17,7 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "ngspice/meshext.h"
#define TSCALLOC(var, size, type)\
if (size && (var =(type *)calloc(1, (unsigned)(size)*sizeof(type))) == NULL) {\
if (size && (var =(type *)tcalloc(1, (unsigned)(size)*sizeof(type))) == NULL) {\
return(E_NOMEM);\
}

View File

@ -18,7 +18,7 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "ngspice/suffix.h"
#define TSCALLOC(var, size, type)\
if (size && (var =(type *)calloc(1, (unsigned)(size)*sizeof(type))) == NULL) {\
if (size && (var =(type *)tcalloc(1, (unsigned)(size)*sizeof(type))) == NULL) {\
return(E_NOMEM);\
}

View File

@ -18,7 +18,7 @@ Author: 1987 Kartikeya Mayaram, U. C. Berkeley CAD Group
#include "ngspice/suffix.h"
#define TSCALLOC(var, size, type)\
if (size && (var = (type *)calloc(1, (unsigned)(size)*sizeof(type))) == NULL) {\
if (size && (var = (type *)tcalloc(1, (unsigned)(size)*sizeof(type))) == NULL) {\
return(E_NOMEM);\
}