Back to index

openldap  2.4.31
Functions
nextid.c File Reference
#include "portable.h"
#include <stdio.h>
#include <ac/string.h>
#include "back-mdb.h"

Go to the source code of this file.

Functions

int mdb_next_id (BackendDB *be, MDB_cursor *mc, ID *out)

Function Documentation

int mdb_next_id ( BackendDB be,
MDB_cursor mc,
ID out 
)

Definition at line 24 of file nextid.c.

{
       int rc;
       ID id = 0;
       MDB_val key;

       rc = mdb_cursor_get(mc, &key, NULL, MDB_LAST);

       switch(rc) {
       case MDB_NOTFOUND:
              rc = 0;
              *out = 1;
              break;
       case 0:
              memcpy( &id, key.mv_data, sizeof( id ));
              *out = ++id;
              break;

       default:
              Debug( LDAP_DEBUG_ANY,
                     "=> mdb_next_id: get failed: %s (%d)\n",
                     mdb_strerror(rc), rc, 0 );
              goto done;
       }

done:
       return rc;
}

Here is the call graph for this function:

Here is the caller graph for this function: