for (i=0; i<lh->num_nodes; i++) { for (n=lh->b[i],num=0; n != NULL; n=n->next) num++; if (num != 0) { n_used++; total+=num; } } fprintf(out,"%lu nodes used out of %u\n",n_used,lh->num_nodes); fprintf(out,"%lu items\n",total); if (n_used == 0) return; fprintf(out,"load %d.%02d  actual load %d.%02d\n", (int)(total/lh->num_nodes), (int)((total%lh->num_nodes)*100/lh->num_nodes), (int)(total/n_used), (int)((total%n_used)*100/n_used));
bp=BIO_new(BIO_s_file()); if (bp == NULL) goto end; BIO_set_fp(bp,fp,BIO_NOCLOSE); lh_node_usage_stats_bio(lh,bp); BIO_free(bp); end:;
void lh_node_usage_stats(LHASH *lh, FILE *out)	{	LHASH_NODE *n;	unsigned long num;	unsigned int i;	unsigned long total=0,n_used=0;	for (i=0; i<lh->num_nodes; i++)		{		for (n=lh->b[i],num=0; n != NULL; n=n->next)			num++;		if (num != 0)			{			n_used++;			total+=num;			}		}	fprintf(out,"%lu nodes used out of %u\n",n_used,lh->num_nodes);	fprintf(out,"%lu items\n",total);	if (n_used == 0) return;	fprintf(out,"load %d.%02d  actual load %d.%02d\n",		(int)(total/lh->num_nodes),		(int)((total%lh->num_nodes)*100/lh->num_nodes),		(int)(total/n_used),		(int)((total%n_used)*100/n_used));	}