Index: trunk/src_plugins/fp_fs/fp_fs.c =================================================================== --- trunk/src_plugins/fp_fs/fp_fs.c (revision 30786) +++ trunk/src_plugins/fp_fs/fp_fs.c (revision 30787) @@ -372,10 +372,10 @@ ST_ELEMENT, ST_TAG } state = ST_WS; - char *tag = NULL; - int talloced = 0, tused = 0; + gds_t tag; int Talloced = 0, Tused = 0; + gds_init(&tag); head->type = PCB_FP_INVALID; while ((c = fgetc(f)) != EOF) { switch (state) { @@ -449,35 +449,28 @@ break; case ST_TAG: if ((c == '\r') || (c == '\n')) { /* end of a tag */ - if (need_tags && (tag != NULL)) { - tag[tused] = '\0'; + if (need_tags && (tag.used != 0)) { if (Tused >= Talloced) { Talloced += 8; head->tags = realloc(head->tags, (Talloced + 1) * sizeof(void *)); } - head->tags[Tused] = (void *) pcb_fp_tag(tag, 1); + head->tags[Tused] = (void *) pcb_fp_tag(tag.array, 1); Tused++; head->tags[Tused] = NULL; } - tused = 0; + tag.used = 0; state = ST_WS; break; } if (c == '@') goto maybe_purpose; - if (tused >= talloced) { - talloced += 64; - tag = realloc(tag, talloced + 1); /* always make room for an extra \0 */ - } - tag[tused] = c; - tused++; + gds_append(&tag, c); } } out:; - if (tag != NULL) - free(tag); + gds_uninit(&tag); return head; }