void rpmhookRegister(const char *name, rpmhookFunc func, void *data) /*@globals globalTable @*/ /*@modifies globalTable @*/ { if (globalTable == NULL) globalTable = rpmhookTableNew(RPMHOOK_TABLE_INITSIZE); rpmhookTableAddItem(&globalTable, name, func, data); }
static void rpmhookTableRehash(rpmhookTable *table) { rpmhookTable newtable = rpmhookTableNew((*table)->size*2); int n, i = 0; for (; i != (*table)->size; i++) { if ((*table)->bucket[i].name == NULL) continue; n = rpmhookTableFindBucket(&newtable, (*table)->bucket[i].name); newtable->bucket[n].name = (*table)->bucket[i].name; newtable->bucket[n].item = (*table)->bucket[i].item; } newtable->used = (*table)->used; free(*table); *table = newtable; }
static void rpmhookTableRehash(rpmhookTable *table) /*@modifies *table @*/ { rpmhookTable newtable = rpmhookTableNew((*table)->size*2); int n, i = 0; for (; i != (*table)->size; i++) { if ((*table)->bucket[i].name == NULL) continue; n = rpmhookTableFindBucket(&newtable, (*table)->bucket[i].name); newtable->bucket[n].name = (*table)->bucket[i].name; newtable->bucket[n].item = (*table)->bucket[i].item; } newtable->used = (*table)->used; /*@-unqualifiedtrans@*/ free(*table); /*@=unqualifiedtrans@*/ *table = newtable; }