misc cleanup

This commit is contained in:
Jong Hyuk Choi 2003-09-04 19:48:53 +00:00
parent 7357caac90
commit c25a892e62
3 changed files with 11 additions and 57 deletions

View File

@ -157,31 +157,21 @@ slap_create_context_csn_entry(
ber_str2bv( "subentry", strlen("subentry"), 1, &ocbva[1] ); ber_str2bv( "subentry", strlen("subentry"), 1, &ocbva[1] );
ber_str2bv( "syncProviderSubentry", ber_str2bv( "syncProviderSubentry",
strlen("syncProviderSubentry"), 1, &ocbva[2] ); strlen("syncProviderSubentry"), 1, &ocbva[2] );
ocbva[3].bv_len = 0;
ocbva[3].bv_val = NULL;
mod = (Modifications *) ch_malloc( sizeof( Modifications )); mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ));
mod->sml_op = LDAP_MOD_REPLACE; mod->sml_op = LDAP_MOD_REPLACE;
mod->sml_next = NULL;
mod->sml_desc = NULL;
ber_str2bv( "objectClass", strlen("objectClass"), 1, &mod->sml_type ); ber_str2bv( "objectClass", strlen("objectClass"), 1, &mod->sml_type );
mod->sml_bvalues = ocbva; mod->sml_bvalues = ocbva;
mod->sml_nvalues = NULL;
*modtail = mod; *modtail = mod;
modtail = &mod->sml_next; modtail = &mod->sml_next;
ber_str2bv( "syncProviderSubentry", ber_str2bv( "syncProviderSubentry",
strlen("syncProviderSubentry"), 1, &socbva[0] ); strlen("syncProviderSubentry"), 1, &socbva[0] );
socbva[1].bv_len = 0;
socbva[1].bv_val = NULL;
mod = (Modifications *) ch_malloc( sizeof( Modifications )); mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ));
mod->sml_op = LDAP_MOD_REPLACE; mod->sml_op = LDAP_MOD_REPLACE;
mod->sml_next = NULL;
mod->sml_desc = NULL;
ber_str2bv( "structuralObjectClass", strlen("structuralObjectClass"), 1, &mod->sml_type ); ber_str2bv( "structuralObjectClass", strlen("structuralObjectClass"), 1, &mod->sml_type );
mod->sml_bvalues = socbva; mod->sml_bvalues = socbva;
mod->sml_nvalues = NULL;
*modtail = mod; *modtail = mod;
modtail = &mod->sml_next; modtail = &mod->sml_next;
@ -189,44 +179,29 @@ slap_create_context_csn_entry(
sprintf( rdnstr, "cn=%s", substr ); sprintf( rdnstr, "cn=%s", substr );
ber_str2bv( substr, strlen( substr ), 1, &cnbva[0] ); ber_str2bv( substr, strlen( substr ), 1, &cnbva[0] );
ber_str2bv( rdnstr, strlen( rdnstr ), 1, &psubrdn ); ber_str2bv( rdnstr, strlen( rdnstr ), 1, &psubrdn );
cnbva[1].bv_len = 0; mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ));
cnbva[1].bv_val = NULL;
mod = (Modifications *) ch_malloc( sizeof( Modifications ));
mod->sml_op = LDAP_MOD_REPLACE; mod->sml_op = LDAP_MOD_REPLACE;
mod->sml_next = NULL;
mod->sml_desc = NULL;
ber_str2bv( "cn", strlen("cn"), 1, &mod->sml_type ); ber_str2bv( "cn", strlen("cn"), 1, &mod->sml_type );
mod->sml_bvalues = cnbva; mod->sml_bvalues = cnbva;
mod->sml_nvalues = NULL;
*modtail = mod; *modtail = mod;
modtail = &mod->sml_next; modtail = &mod->sml_next;
if ( context_csn ) { if ( context_csn ) {
ber_dupbv( &scbva[0], context_csn ); ber_dupbv( &scbva[0], context_csn );
scbva[1].bv_len = 0; mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ));
scbva[1].bv_val = NULL;
mod = (Modifications *) ch_malloc( sizeof( Modifications ));
mod->sml_op = LDAP_MOD_REPLACE; mod->sml_op = LDAP_MOD_REPLACE;
mod->sml_next = NULL;
mod->sml_desc = NULL;
ber_str2bv( "contextCSN", strlen("contextCSN"), 1, &mod->sml_type ); ber_str2bv( "contextCSN", strlen("contextCSN"), 1, &mod->sml_type );
mod->sml_bvalues = scbva; mod->sml_bvalues = scbva;
mod->sml_nvalues = NULL;
*modtail = mod; *modtail = mod;
modtail = &mod->sml_next; modtail = &mod->sml_next;
} }
ber_str2bv( "{}", strlen("{}"), 1, &ssbva[0] ); ber_str2bv( "{}", strlen("{}"), 1, &ssbva[0] );
ssbva[1].bv_len = 0; mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ));
ssbva[1].bv_val = NULL;
mod = (Modifications *) ch_malloc( sizeof( Modifications ));
mod->sml_op = LDAP_MOD_REPLACE; mod->sml_op = LDAP_MOD_REPLACE;
mod->sml_next = NULL;
mod->sml_desc = NULL;
ber_str2bv( "subtreeSpecification", ber_str2bv( "subtreeSpecification",
strlen("subtreeSpecification"), 1, &mod->sml_type ); strlen("subtreeSpecification"), 1, &mod->sml_type );
mod->sml_bvalues = ssbva; mod->sml_bvalues = ssbva;
mod->sml_nvalues = NULL;
*modtail = mod; *modtail = mod;
modtail = &mod->sml_next; modtail = &mod->sml_next;
@ -288,7 +263,7 @@ slap_contextcsn_callback(
int int
slap_get_csn( slap_get_csn(
Operation *op, Operation *op,
const char *csnbuf, char *csnbuf,
int len, int len,
struct berval *csn, struct berval *csn,
int manage_ctxcsn int manage_ctxcsn

View File

@ -362,7 +362,7 @@ LDAP_SLAPD_F (struct berval *) slap_get_commit_csn LDAP_P(( Operation * ));
LDAP_SLAPD_F (void) slap_rewind_commit_csn LDAP_P(( Operation * )); LDAP_SLAPD_F (void) slap_rewind_commit_csn LDAP_P(( Operation * ));
LDAP_SLAPD_F (void) slap_graduate_commit_csn LDAP_P(( Operation * )); LDAP_SLAPD_F (void) slap_graduate_commit_csn LDAP_P(( Operation * ));
LDAP_SLAPD_F (Entry *) slap_create_context_csn_entry LDAP_P(( Backend *, struct berval *)); LDAP_SLAPD_F (Entry *) slap_create_context_csn_entry LDAP_P(( Backend *, struct berval *));
LDAP_SLAPD_F (int) slap_get_csn LDAP_P(( Operation *, const char *, int, struct berval *, int )); LDAP_SLAPD_F (int) slap_get_csn LDAP_P(( Operation *, char *, int, struct berval *, int ));
/* /*
* daemon.c * daemon.c

View File

@ -1297,16 +1297,10 @@ syncrepl_updateCookie(
ber_str2bv( "subentry", strlen("subentry"), 1, &ocbva[1] ); ber_str2bv( "subentry", strlen("subentry"), 1, &ocbva[1] );
ber_str2bv( "syncConsumerSubentry", ber_str2bv( "syncConsumerSubentry",
strlen("syncConsumerSubentry"), 1, &ocbva[2] ); strlen("syncConsumerSubentry"), 1, &ocbva[2] );
ocbva[3].bv_len = 0; mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ));
ocbva[3].bv_val = NULL;
mod = (Modifications *) ch_malloc( sizeof( Modifications ));
mod->sml_op = LDAP_MOD_REPLACE; mod->sml_op = LDAP_MOD_REPLACE;
mod->sml_next = NULL;
mod->sml_desc = NULL;
ber_str2bv( "objectClass", strlen("objectClass"), 1, &mod->sml_type ); ber_str2bv( "objectClass", strlen("objectClass"), 1, &mod->sml_type );
mod->sml_bvalues = ocbva; mod->sml_bvalues = ocbva;
mod->sml_nvalues = NULL;
*modtail = mod; *modtail = mod;
modtail = &mod->sml_next; modtail = &mod->sml_next;
@ -1314,43 +1308,28 @@ syncrepl_updateCookie(
sprintf( rdnstr, "cn=%s", substr ); sprintf( rdnstr, "cn=%s", substr );
ber_str2bv( substr, strlen( substr ), 1, &cnbva[0] ); ber_str2bv( substr, strlen( substr ), 1, &cnbva[0] );
ber_str2bv( rdnstr, strlen( rdnstr ), 1, &psubrdn ); ber_str2bv( rdnstr, strlen( rdnstr ), 1, &psubrdn );
cnbva[1].bv_len = 0; mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ));
cnbva[1].bv_val = NULL;
mod = (Modifications *) ch_malloc( sizeof( Modifications ));
mod->sml_op = LDAP_MOD_REPLACE; mod->sml_op = LDAP_MOD_REPLACE;
mod->sml_next = NULL;
mod->sml_desc = NULL;
ber_str2bv( "cn", strlen("cn"), 1, &mod->sml_type ); ber_str2bv( "cn", strlen("cn"), 1, &mod->sml_type );
mod->sml_bvalues = cnbva; mod->sml_bvalues = cnbva;
mod->sml_nvalues = NULL;
*modtail = mod; *modtail = mod;
modtail = &mod->sml_next; modtail = &mod->sml_next;
ber_dupbv( &scbva[0], si->syncCookie ); ber_dupbv( &scbva[0], si->syncCookie );
scbva[1].bv_len = 0; mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ));
scbva[1].bv_val = NULL;
mod = (Modifications *) ch_malloc( sizeof( Modifications ));
mod->sml_op = LDAP_MOD_REPLACE; mod->sml_op = LDAP_MOD_REPLACE;
mod->sml_next = NULL;
mod->sml_desc = NULL;
ber_str2bv( "syncreplCookie", strlen("syncreplCookie"), ber_str2bv( "syncreplCookie", strlen("syncreplCookie"),
1, &mod->sml_type ); 1, &mod->sml_type );
mod->sml_bvalues = scbva; mod->sml_bvalues = scbva;
mod->sml_nvalues = NULL;
*modtail = mod; *modtail = mod;
modtail = &mod->sml_next; modtail = &mod->sml_next;
ber_str2bv( "{}", strlen("{}"), 1, &ssbva[0] ); ber_str2bv( "{}", strlen("{}"), 1, &ssbva[0] );
ssbva[1].bv_len = 0; mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ));
ssbva[1].bv_val = NULL;
mod = (Modifications *) ch_malloc( sizeof( Modifications ));
mod->sml_op = LDAP_MOD_REPLACE; mod->sml_op = LDAP_MOD_REPLACE;
mod->sml_next = NULL;
mod->sml_desc = NULL;
ber_str2bv( "subtreeSpecification", ber_str2bv( "subtreeSpecification",
strlen("subtreeSpecification"), 1, &mod->sml_type ); strlen("subtreeSpecification"), 1, &mod->sml_type );
mod->sml_bvalues = ssbva; mod->sml_bvalues = ssbva;
mod->sml_nvalues = NULL;
*modtail = mod; *modtail = mod;
modtail = &mod->sml_next; modtail = &mod->sml_next;