X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=sbr%2Ffmt_compile.c;h=a180c561a403f0280d8b7eb8492912c10afdf32b;hb=f6aa95b724fd8c791164abe7ee5468bf5c34f226;hp=c42f1e3899807a61ce742414a5f74b4baf77950d;hpb=4f653e8f897068fc803607a5975fa18ab1519bcf;p=mmh diff --git a/sbr/fmt_compile.c b/sbr/fmt_compile.c index c42f1e3..a180c56 100644 --- a/sbr/fmt_compile.c +++ b/sbr/fmt_compile.c @@ -2,8 +2,6 @@ /* * fmt_compile.c -- "compile" format strings for fmt_scan * - * $Id$ - * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for * complete copyright information. @@ -158,32 +156,35 @@ static struct ftable functable[] = { }; /* Add new component to the hash table */ -#define NEWCOMP(cm,name)\ +#define NEWCOMP(cm,name) do { \ cm = ((struct comp *) calloc(1, sizeof (struct comp)));\ cm->c_name = name;\ ncomp++;\ i = CHASH(name);\ cm->c_next = wantcomp[i];\ - wantcomp[i] = cm; + wantcomp[i] = cm; \ + } while (0) #define NEWFMT (next_fp++) -#define NEW(type,fill,wid)\ - fp=NEWFMT; fp->f_type=(type); fp->f_fill=(fill); fp->f_width=(wid); +#define NEW(type,fill,wid) do {\ + fp=NEWFMT; fp->f_type=(type); fp->f_fill=(fill); fp->f_width=(wid); \ + } while (0) /* Add (possibly new) component to the hash table */ -#define ADDC(name)\ +#define ADDC(name) do { \ FINDCOMP(cm, name);\ if (!cm) {\ NEWCOMP(cm,name);\ }\ - fp->f_comp = cm; + fp->f_comp = cm; \ + } while (0) -#define LV(type, value) NEW(type,0,0); fp->f_value = (value); -#define LS(type, str) NEW(type,0,0); fp->f_text = (str); +#define LV(type, value) do { NEW(type,0,0); fp->f_value = (value); } while (0) +#define LS(type, str) do { NEW(type,0,0); fp->f_text = (str); } while (0) -#define PUTCOMP(comp) NEW(FT_COMP,0,0); ADDC(comp); -#define PUTLIT(str) NEW(FT_LIT,0,0); fp->f_text = (str); -#define PUTC(c) NEW(FT_CHAR,0,0); fp->f_char = (c); +#define PUTCOMP(comp) do { NEW(FT_COMP,0,0); ADDC(comp); } while (0) +#define PUTLIT(str) do { NEW(FT_LIT,0,0); fp->f_text = (str); } while (0) +#define PUTC(c) do { NEW(FT_CHAR,0,0); fp->f_char = (c); } while (0) static char *format_string; static unsigned char *usr_fstring; /* for CERROR */