From d0991d97fb4295fb48b70c212b553428ad271a07 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Wed, 19 Dec 2001 21:22:04 +0000 Subject: [PATCH] const'ify and remove lint --- libraries/liblber/bprint.c | 20 ++++++++++++-------- libraries/liblber/dtest.c | 2 +- libraries/liblber/etest.c | 4 ++-- libraries/liblber/lber-int.h | 8 ++++++++ libraries/liblber/nt_err.c | 2 +- libraries/liblber/options.c | 1 - 6 files changed, 24 insertions(+), 13 deletions(-) diff --git a/libraries/liblber/bprint.c b/libraries/liblber/bprint.c index 2d341b771a..1ede28f4b4 100644 --- a/libraries/liblber/bprint.c +++ b/libraries/liblber/bprint.c @@ -14,9 +14,7 @@ #include "lber-int.h" -typedef void (*BER_LOG_FN) LDAP_P((FILE *file, char *subsys, int level, const char *fmt, va_list vl)); - -#define ber_log_check(errlvl, loglvl) (errlvl & loglvl) +#define ber_log_check(errlvl, loglvl) ((errlvl) & (loglvl)) BER_LOG_FN ber_int_log_proc = NULL; @@ -71,7 +69,11 @@ BER_LOG_PRINT_FN ber_pvt_log_print = ber_error_print; * lber log */ -int ber_pvt_log_output( char *subsystem, int level, const char *fmt, ... ) +int ber_pvt_log_output( + const char *subsystem, + int level, + const char *fmt, + ... ) { char buf[ 1024 ]; va_list vl; @@ -244,7 +246,7 @@ int ber_output_dump( (long) ber->ber_end, (long) len ); - ber_pvt_log_output( subsys, level, "%s", buf ); + (void) ber_pvt_log_output( subsys, level, "%s", buf ); #define BP_OFFSET 9 #define BP_GRAPH 60 @@ -261,7 +263,9 @@ int ber_output_dump( unsigned off; if( !n ) { - if( i ) ber_pvt_log_output( subsys, level, "%s", line ); + if( i ) { + (void) ber_pvt_log_output( subsys, level, "%s", line ); + } memset( line, ' ', sizeof(line)-2 ); line[sizeof(line)-2] = '\n'; line[sizeof(line)-1] = '\0'; @@ -288,7 +292,7 @@ int ber_output_dump( } } - ber_pvt_log_output( subsys, level, "%s", line ); + return ber_pvt_log_output( subsys, level, "%s", line ); } #endif @@ -333,7 +337,7 @@ ber_dump( (long) ber->ber_end, (long) len ); - (*ber_pvt_log_print)( buf ); + (void) (*ber_pvt_log_print)( buf ); ber_bprint( ber->ber_ptr, len ); } diff --git a/libraries/liblber/dtest.c b/libraries/liblber/dtest.c index 633d42ed7e..937f8deaf8 100644 --- a/libraries/liblber/dtest.c +++ b/libraries/liblber/dtest.c @@ -31,7 +31,7 @@ #include -static void usage( char *name ) +static void usage( const char *name ) { fprintf( stderr, "usage: %s fmt\n", name ); } diff --git a/libraries/liblber/etest.c b/libraries/liblber/etest.c index 0b91ba75ce..863cd7e563 100644 --- a/libraries/liblber/etest.c +++ b/libraries/liblber/etest.c @@ -25,12 +25,12 @@ #include "lber.h" -static void usage( char *name ) +static void usage( const char *name ) { fprintf( stderr, "usage: %s fmtstring\n", name ); } -static char* getbuf() { +static char* getbuf( void ) { char *p; static char buf[128]; diff --git a/libraries/liblber/lber-int.h b/libraries/liblber/lber-int.h index 73f3238e4f..37bd015c67 100644 --- a/libraries/liblber/lber-int.h +++ b/libraries/liblber/lber-int.h @@ -24,6 +24,9 @@ LDAP_BEGIN_DECL +typedef void (*BER_LOG_FN)(FILE *file, + const char *subsys, int level, const char *fmt, va_list vl ); + LBER_V (BER_ERRNO_FN) ber_int_errno_fn; struct lber_options { @@ -46,6 +49,11 @@ struct lber_options { # endif #endif +LBER_F( int ) ber_pvt_log_output( + const char *subsystem, + int level, + const char *fmt, ... ); + #define LBER_UNINITIALIZED 0x0 #define LBER_INITIALIZED 0x1 #define LBER_VALID_BERELEMENT 0x2 diff --git a/libraries/liblber/nt_err.c b/libraries/liblber/nt_err.c index e5f64691d1..bc3f4e7ceb 100644 --- a/libraries/liblber/nt_err.c +++ b/libraries/liblber/nt_err.c @@ -76,7 +76,7 @@ char *ber_pvt_wsa_err2string( int err ) LBER_RETSTR( WSA_E_NO_MORE ) LBER_RETSTR( WSA_E_CANCELLED ) LBER_RETSTR( WSAEREFUSED ) -#endif // HAVE_WINSOCK2 +#endif /* HAVE_WINSOCK2 */ LBER_RETSTR( WSAHOST_NOT_FOUND ) LBER_RETSTR( WSATRY_AGAIN ) diff --git a/libraries/liblber/options.c b/libraries/liblber/options.c index 64e7fcc466..711be28d36 100644 --- a/libraries/liblber/options.c +++ b/libraries/liblber/options.c @@ -11,7 +11,6 @@ #include "lber-int.h" /* bprint.c */ -typedef void (*BER_LOG_FN) LDAP_P((FILE *file, char *subsys, int level, const char *fmt, va_list vl)); extern void * ber_pvt_err_file; extern BER_LOG_FN ber_int_log_proc; -- 2.39.5