From d3c026f08f629659b5efe23fe8bffd3cf9b845f6 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Thu, 2 Sep 1999 12:35:02 +0000 Subject: Redo memory allocation to use mknew macro [originally from svn r214] --- buttress.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'buttress.h') diff --git a/buttress.h b/buttress.h index aec26d0..673af56 100644 --- a/buttress.h +++ b/buttress.h @@ -16,8 +16,6 @@ #define FALSE 0 #endif -#define lenof(x) ( sizeof((x)) / sizeof(*(x)) ) - /* * Structure tags */ @@ -161,6 +159,11 @@ void free_word_list(word *w); void free_para_list(paragraph *p); word *dup_word_list(word *w); +#define mknew(type) ( (type *) smalloc (sizeof (type)) ) +#define mknewa(type, number) ( (type *) smalloc ((number) * sizeof (type)) ) +#define resize(array, len) ( srealloc ((array), (len) * sizeof (*(array))) ) +#define lenof(array) ( sizeof(array) / sizeof(*(array)) ) + /* * ustring.c */ -- cgit v1.1