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 <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <ac/socket.h>

View File

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

View File

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

View File

@ -57,6 +57,9 @@ avl_delete LDAP_P((Avlnode **, caddr_t, IFP));
LDAP_F caddr_t
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
avl_getfirst LDAP_P((Avlnode *));

View File

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

View File

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

View File

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

View File

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

View File

@ -9,14 +9,14 @@
#include "slap.h"
char *
void *
ch_malloc(
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 );
exit( 1 );
}
@ -24,19 +24,19 @@ ch_malloc(
return( new );
}
char *
void *
ch_realloc(
char *block,
void *block,
unsigned long size
)
{
char *new;
void *new;
if ( block == NULL ) {
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 );
exit( 1 );
}
@ -44,15 +44,15 @@ ch_realloc(
return( new );
}
char *
void *
ch_calloc(
unsigned long nelem,
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",
nelem, size, 0 );
exit( 1 );

View File

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

View File

@ -63,9 +63,9 @@ void be_close LDAP_P(());
* ch_malloc.c
*/
char * ch_malloc LDAP_P(( unsigned long size ));
char * ch_realloc LDAP_P(( char *block, unsigned long size ));
char * ch_calloc LDAP_P(( unsigned long nelem, unsigned long size ));
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 ));
/*
* charray.c

View File

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

View File

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

View File

@ -34,7 +34,7 @@ static void de_t61();
extern FILE *lock_fopen( char *, char *, 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;
PS rps;

View File

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

View File

@ -28,14 +28,14 @@
* Just like malloc, except we check the returned value and exit
* if anything goes wrong.
*/
char *
void *
ch_malloc(
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 );
exit( 1 );
}
@ -50,19 +50,19 @@ ch_malloc(
* Just like realloc, except we check the returned value and exit
* if anything goes wrong.
*/
char *
void *
ch_realloc(
char *block,
void *block,
unsigned long size
)
{
char *new;
void *new;
if ( block == NULL ) {
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 );
exit( 1 );
}
@ -77,15 +77,15 @@ ch_realloc(
* Just like calloc, except we check the returned value and exit
* if anything goes wrong.
*/
char *
void *
ch_calloc(
unsigned long nelem,
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",
nelem, size );
exit( 1 );
@ -100,7 +100,7 @@ ch_calloc(
*/
void
ch_free(
char *p
void *p
)
{
if ( p != NULL ) {

View File

@ -17,6 +17,7 @@
#include "portable.h"
#include <stdio.h>
#include <stdlib.h>
#include "slurp.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 * ));
/* External references */
extern char *ch_malloc LDAP_P(( unsigned long ));
static char *kattrs[] = {"kerberosName", NULL };
static struct timeval kst = {30L, 0L};

View File

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

View File

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

View File

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

View File

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

View File

@ -333,6 +333,13 @@ typedef struct tsl {
} tsl_t;
#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
#endif /* _SLURPD_H_ */

View File

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