#include "slap.h"
#include "back-ldbm.h"
-extern char *first_word();
-extern char *next_word();
-extern char *phonetic();
-extern IDList *idl_fetch();
-extern IDList *idl_allids();
-extern struct dbcache *ldbm_cache_open();
-
-int index_add_values();
-
-static int add_value();
-static int index2prefix();
+static int add_value(Backend *be, struct dbcache *db, char *type, int indextype, char *val, ID id);
+static int index2prefix(int indextype);
int
index_add_entry(
* with index_add_values() call
*/
- bv.bv_val = strdup( e->e_dn );
+ bv.bv_val = ch_strdup( e->e_dn );
bv.bv_len = strlen( bv.bv_val );
(void) dn_normalize_case( bv.bv_val );
bvals[0] = &bv;
char *realval, *tmpval;
char buf[BUFSIZ];
-#ifdef HAVE_BERKELEY_DB2
- memset( &key, 0, sizeof( key ) );
-#endif
+ ldbm_datum_init( key );
prefix = index2prefix( indextype );
Debug( LDAP_DEBUG_TRACE, "=> index_read( \"%s\" \"%c\" \"%s\" )\n",
if ( ! (indextype & indexmask) ) {
idl = idl_allids( be );
Debug( LDAP_DEBUG_TRACE,
- "<= index_read %d candidates (allids - not indexed)\n",
+ "<= index_read %lu candidates (allids - not indexed)\n",
idl ? idl->b_nids : 0, 0, 0 );
return( idl );
}
realval = val;
tmpval = NULL;
- if ( prefix != '\0' ) {
+ if ( prefix != UNKNOWN_PREFIX ) {
unsigned int len = strlen( val );
if ( (len + 2) < sizeof(buf) ) {
ldbm_cache_close( be, db );
- Debug( LDAP_DEBUG_TRACE, "<= index_read %d candidates\n",
+ Debug( LDAP_DEBUG_TRACE, "<= index_read %lu candidates\n",
idl ? idl->b_nids : 0, 0, 0 );
return( idl );
}
char *realval, *tmpval, *s;
char buf[BUFSIZ];
-#ifdef HAVE_BERKELEY_DB2
- memset( &key, 0, sizeof( key ) );
-#endif
+ ldbm_datum_init( key );
prefix = index2prefix( indextype );
Debug( LDAP_DEBUG_TRACE, "=> add_value( \"%c%s\" )\n", prefix, val, 0 );
realval = val;
tmpval = NULL;
idl = NULL;
- if ( prefix != '\0' ) {
+ if ( prefix != UNKNOWN_PREFIX ) {
unsigned int len = strlen( val );
if ( (len + 2) < sizeof(buf) ) {
)
{
char *val, *p, *code, *w;
- int i, j, len;
+ unsigned i, j, len;
int indexmask, syntax;
char buf[SUBLEN + 1];
char vbuf[BUFSIZ];
prefix = SUB_PREFIX;
break;
default:
- prefix = '\0';
+ prefix = UNKNOWN_PREFIX;
break;
}