Fix most `wider type truncated to int' bugs on OSF1 due to implicit decls:

#include <stdlib.h>    to get malloc & co various places,
 #include <ac/string.h> to get strlen & co in (liblutil/setproctitle.c),
 declare ch_malloc & co (slurp.h), avl_find_lin (avl.h), Malloc (ud/edit.c).
Also changed ch_malloc & co from char* to void* functions.
This commit is contained in:
Hallvard Furuseth 1998-11-11 23:37:38 +00:00
parent 5a14af5f84
commit 523fd2c891
24 changed files with 47 additions and 37 deletions

View file

@ -13,6 +13,7 @@
#include "portable.h" #include "portable.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include <ac/socket.h> #include <ac/socket.h>

View file

@ -13,6 +13,7 @@
#include "portable.h" #include "portable.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include <ac/string.h> #include <ac/string.h>

View file

@ -26,6 +26,7 @@
#include <ldap.h> #include <ldap.h>
#include <ldapconfig.h> #include <ldapconfig.h>
#include "ud.h" #include "ud.h"
extern void *Malloc();
extern struct entry Entry; extern struct entry Entry;
extern int verbose; extern int verbose;

View file

@ -57,6 +57,9 @@ avl_delete LDAP_P((Avlnode **, caddr_t, IFP));
LDAP_F caddr_t LDAP_F caddr_t
avl_find LDAP_P((Avlnode *, caddr_t, IFP)); avl_find LDAP_P((Avlnode *, caddr_t, IFP));
LDAP_F caddr_t
avl_find_lin LDAP_P((Avlnode *, caddr_t, IFP));
LDAP_F caddr_t LDAP_F caddr_t
avl_getfirst LDAP_P((Avlnode *)); avl_getfirst LDAP_P((Avlnode *));

View file

@ -3,6 +3,7 @@
#include "portable.h" #include "portable.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include <ac/string.h> #include <ac/string.h>

View file

@ -3,6 +3,7 @@
#ifndef HAVE_SETPROCTITLE #ifndef HAVE_SETPROCTITLE
#include <stdlib.h> #include <stdlib.h>
#include <ac/string.h>
#if defined( HAVE_STDARG_H ) && __STDC__ #if defined( HAVE_STDARG_H ) && __STDC__
#include <stdarg.h> #include <stdarg.h>

View file

@ -22,7 +22,6 @@
#include "slap.h" #include "slap.h"
extern char **charray_dup(); extern char **charray_dup();
extern char *ch_malloc();
extern int errno; extern int errno;
void void

View file

@ -17,7 +17,6 @@ extern pthread_mutex_t currenttime_mutex;
extern IDList *idl_alloc(); extern IDList *idl_alloc();
extern Attribute *attr_find(); extern Attribute *attr_find();
extern IDList *filter_candidates(); extern IDList *filter_candidates();
extern char *ch_realloc();
extern char *dn_parent(); extern char *dn_parent();
static IDList *base_candidates(); static IDList *base_candidates();

View file

@ -9,14 +9,14 @@
#include "slap.h" #include "slap.h"
char * void *
ch_malloc( ch_malloc(
unsigned long size unsigned long size
) )
{ {
char *new; void *new;
if ( (new = (char *) malloc( size )) == NULL ) { if ( (new = (void *) malloc( size )) == NULL ) {
Debug( LDAP_DEBUG_ANY, "malloc of %d bytes failed\n", size, 0, 0 ); Debug( LDAP_DEBUG_ANY, "malloc of %d bytes failed\n", size, 0, 0 );
exit( 1 ); exit( 1 );
} }
@ -24,19 +24,19 @@ ch_malloc(
return( new ); return( new );
} }
char * void *
ch_realloc( ch_realloc(
char *block, void *block,
unsigned long size unsigned long size
) )
{ {
char *new; void *new;
if ( block == NULL ) { if ( block == NULL ) {
return( ch_malloc( size ) ); return( ch_malloc( size ) );
} }
if ( (new = (char *) realloc( block, size )) == NULL ) { if ( (new = (void *) realloc( block, size )) == NULL ) {
Debug( LDAP_DEBUG_ANY, "realloc of %d bytes failed\n", size, 0, 0 ); Debug( LDAP_DEBUG_ANY, "realloc of %d bytes failed\n", size, 0, 0 );
exit( 1 ); exit( 1 );
} }
@ -44,15 +44,15 @@ ch_realloc(
return( new ); return( new );
} }
char * void *
ch_calloc( ch_calloc(
unsigned long nelem, unsigned long nelem,
unsigned long size unsigned long size
) )
{ {
char *new; void *new;
if ( (new = (char *) calloc( nelem, size )) == NULL ) { if ( (new = (void *) calloc( nelem, size )) == NULL ) {
Debug( LDAP_DEBUG_ANY, "calloc of %d elems of %d bytes failed\n", Debug( LDAP_DEBUG_ANY, "calloc of %d elems of %d bytes failed\n",
nelem, size, 0 ); nelem, size, 0 );
exit( 1 ); exit( 1 );

View file

@ -13,8 +13,6 @@ static int get_filter_list();
static int get_substring_filter(); static int get_substring_filter();
extern int get_ava(); extern int get_ava();
extern char *ch_malloc();
extern char *ch_realloc();
int int
get_filter( Connection *conn, BerElement *ber, Filter **filt, char **fstr ) get_filter( Connection *conn, BerElement *ber, Filter **filt, char **fstr )

View file

@ -63,9 +63,9 @@ void be_close LDAP_P(());
* ch_malloc.c * ch_malloc.c
*/ */
char * ch_malloc LDAP_P(( unsigned long size )); void * ch_malloc LDAP_P(( unsigned long size ));
char * ch_realloc LDAP_P(( char *block, unsigned long size )); void * ch_realloc LDAP_P(( void *block, unsigned long size ));
char * ch_calloc LDAP_P(( unsigned long nelem, unsigned long size )); void * ch_calloc LDAP_P(( unsigned long nelem, unsigned long size ));
/* /*
* charray.c * charray.c

View file

@ -18,7 +18,6 @@ extern char *replogfile;
extern FILE *lock_fopen(); extern FILE *lock_fopen();
extern int lock_fclose(); extern int lock_fclose();
extern char *ch_malloc();
extern char *entry2str(); extern char *entry2str();
void void
@ -81,7 +80,7 @@ replog(
len = strlen( mods->mod_type ); len = strlen( mods->mod_type );
len = LDIF_SIZE_NEEDED( len, len = LDIF_SIZE_NEEDED( len,
mods->mod_bvalues[i]->bv_len ) + 1; mods->mod_bvalues[i]->bv_len ) + 1;
buf = ch_malloc( len ); buf = (char *) ch_malloc( len );
bufp = buf; bufp = buf;
put_type_and_value( &bufp, mods->mod_type, put_type_and_value( &bufp, mods->mod_type,

View file

@ -3,6 +3,7 @@
#include "portable.h" #include "portable.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <ac/ctype.h> #include <ac/ctype.h>
#include <ac/string.h> #include <ac/string.h>

View file

@ -34,7 +34,7 @@ static void de_t61();
extern FILE *lock_fopen( char *, char *, FILE ** ); extern FILE *lock_fopen( char *, char *, FILE ** );
extern int lock_fclose( FILE *, FILE * ); extern int lock_fclose( FILE *, FILE * );
extern char *ch_realloc( char *, unsigned long ); extern void *ch_realloc( void *, unsigned long );
short ldap_dn_syntax; short ldap_dn_syntax;
PS rps; PS rps;

View file

@ -1,6 +1,7 @@
#include "portable.h" #include "portable.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <ac/string.h> #include <ac/string.h>
#include <ac/socket.h> #include <ac/socket.h>

View file

@ -28,14 +28,14 @@
* Just like malloc, except we check the returned value and exit * Just like malloc, except we check the returned value and exit
* if anything goes wrong. * if anything goes wrong.
*/ */
char * void *
ch_malloc( ch_malloc(
unsigned long size unsigned long size
) )
{ {
char *new; void *new;
if ( (new = (char *) malloc( size )) == NULL ) { if ( (new = (void *) malloc( size )) == NULL ) {
fprintf( stderr, "malloc of %lu bytes failed\n", size ); fprintf( stderr, "malloc of %lu bytes failed\n", size );
exit( 1 ); exit( 1 );
} }
@ -50,19 +50,19 @@ ch_malloc(
* Just like realloc, except we check the returned value and exit * Just like realloc, except we check the returned value and exit
* if anything goes wrong. * if anything goes wrong.
*/ */
char * void *
ch_realloc( ch_realloc(
char *block, void *block,
unsigned long size unsigned long size
) )
{ {
char *new; void *new;
if ( block == NULL ) { if ( block == NULL ) {
return( ch_malloc( size ) ); return( ch_malloc( size ) );
} }
if ( (new = (char *) realloc( block, size )) == NULL ) { if ( (new = (void *) realloc( block, size )) == NULL ) {
fprintf( stderr, "realloc of %lu bytes failed\n", size ); fprintf( stderr, "realloc of %lu bytes failed\n", size );
exit( 1 ); exit( 1 );
} }
@ -77,15 +77,15 @@ ch_realloc(
* Just like calloc, except we check the returned value and exit * Just like calloc, except we check the returned value and exit
* if anything goes wrong. * if anything goes wrong.
*/ */
char * void *
ch_calloc( ch_calloc(
unsigned long nelem, unsigned long nelem,
unsigned long size unsigned long size
) )
{ {
char *new; void *new;
if ( (new = (char *) calloc( nelem, size )) == NULL ) { if ( (new = (void *) calloc( nelem, size )) == NULL ) {
fprintf( stderr, "calloc of %lu elems of %lu bytes failed\n", fprintf( stderr, "calloc of %lu elems of %lu bytes failed\n",
nelem, size ); nelem, size );
exit( 1 ); exit( 1 );
@ -100,7 +100,7 @@ ch_calloc(
*/ */
void void
ch_free( ch_free(
char *p void *p
) )
{ {
if ( p != NULL ) { if ( p != NULL ) {

View file

@ -17,6 +17,7 @@
#include "portable.h" #include "portable.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include "slurp.h" #include "slurp.h"
#include "globals.h" #include "globals.h"

View file

@ -47,9 +47,6 @@ static int do_bind LDAP_P(( Ri *, int * ));
static int do_unbind LDAP_P(( Ri * )); static int do_unbind LDAP_P(( Ri * ));
/* External references */
extern char *ch_malloc LDAP_P(( unsigned long ));
static char *kattrs[] = {"kerberosName", NULL }; static char *kattrs[] = {"kerberosName", NULL };
static struct timeval kst = {30L, 0L}; static struct timeval kst = {30L, 0L};

View file

@ -33,7 +33,6 @@
/* externs */ /* externs */
extern char *str_getline LDAP_P(( char **next )); extern char *str_getline LDAP_P(( char **next ));
extern void ch_free LDAP_P(( char *p ));
/* Forward references */ /* Forward references */
static Rh *get_repl_hosts LDAP_P(( char *, int *, char ** )); static Rh *get_repl_hosts LDAP_P(( char *, int *, char ** ));

View file

@ -36,7 +36,6 @@
* Externs * Externs
*/ */
extern FILE *lock_fopen LDAP_P(( char *, char *, FILE ** )); extern FILE *lock_fopen LDAP_P(( char *, char *, FILE ** ));
extern char *ch_malloc LDAP_P(( unsigned long ));
/* /*
* Forward declarations * Forward declarations

View file

@ -20,6 +20,7 @@
#include "portable.h" #include "portable.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <ac/signal.h> #include <ac/signal.h>
#include "slurp.h" #include "slurp.h"

View file

@ -34,6 +34,7 @@
#include "portable.h" #include "portable.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include "slurp.h" #include "slurp.h"
#include "globals.h" #include "globals.h"

View file

@ -333,6 +333,13 @@ typedef struct tsl {
} tsl_t; } tsl_t;
#endif /* HAVE_LWP */ #endif /* HAVE_LWP */
/* Public functions */
/* In ch_malloc.c */
void * ch_malloc LDAP_P(( unsigned long size ));
void * ch_realloc LDAP_P(( void *block, unsigned long size ));
void * ch_calloc LDAP_P(( unsigned long nelem, unsigned long size ));
void ch_free LDAP_P(( void *p ));
/* /*
@ -345,4 +352,3 @@ extern int Re_init LDAP_P(( Re **re ));
LDAP_END_DECL LDAP_END_DECL
#endif /* _SLURPD_H_ */ #endif /* _SLURPD_H_ */

View file

@ -19,6 +19,7 @@
#include "portable.h" #include "portable.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <ac/string.h> #include <ac/string.h>
#include <ac/unistd.h> #include <ac/unistd.h>