diff --git a/src/include/ngspice/macros.h b/src/include/ngspice/macros.h index 284edab31..c485517cf 100644 --- a/src/include/ngspice/macros.h +++ b/src/include/ngspice/macros.h @@ -43,11 +43,12 @@ #define NIL(type) ((type *)0) #define ABORT() fflush(stderr);fflush(stdout);abort(); -#define MERROR(CODE,MESSAGE) { \ - errMsg = TMALLOC(char, strlen(MESSAGE) + 1); \ - strcpy(errMsg, (MESSAGE)); \ - return (CODE); \ - } +#define MERROR(CODE, MESSAGE) \ + do { \ + errMsg = TMALLOC(char, strlen(MESSAGE) + 1); \ + strcpy(errMsg, (MESSAGE)); \ + return (CODE); \ + } while(0) #define NEW(TYPE) (TMALLOC(TYPE, 1)) #define NEWN(TYPE,COUNT) (TMALLOC(TYPE, COUNT)) diff --git a/src/spicelib/analysis/pzan.c b/src/spicelib/analysis/pzan.c index 6117f67df..0e1655d09 100644 --- a/src/spicelib/analysis/pzan.c +++ b/src/spicelib/analysis/pzan.c @@ -94,7 +94,7 @@ PZinit(CKTcircuit *ckt) i = CKTtypelook("LTRA"); } 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->PZzeroList = NULL; @@ -102,19 +102,19 @@ PZinit(CKTcircuit *ckt) job->PZnZeros = 0; 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) - MERROR(E_SHORT, "Output is shorted") + MERROR(E_SHORT, "Output is shorted"); if (job->PZin_pos == job->PZout_pos && job->PZin_neg == job->PZout_neg && 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 && job->PZin_neg == job->PZout_pos && job->PZinput_type == PZ_IN_VOL) - MERROR(E_INISOUT, "Transfer function is -1") + MERROR(E_INISOUT, "Transfer function is -1"); return(OK); }