From d15a61abe6d0b6d5cc89ff4fdfb271393decf4b2 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Mon, 15 Jan 2007 01:20:41 -0800 Subject: [PATCH] Prototype cleanup; use "config.h" where appropriate --- common/tftpsubs.h | 14 +------------- config.h | 15 +++++++++++++++ lib/bsdsignal.c | 6 +----- lib/xmalloc.c | 3 +-- lib/xstrdup.c | 4 +--- 5 files changed, 19 insertions(+), 23 deletions(-) diff --git a/common/tftpsubs.h b/common/tftpsubs.h index 359ba1a..f986afc 100644 --- a/common/tftpsubs.h +++ b/common/tftpsubs.h @@ -62,18 +62,6 @@ int writeit(FILE *, struct tftphdr **, int, int); extern int segsize; #define MAX_SEGSIZE 65464 -/* - * Prototype for xmalloc/xstrdup - */ -extern void *xmalloc(size_t); -extern char *xstrdup(const char *); - -/* - * Signal-related stuff - */ -void (*bsd_signal(int, void (*)(int)))(int); +int pick_port_bind(int sockfd, struct sockaddr_in *myaddr, unsigned int from, unsigned int to); #endif - - -int pick_port_bind(int sockfd, struct sockaddr_in *myaddr, unsigned int from, unsigned int to); diff --git a/config.h b/config.h index 8869134..e4c5cc2 100644 --- a/config.h +++ b/config.h @@ -287,6 +287,21 @@ typedef int socklen_t; #define EOPTNEG 8 #endif +/* Prototypes for libxtra functions */ + +void *xmalloc(size_t); +char *xstrdup(const char *); + +#ifndef HAVE_BSD_SIGNAL +void (*bsd_signal(int, void (*)(int)))(int); +#endif +#ifndef HAVE_DUP2 +int dup2(int, int); +#endif +#ifndef HAVE_DAEMON +int daemon(int, int); +#endif + /* tftp-hpa version and configuration strings */ #include "version.h" diff --git a/lib/bsdsignal.c b/lib/bsdsignal.c index bc3ceb5..92de999 100644 --- a/lib/bsdsignal.c +++ b/lib/bsdsignal.c @@ -4,11 +4,7 @@ * Use sigaction() to simulate BSD signal() */ -#include -#include -#include - -void (*bsd_signal(int, void (*)(int)))(int); +#include "config.h" void (*bsd_signal(int signum, void (*handler)(int)))(int) { diff --git a/lib/xmalloc.c b/lib/xmalloc.c index 6e8ae24..f234a46 100644 --- a/lib/xmalloc.c +++ b/lib/xmalloc.c @@ -5,8 +5,7 @@ * */ -#include -#include +#include "config.h" void *xmalloc(size_t size) { diff --git a/lib/xstrdup.c b/lib/xstrdup.c index 5d65b7e..036b3b2 100644 --- a/lib/xstrdup.c +++ b/lib/xstrdup.c @@ -5,9 +5,7 @@ * */ -#include -#include -#include +#include "config.h" char *xstrdup(const char *s) {