NAME
NGC - (MACRO) Jump to "cleanup" label if argument equals NULL
SYNOPSIS
#include "l/l_error.h"
Example compile flags (system dependent):
-DLINUX_X86_64 -DLINUX_X86_64_OPTERON -DGNU_COMPILER
-I/home/kobus/include
-L/home/kobus/misc/load/linux_x86_64_opteron -L/usr/lib/x86_64-linux-gnu
-lKJB -lfftw3 -lgsl -lgslcblas -ljpeg -lSVM -lstdc++ -lpthread -lSLATEC -lg2c -lacml -lacml_mv -lblas -lg2c -lncursesw
void NGC(void *);
DESCRIPTION
This macro tests whether its argument equals NULL, and if so it performs a
goto to the label "cleanup," similarly to macro EGC.
See the docs of EGC for more discussion on how to use a cleanup clause.
Example usage:
int some_function()
{
int result = ERROR;
struct Widget *p, *q, *r;
p = q = r = NULL;
NGC(p = N_TYPE_MALLOC(struct Widget, 10));
NGC(q = N_TYPE_MALLOC(struct Widget, 10));
NGC(r = N_TYPE_MALLOC(struct Widget, 10));
(* . . . work with those arrays . . . *)
result = NO_ERROR;
cleanup:
kjb_free(r);
kjb_free(q);
kjb_free(p);
return result;
}
Further, if the debug level is greater than 0, then a message is added to
the list of messages using add_errror().
DISCLAIMER
This software is not adequatedly tested. It is recomended that
results are checked independantly where appropriate.
AUTHOR
Andrew Predoehl
DOCUMENTER
Andrew Predoehl
SEE ALSO
NOTE_ERROR
,
EGC
,
ERE
,
ERN
,
ER
,
EPE
,
ETE
,
EPETE
,
EPETE
,
ESBRE
,
BATCH_EPETE
,
NRE
,
NRN
,
NR
,
NPE
,
NTE
,
NPETE
,
NPETE