]> git.sur5r.net Git - openldap/blobdiff - servers/slurpd/re.c
Kill lber_debug
[openldap] / servers / slurpd / re.c
index 02e558116bb36fa90d38f2bfde14f53b350895c6..fa171ca1593ac2fa325cf893cf13a8a2714f3883 100644 (file)
 #include <ac/string.h>
 #include <ac/ctype.h>
 
-#include "../slapd/slap.h"
 #include "slurp.h"
 #include "globals.h"
 
+#include "../slapd/slap.h"
+
 /* Forward references */
 static Rh      *get_repl_hosts LDAP_P(( char *, int *, char ** ));
 static int     gettype LDAP_P(( char * ));
@@ -79,10 +80,9 @@ Re_free(
                "Warning: freeing re (dn: %s) with nonzero refcnt\n",
                re->re_dn, 0, 0 );
     }
-#if !defined( HAVE_LWP )
-    /* This seems to have problems under SunOS lwp */
-    pthread_mutex_destroy( &re->re_mutex );
-#endif /* HAVE_LWP */
+
+    ldap_pvt_thread_mutex_destroy( &re->re_mutex );
+
     ch_free( re->re_timestamp );
     if (( rh = re->re_replicas ) != NULL ) {
        for ( i = 0; rh[ i ].rh_hostname != NULL; i++ ) {
@@ -125,9 +125,9 @@ Re_parse(
     int                        state;
     int                        nml;
     char               *buf, *rp, *p;
-    long               buflen;
+    size_t             buflen;
     char               *type, *value;
-    int                        len;
+    ber_len_t  len;
     int                        nreplicas;
 
     if ( re == NULL ) {
@@ -158,7 +158,7 @@ Re_parse(
        if ( strncmp( buf, ERROR_STR, strlen( ERROR_STR )) == 0 ) {
            continue;
        }
-       buflen = ( long ) strlen( buf );
+       buflen = strlen( buf );
        if ( ldif_parse_line( buf, &type, &value, &len ) < 0 ) {
            Debug( LDAP_DEBUG_ANY,
                    "Error: Re_parse: malformed replog file\n",
@@ -208,7 +208,7 @@ Re_parse(
        if (( buf = ldif_getline( &rp )) == NULL ) {
            break;
        }
-       buflen = ( long ) strlen( buf );
+       buflen = strlen( buf );
        if (( buflen == 1 ) && ( buf[ 0 ] == '-' )) {
            type = "-";
            value = NULL;
@@ -256,10 +256,11 @@ get_repl_hosts(
     char       **r_rp
 )
 {
-    char               buf[ LINE_WIDTH + 1 ];
+    char               buf[ LDIF_LINE_WIDTH + 1 ];
     char               *type, *value, *line, *p;
     Rh                 *rh = NULL;
-    int                        nreplicas, len;
+    int                        nreplicas;
+       ber_len_t       len;
     int                        port;
     int                        repl_ok;
     int                        i;
@@ -566,7 +567,8 @@ Re_write(
            }
        } else {
            char *obuf;
-           obuf = ldif_type_and_value( re->re_mods[ i ].mi_type,
+           obuf = ldif_put( LDIF_PUT_VALUE,
+                       re->re_mods[ i ].mi_type,
                    re->re_mods[ i ].mi_val ? re->re_mods[ i ].mi_val : "",
                    re->re_mods[ i ].mi_len );
            if ( fputs( obuf, fp ) < 0 ) {
@@ -574,7 +576,7 @@ Re_write(
                free( obuf );
                goto bad;
            } else {
-               free( obuf );
+               ber_memfree( obuf );
            }
        }
     }
@@ -641,7 +643,7 @@ Re_lock(
     Re *re
 )
 {
-    return( pthread_mutex_lock( &re->re_mutex ));
+    return( ldap_pvt_thread_mutex_lock( &re->re_mutex ));
 }
 
 
@@ -655,7 +657,7 @@ Re_unlock(
     Re *re
 )
 {
-    return( pthread_mutex_unlock( &re->re_mutex ));
+    return( ldap_pvt_thread_mutex_unlock( &re->re_mutex ));
 }
 
 
@@ -696,7 +698,7 @@ Re_init(
    (*re)->re_mods = NULL;
    (*re)->re_next = NULL;
 
-   pthread_mutex_init( &((*re)->re_mutex), pthread_mutexattr_default );
+   ldap_pvt_thread_mutex_init( &((*re)->re_mutex) );
    return 0;
 }