Skip to content
Snippets Groups Projects
Commit 6ae7fadb authored by rswindell's avatar rswindell
Browse files

Updated FREE_AR macro: now nulls variable and works with .cpp files.

parent db57ad61
No related branches found
No related tags found
No related merge requests found
...@@ -47,16 +47,17 @@ ...@@ -47,16 +47,17 @@
memset(var,0,sizeof(var)); \ memset(var,0,sizeof(var)); \
offset+=sizeof(var); } offset+=sizeof(var); }
#ifdef __cplusplus
extern "C" {
#endif
extern const char* scfgnulstr; extern const char* scfgnulstr;
extern const uchar* nular; extern const uchar* nular;
#define FREE_AND_NULL(x) if(x!=NULL) { FREE(x); x=NULL; } #define FREE_AND_NULL(x) if(x!=NULL) { FREE(x); x=NULL; }
#ifdef SCFG /* allocated with arstr() */
#define FREE_AR(x) /* static */ #define FREE_AR(x) if(x!=NULL && x!=nular) { FREE(x); x=NULL; }
#else
#define FREE_AR(x) if(x!=NULL && x!=nular) { FREE(x); } /* allocated with arstr() */
#endif
typedef struct { typedef struct {
char *openerr, char *openerr,
...@@ -66,10 +67,6 @@ typedef struct { ...@@ -66,10 +67,6 @@ typedef struct {
*error; *error;
} read_cfg_text_t; } read_cfg_text_t;
#ifdef __cplusplus
extern "C" {
#endif
char* get_alloc(long *offset, char *outstr, int maxlen, FILE *instream); char* get_alloc(long *offset, char *outstr, int maxlen, FILE *instream);
BOOL allocerr(read_cfg_text_t* txt, long offset, char *fname, uint size); BOOL allocerr(read_cfg_text_t* txt, long offset, char *fname, uint size);
char* readline(long *offset, char *str, int maxlen, FILE *stream); char* readline(long *offset, char *str, int maxlen, FILE *stream);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment