X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Ffmt_compile.c;h=566f620939018eac7824fe2ae80e49a6ae5d920c;hp=9e08ab46e97a0f58359f367bb2d4c11b071ae5da;hb=e917512db8efcbf3b5b5baeb64b6d345fd3686db;hpb=5ba9c2f13fedf1d8d6ed907ef1f505616290efaa diff --git a/sbr/fmt_compile.c b/sbr/fmt_compile.c index 9e08ab4..566f620 100644 --- a/sbr/fmt_compile.c +++ b/sbr/fmt_compile.c @@ -39,6 +39,7 @@ */ #include +#include #include #include #include @@ -208,7 +209,7 @@ static struct ftable functable[] = { /* Add new component to the hash table */ #define NEWCOMP(cm,name) do { \ - cm = ((struct comp *) calloc(1, sizeof (struct comp)));\ + cm = (mh_xcalloc(1, sizeof (struct comp)));\ cm->c_name = name;\ ncomp++;\ i = CHASH(name);\ @@ -307,8 +308,8 @@ fmt_compile(char *fstring, struct format **fmt) size_t i; if (format_string) - free(format_string); - format_string = getcpy(fstring); + mh_free0(&format_string); + format_string = mh_xstrdup(fstring); usr_fstring = fstring; /* init the component hash table. */ @@ -327,8 +328,7 @@ fmt_compile(char *fstring, struct format **fmt) i = strlen(fstring)/2 + 1; if (i == 1) i++; - next_fp = formatvec = (struct format *)calloc((size_t) i, - sizeof(struct format)); + next_fp = formatvec = mh_xcalloc(i, sizeof(struct format)); if (next_fp == NULL) adios(EX_OSERR, NULL, "unable to allocate format storage"); @@ -479,8 +479,7 @@ do_name(char *sp, int preprocess) if (cm->c_type & CT_ADDR) { CERROR("component used as both date and address"); } - cm->c_tws = (struct tws *) - calloc((size_t) 1, sizeof(*cm->c_tws)); + cm->c_tws = mh_xcalloc(1, sizeof(*cm->c_tws)); fp->f_type = preprocess; PUTCOMP(sp); cm->c_type |= CT_DATE;