From cb15a4c6871dad2dd01f74cf4a0607015f81e4f5 Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Fri, 31 Dec 2010 09:45:16 +0000 Subject: [PATCH] ITS#6758 rs_reinit() += slap_reply_t parameter --- servers/slapd/proto-slap.h | 9 +++++++-- servers/slapd/result.c | 5 ++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 6f72f30f32..5eafeb9105 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -1544,13 +1544,18 @@ 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 )); +#define rs_reinit(rs, type) do { \ + SlapReply *const rsRI = (rs); \ + rs_assert_done( rsRI ); \ + memset( rsRI, 0, sizeof(*rsRI) ); \ + rsRI->sr_type = (type); \ + } while ( 0 ) +LDAP_SLAPD_F (void) (rs_reinit) LDAP_P(( SlapReply *rs, slap_reply_t type )); 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, diff --git a/servers/slapd/result.c b/servers/slapd/result.c index 0382dee21b..1f6a2f3fc8 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -192,10 +192,9 @@ void /* Reset a used SlapReply whose contents has been flushed (freed/released) */ void -(rs_reinit)( SlapReply *rs ) +(rs_reinit)( SlapReply *rs, slap_reply_t type ) { - rs_assert_done( rs ); - memset( rs, 0, sizeof(SlapReply) ); + rs_reinit( rs, type ); /* proto-slap.h macro */ } /* Obey and clear rs->sr_flags & REP_ENTRY_MASK. Clear sr_entry if freed. */ -- 2.39.5