mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-23 16:19:35 -05:00
ITS#6758 Add rs_reinit(), rs_flush_entry()
This commit is contained in:
parent
ea2b675dca
commit
5c3f806fca
2 changed files with 27 additions and 7 deletions
|
|
@ -1544,11 +1544,15 @@ LDAP_SLAPD_F (int) get_alias_dn LDAP_P((
|
|||
# define rs_assert_ok(rs) ((void) (rs))
|
||||
# define rs_assert_ready(rs) ((void) (rs))
|
||||
# define rs_assert_done(rs) ((void) (rs))
|
||||
# define rs_reinit(rs) ((void) memset( rs, 0, sizeof(SlapReply) ))
|
||||
#endif
|
||||
LDAP_SLAPD_F (void) (rs_assert_ok) LDAP_P(( const SlapReply *rs ));
|
||||
LDAP_SLAPD_F (void) (rs_assert_ready) LDAP_P(( const SlapReply *rs ));
|
||||
LDAP_SLAPD_F (void) (rs_assert_done) LDAP_P(( const SlapReply *rs ));
|
||||
|
||||
LDAP_SLAPD_F (void) (rs_reinit) LDAP_P(( SlapReply *rs ));
|
||||
LDAP_SLAPD_F (void) rs_flush_entry LDAP_P(( Operation *op,
|
||||
SlapReply *rs, slap_overinst *on ));
|
||||
LDAP_SLAPD_F (void) rs_replace_entry LDAP_P(( Operation *op,
|
||||
SlapReply *rs, slap_overinst *on, Entry *e ));
|
||||
LDAP_SLAPD_F (int) rs_ensure_entry_modifiable LDAP_P(( Operation *op,
|
||||
|
|
|
|||
|
|
@ -190,23 +190,39 @@ void
|
|||
}
|
||||
#endif /* LDAP_TEST || USE_RS_ASSERT */
|
||||
|
||||
/* Set rs->sr_entry after obyeing and clearing sr_flags & REP_ENTRY_MASK. */
|
||||
/* Reset a used SlapReply whose contents has been flushed (freed/released) */
|
||||
void
|
||||
rs_replace_entry( Operation *op, SlapReply *rs, slap_overinst *on, Entry *e )
|
||||
(rs_reinit)( SlapReply *rs )
|
||||
{
|
||||
slap_mask_t e_flags = rs->sr_flags & REP_ENTRY_MUSTFLUSH;
|
||||
rs_assert_done( rs );
|
||||
memset( rs, 0, sizeof(SlapReply) );
|
||||
}
|
||||
|
||||
if ( e_flags && rs->sr_entry != NULL ) {
|
||||
RS_ASSERT( e_flags != REP_ENTRY_MUSTFLUSH );
|
||||
if ( !(e_flags & REP_ENTRY_MUSTRELEASE) ) {
|
||||
/* Obey and clear rs->sr_flags & REP_ENTRY_MASK. Clear sr_entry if freed. */
|
||||
void
|
||||
rs_flush_entry( Operation *op, SlapReply *rs, slap_overinst *on )
|
||||
{
|
||||
rs_assert_ok( rs );
|
||||
|
||||
if ( (rs->sr_flags & REP_ENTRY_MUSTFLUSH) && rs->sr_entry != NULL ) {
|
||||
if ( !(rs->sr_flags & REP_ENTRY_MUSTRELEASE) ) {
|
||||
entry_free( rs->sr_entry );
|
||||
} else if ( on != NULL ) {
|
||||
overlay_entry_release_ov( op, rs->sr_entry, 0, on );
|
||||
} else {
|
||||
be_entry_release_rw( op, rs->sr_entry, 0 );
|
||||
}
|
||||
rs->sr_entry = NULL;
|
||||
}
|
||||
|
||||
rs->sr_flags &= ~REP_ENTRY_MASK;
|
||||
}
|
||||
|
||||
/* Set rs->sr_entry after obeying and clearing sr_flags & REP_ENTRY_MASK. */
|
||||
void
|
||||
rs_replace_entry( Operation *op, SlapReply *rs, slap_overinst *on, Entry *e )
|
||||
{
|
||||
rs_flush_entry( op, rs, on );
|
||||
rs->sr_entry = e;
|
||||
}
|
||||
|
||||
|
|
@ -219,7 +235,7 @@ int
|
|||
rs_ensure_entry_modifiable( Operation *op, SlapReply *rs, slap_overinst *on )
|
||||
{
|
||||
if ( rs->sr_flags & REP_ENTRY_MODIFIABLE ) {
|
||||
RS_ASSERT((rs->sr_flags & REP_ENTRY_MUSTFLUSH)==REP_ENTRY_MUSTBEFREED);
|
||||
rs_assert_ok( rs );
|
||||
return 0;
|
||||
}
|
||||
rs_replace_entry( op, rs, on, entry_dup( rs->sr_entry ));
|
||||
|
|
|
|||
Loading…
Reference in a new issue