From 695830ad5d643e33c374e032f1d212bd91b4cb2c Mon Sep 17 00:00:00 2001 From: Albert Cahalan Date: Thu, 20 Jan 2005 03:55:57 +0000 Subject: [PATCH] MAX_FONTS gone -- all dynamic --- src/tuxpaint.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/tuxpaint.c b/src/tuxpaint.c index ab8ca819b..c3b7b4194 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -2069,9 +2069,9 @@ typedef struct stamp_type { unsigned max : 5; } stamp_type; -#define MAX_STAMPS 512 static int num_stamps; -static stamp_type * stamp_data[MAX_STAMPS]; +static int max_stamps; +static stamp_type **stamp_data; /* Returns whether a particular stamp can be colored: */ static int stamp_colorable(int stamp) @@ -6807,6 +6807,11 @@ static void loadstamp_callback(const char *restrict const dir, unsigned dirlen, { char fname[512]; snprintf(fname, sizeof fname, "%s/%s", dir, files[i].str); + if(num_stamps == max_stamps) + { + max_stamps = max_stamps * 5 / 4 + 3; + stamp_data = realloc(stamp_data, max_stamps * sizeof *stamp_data); + } stamp_data[num_stamps] = calloc(1, sizeof *stamp_data[num_stamps]); stamp_data[num_stamps]->stxt = loaddesc(fname); loadinfo(fname, stamp_data[num_stamps]);