]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-monitor/init.c
Cleanup ISO C compatibility for recent commits
[openldap] / servers / slapd / back-monitor / init.c
index dc6975ab344d79eff3401ed9ef8346a0ae7b56c4..c2b0b7ef23626d1479c011362d8a31c2b5ac0451 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2001-2009 The OpenLDAP Foundation.
+ * Copyright 2001-2011 The OpenLDAP Foundation.
  * Portions Copyright 2001-2003 Pierangelo Masarati.
  * All rights reserved.
  *
@@ -830,7 +830,7 @@ monitor_search2ndn(
        OperationBuffer opbuf;
        Operation       *op;
        void    *thrctx;
-       SlapReply       rs = { 0 };
+       SlapReply       rs = { REP_RESULT };
        slap_callback   cb = { NULL, monitor_search2ndn_cb, NULL, NULL };
        int             rc;
 
@@ -841,7 +841,7 @@ monitor_search2ndn(
        }
 
        thrctx = ldap_pvt_thread_pool_context();
-       connection_fake_init( &conn, &opbuf, thrctx );
+       connection_fake_init2( &conn, &opbuf, thrctx, 0 );
        op = &opbuf.ob_op;
 
        op->o_tag = LDAP_REQ_SEARCH;
@@ -1108,16 +1108,6 @@ done:;
 
                *elpp = (entry_limbo_t *)ch_malloc( sizeof( entry_limbo_t ) );
                if ( *elpp == NULL ) {
-                       el.el_e->e_private = NULL;
-                       entry_free( el.el_e );
-                       return -1;
-               }
-
-               if ( *elpp != NULL ) {
-                       el.el_next = NULL;
-                       **elpp = el;
-
-               } else {
                        if ( !BER_BVISNULL( &el.el_filter ) ) {
                                ch_free( el.el_filter.bv_val );
                        }
@@ -1129,6 +1119,9 @@ done:;
                        }
                        return -1;
                }
+
+               el.el_next = NULL;
+               **elpp = el;
        }
 
        return 0;
@@ -2051,7 +2044,7 @@ monitor_back_initialize(
 
        bi->bi_extended = 0;
 
-       bi->bi_entry_release_rw = 0;
+       bi->bi_entry_release_rw = monitor_back_release;
        bi->bi_chk_referrals = 0;
        bi->bi_operational = monitor_back_operational;
 
@@ -2061,6 +2054,7 @@ monitor_back_initialize(
        bi->bi_tool_entry_open = 0;
        bi->bi_tool_entry_close = 0;
        bi->bi_tool_entry_first = 0;
+       bi->bi_tool_entry_first_x = 0;
        bi->bi_tool_entry_next = 0;
        bi->bi_tool_entry_get = 0;
        bi->bi_tool_entry_put = 0;
@@ -2207,10 +2201,7 @@ monitor_back_db_open(
        monitor_entry_t         *mp;
        int                     i;
        struct berval           bv, rdn = BER_BVC(SLAPD_MONITOR_DN);
-       struct tm               *tms;
-#ifdef HAVE_GMTIME_R
-       struct tm               tm_buf;
-#endif
+       struct tm               tms;
        static char             tmbuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
        struct berval   desc[] = {
                BER_BVC("This subtree contains monitoring/managing objects."),
@@ -2229,27 +2220,8 @@ monitor_back_db_open(
        /*
         * Start
         */
-#ifndef HAVE_GMTIME_R
-       ldap_pvt_thread_mutex_lock( &gmtime_mutex );
-#endif
-#ifdef HACK_LOCAL_TIME
-# ifdef HAVE_LOCALTIME_R
-       tms = localtime_r( &starttime, &tm_buf );
-# else
-       tms = localtime( &starttime );
-# endif /* HAVE_LOCALTIME_R */
-       lutil_localtime( tmbuf, sizeof(tmbuf), tms, -timezone );
-#else /* !HACK_LOCAL_TIME */
-# ifdef HAVE_GMTIME_R
-       tms = gmtime_r( &starttime, &tm_buf );
-# else
-       tms = gmtime( &starttime );
-# endif /* HAVE_GMTIME_R */
-       lutil_gentime( tmbuf, sizeof(tmbuf), tms );
-#endif /* !HACK_LOCAL_TIME */
-#ifndef HAVE_GMTIME_R
-       ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
-#endif
+       ldap_pvt_gmtime( &starttime, &tms );
+       lutil_gentime( tmbuf, sizeof(tmbuf), &tms );
 
        mi->mi_startTime.bv_val = tmbuf;
        mi->mi_startTime.bv_len = strlen( tmbuf );