* <http://www.OpenLDAP.org/license.html>.
*/
+#include <limits.h>
#include <string.h>
#include <sys/types.h>
#include <assert.h>
*/
#define CMP(x,y) ( (x) < (y) ? -1 : (x) > (y) )
-#if 0
+#if 0 /* superseded by append/sort */
static unsigned mdb_midl_search( IDL ids, ID id )
{
/*
int mdb_midl_append( IDL ids, ID id )
{
/* Too big? */
- if (ids[0] >= MDB_IDL_UM_SIZE)
+ if (ids[0] >= MDB_IDL_UM_MAX)
return -1;
ids[0]++;
ids[ids[0]] = id;
/* Quicksort + Insertion sort for small arrays */
#define SMALL 8
-#define SWAP(a,b) itmp=(a);(a)=(b);(b)=itmp
+#define SWAP(a,b) { itmp=(a); (a)=(b); (b)=itmp; }
void
mdb_midl_sort( ID *ids )
{
- int istack[16*sizeof(int)];
+ /* Max possible depth of int-indexed tree * 2 items/level */
+ int istack[sizeof(int)*CHAR_BIT * 2];
int i,j,k,l,ir,jstack;
ID a, itmp;
return -1;
}
- if ( ids[0].mid >= MDB_IDL_DB_MAX ) {
+ if ( ids[0].mid >= MDB_IDL_UM_MAX ) {
/* too big */
return -2;