polish `MERROR' macro

checked for object file invariance
This commit is contained in:
rlar 2013-07-14 15:00:50 +02:00
parent a072a13cb0
commit 14a6bd9314
2 changed files with 11 additions and 10 deletions

View File

@ -43,11 +43,12 @@
#define NIL(type) ((type *)0) #define NIL(type) ((type *)0)
#define ABORT() fflush(stderr);fflush(stdout);abort(); #define ABORT() fflush(stderr);fflush(stdout);abort();
#define MERROR(CODE,MESSAGE) { \ #define MERROR(CODE, MESSAGE) \
errMsg = TMALLOC(char, strlen(MESSAGE) + 1); \ do { \
strcpy(errMsg, (MESSAGE)); \ errMsg = TMALLOC(char, strlen(MESSAGE) + 1); \
return (CODE); \ strcpy(errMsg, (MESSAGE)); \
} return (CODE); \
} while(0)
#define NEW(TYPE) (TMALLOC(TYPE, 1)) #define NEW(TYPE) (TMALLOC(TYPE, 1))
#define NEWN(TYPE,COUNT) (TMALLOC(TYPE, COUNT)) #define NEWN(TYPE,COUNT) (TMALLOC(TYPE, COUNT))

View File

@ -94,7 +94,7 @@ PZinit(CKTcircuit *ckt)
i = CKTtypelook("LTRA"); i = CKTtypelook("LTRA");
} }
if (i != -1 && ckt->CKThead[i] != NULL) if (i != -1 && ckt->CKThead[i] != NULL)
MERROR(E_XMISSIONLINE, "Transmission lines not supported") MERROR(E_XMISSIONLINE, "Transmission lines not supported");
job->PZpoleList = NULL; job->PZpoleList = NULL;
job->PZzeroList = NULL; job->PZzeroList = NULL;
@ -102,19 +102,19 @@ PZinit(CKTcircuit *ckt)
job->PZnZeros = 0; job->PZnZeros = 0;
if (job->PZin_pos == job->PZin_neg) if (job->PZin_pos == job->PZin_neg)
MERROR(E_SHORT, "Input is shorted") MERROR(E_SHORT, "Input is shorted");
if (job->PZout_pos == job->PZout_neg) if (job->PZout_pos == job->PZout_neg)
MERROR(E_SHORT, "Output is shorted") MERROR(E_SHORT, "Output is shorted");
if (job->PZin_pos == job->PZout_pos if (job->PZin_pos == job->PZout_pos
&& job->PZin_neg == job->PZout_neg && job->PZin_neg == job->PZout_neg
&& job->PZinput_type == PZ_IN_VOL) && job->PZinput_type == PZ_IN_VOL)
MERROR(E_INISOUT, "Transfer function is unity") MERROR(E_INISOUT, "Transfer function is unity");
else if (job->PZin_pos == job->PZout_neg else if (job->PZin_pos == job->PZout_neg
&& job->PZin_neg == job->PZout_pos && job->PZin_neg == job->PZout_pos
&& job->PZinput_type == PZ_IN_VOL) && job->PZinput_type == PZ_IN_VOL)
MERROR(E_INISOUT, "Transfer function is -1") MERROR(E_INISOUT, "Transfer function is -1");
return(OK); return(OK);
} }