struct _dtstat_s
{ int dt_meth; /* method type */
int dt_size; /* number of elements */
- int dt_n; /* number of chains or levels */
- int dt_max; /* max size of a chain or a level */
- int* dt_count; /* counts of chains or levels by size */
+ size_t dt_n; // number of chains or levels
+ size_t dt_max; // max size of a chain or a level
+ size_t* dt_count; // counts of chains or levels by size
};
/* flag set if the last search operation actually found the object */
** Written by Kiem-Phong Vo (5/25/96)
*/
-static void dttstat(Dtstat_t* ds, Dtlink_t* root, int depth, int* level)
-{
+static void dttstat(Dtstat_t *ds, Dtlink_t *root, size_t depth, size_t *level) {
if(root->left)
dttstat(ds,root->left,depth+1,level);
if(root->right)
level[depth] += 1;
}
-static void dthstat(Dtdata_t* data, Dtstat_t* ds, int* count)
-{
+static void dthstat(Dtdata_t *data, Dtstat_t *ds, size_t *count) {
Dtlink_t* t;
- int n, h;
+ int h;
for(h = data->ntab-1; h >= 0; --h)
- { n = 0;
+ { size_t n = 0;
for(t = data->htab[h]; t; t = t->right)
n += 1;
if(count)
int dtstat(Dt_t* dt, Dtstat_t* ds, int all)
{
- int i;
- static int *Count, Size;
+ static size_t *Count;
+ static size_t Size;
UNFLATTEN(dt);
return -1;
Size = ds->dt_max+1;
}
- for(i = ds->dt_max; i >= 0; --i)
+ for (size_t i = 0; i <= ds->dt_max; ++i)
Count[i] = 0;
dthstat(dt->data,ds,Count);
}
Size = ds->dt_n+1;
}
- for(i = ds->dt_n; i >= 0; --i)
+ for (size_t i = 0; i <= ds->dt_n; ++i)
Count[i] = 0;
dttstat(ds,dt->data->here,0,Count);
- for(i = ds->dt_n; i >= 0; --i)
+ for(size_t i = 0; i <= ds->dt_n; ++i)
if(Count[i] > ds->dt_max)
ds->dt_max = Count[i];
}