+ if (image_n + 1 >= image_alloc)
+ {
+ struct _imagedata *tmp =
+ (struct _imagedata *) malloc(sizeof(struct _imagedata) * (image_alloc + IMAGE_REALLOC));
+ if (!tmp)
+ {
+ printf("malloc error\n");
+ exit(1);
+ }
+ if (imagedata)
+ {
+ (void) memcpy(tmp, imagedata, sizeof(struct _imagedata) * image_alloc);
+ free(imagedata);
+ }
+ imagedata = tmp;
+ image_alloc += IMAGE_REALLOC;
+ }
+
+ imagedata[image_n].s = (char *) calloc(strlen(name) + 1, 1);
+ imagedata[image_n].w = *w;
+ imagedata[image_n].h = *h;
+ strcpy(imagedata[image_n].s, name);
+