static void fixture_free(void) { ptab_free(p); }
void attr_read_all(PENNFILE *f) { ATTR *a; int c, found, count = 0; char alias[BUFFER_LEN]; /* Clear existing attributes */ ptab_free(&ptab_attrib); ptab_start_inserts(&ptab_attrib); db_read_this_labeled_int(f, "attrcount", &count); for (found = 0;;) { c = penn_fgetc(f); penn_ungetc(c, f); if (c != ' ') break; found++; if ((a = attr_read(f))) ptab_insert(&ptab_attrib, a->name, a); } ptab_end_inserts(&ptab_attrib); if (found != count) do_rawlog(LT_ERR, "WARNING: Actual number of attrs (%d) different than expected count (%d).", found, count); /* Assumes we'll always have at least one alias */ db_read_this_labeled_int(f, "attraliascount", &count); for (found = 0;;) { c = penn_fgetc(f); penn_ungetc(c, f); if (c != ' ') break; found++; if ((a = attr_alias_read(f, alias))) { upcasestr(alias); if (!good_atr_name(alias)) { do_rawlog(LT_ERR, "Bad attribute name on alias '%s' in db.", alias); } else if (aname_find_exact(strupper(alias))) { do_rawlog(LT_ERR, "Unable to alias attribute '%s' to '%s' in db: alias already in use.", AL_NAME(a), alias); } else if (!alias_attribute(AL_NAME(a), alias)) { do_rawlog(LT_ERR, "Unable to alias attribute '%s' to '%s' in db.", AL_NAME(a), alias); } } } if (found != count) do_rawlog(LT_ERR, "WARNING: Actual number of attr aliases (%d) different than expected count (%d).", found, count); return; }