rendered paste bodyvoid htable_rehash_term(htable_t* hash){ int size,i; value_t* new; size = hash->buckets*2; htable_t* newTable = new_htable(size); for(i=0;i<hash->buckets; i++){ if(hash->array[i] != NULL){ htable_add_term(newTable, hash->array[i]); } } free(hash->array); hash->array = newTable->array; hash->buckets=size; hash->size= sizeof(htable_t*)+ (sizeof(value_t*) * hash->buckets);}value_t** remap_freq_htable(htable_t* htable){ insertion_sort(htable->array, htable->buckets, nullcntcmp ); int i = 0; for (i=0; i<htable->buckets; i++) { if (htable->array[i] != NULL) { htable->array[i]->id = i; } } value_t** limitedArray = (value_t**) safe_malloc(htable->items * sizeof(value_t**) ); i = 0; while ( htable->array[i] != NULL ) { limitedArray[i] = htable->array[i]; i++; } htable->buckets = htable->items; return limitedArray;}