]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/tools/chlog2replog.c
Add CSRIMALLOC support
[openldap] / servers / slapd / tools / chlog2replog.c
index 434977991494cfc8a7ca970f9e33992d978f4b47..ec31ed457fdc521e6c656045e40d0a55d0143a04 100644 (file)
@@ -19,7 +19,7 @@
 #include "portable.h"
 
 #include <stdio.h>
-#include <stdlib.h>
+#include <ac/stdlib.h>
 
 #include <ac/ctype.h>
 #include <ac/string.h>
@@ -122,8 +122,8 @@ dn2ldap( char *edbdn )
 }
 
 
-#define SEPARATOR(c)   (c == ',' || c == ';')
-#define SPACE(c)       (c == ' ' || c == '\n')
+#define SEPARATOR(c)   ((c) == ',' || (c) == ';')
+#define SPACE(c)       ((c) == ' ' || (c) == '\n')
 
 static int
 dn2ldif( PS ps, DN dn )
@@ -413,7 +413,7 @@ print_as(Attr_Sequence as, int modtype, FILE *ofp)
            }
            if ( obuf != NULL ) {
                fputs( obuf, ofp );
-               free( obuf );
+               ber_memfree( obuf );
            }
        }
        if ( modtype != 0 ) {
@@ -473,13 +473,13 @@ main( int argc, char **argv )
            break;
        default:
            usage( progname );
-           exit( 1 );
+           exit( EXIT_FAILURE );
        }
     }
 
     if (( dn_suffix == NULL ) || ( nreplicas == 0 )) {
        usage( progname );
-       exit( 1 );
+       exit( EXIT_FAILURE );
     }
 
     if ( ofile == NULL ) {
@@ -494,12 +494,12 @@ main( int argc, char **argv )
     if (( std_ps = ps_alloc( std_open )) == NULLPS ||
            std_setup( std_ps, ofp ) != OK ) {
        fprintf( stderr, "std_ps setup failed - help!\n" );
-       exit( 1 );
+       exit( EXIT_FAILURE );
     }
     if (( rps = ps_alloc( str_open )) == NULLPS ||
            str_setup( rps, NULLCP, 0, 0 ) != OK ) {
        fprintf( stderr, "rps setup failed - help!\n" );
-       exit( 1 );
+       exit( EXIT_FAILURE );
     }
 
 
@@ -569,7 +569,7 @@ main( int argc, char **argv )
            if ( ofile != NULL ) {
                if (( ofp = lock_fopen( ofile, "a", &lfp )) == NULL ) {
                    perror( "open" );
-                   exit( 1 );
+                   exit( EXIT_FAILURE );
                }
            }
            /*
@@ -697,5 +697,5 @@ main( int argc, char **argv )
        sprintf( nbuf, "%s.lock", ofile );
        (void) unlink( nbuf );
     }
-    exit( 0 );
+    exit( EXIT_SUCCESS );
 }