From d473f6b60828a6981aa0b865b539058cdaa4f568 Mon Sep 17 00:00:00 2001 From: Paulo Cesar Pereira de Andrade Date: Sun, 16 Mar 2008 16:25:42 -0300 Subject: [PATCH] Compile warning fixes. Include header with prototypes for signals.c, and change prototypes and definitions to match. This should not have any side effects as function arguments are ignored. Ansify some functions with K&R definitions. printhex.c:fprintfhex() could be changed to a "sane" implementation, but only change was "ansification". --- list.c | 32 ++++++++++---------------------- printhex.c | 9 ++------- signals.c | 21 ++++++++++++--------- xsm.h | 8 +++++--- 4 files changed, 29 insertions(+), 41 deletions(-) diff --git a/list.c b/list.c index 25d2647..fa09edc 100644 --- a/list.c +++ b/list.c @@ -27,7 +27,7 @@ in this Software without prior written authorization from The Open Group. #include "xsm.h" List * -ListInit() +ListInit(void) { List *l; @@ -40,24 +40,21 @@ ListInit() } List * -ListFirst(l) -List *l; +ListFirst(List *l) { if(l->next->thing) return l->next; else return NULL; } List * -ListNext(l) -List *l; +ListNext(List *l) { if(l->next->thing) return l->next; else return NULL; } void -ListFreeAll(l) -List *l; +ListFreeAll(List *l) { char *thing; List *next; @@ -72,8 +69,7 @@ List *l; } void -ListFreeAllButHead(l) -List *l; +ListFreeAllButHead(List *l) { List *p, *next; @@ -91,9 +87,7 @@ List *l; } List * -ListAddFirst(l, v) -List *l; -char *v; +ListAddFirst(List *l, char *v) { List *e; @@ -110,9 +104,7 @@ char *v; } List * -ListAddLast(l, v) -List *l; -char *v; +ListAddLast(List *l, char *v) { List *e; @@ -129,8 +121,7 @@ char *v; } void -ListFreeOne(e) -List *e; +ListFreeOne(List *e) { e->next->prev = e->prev; e->prev->next = e->next; @@ -139,9 +130,7 @@ List *e; Status -ListSearchAndFreeOne(l,thing) -List *l; -char *thing; +ListSearchAndFreeOne(List *l, char *thing) { List *p; @@ -157,8 +146,7 @@ char *thing; int -ListCount(l) -List *l; +ListCount(List *l) { int i; List *e; diff --git a/printhex.c b/printhex.c index b411f9e..f14ab8b 100644 --- a/printhex.c +++ b/printhex.c @@ -24,7 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -#include +#include "xsm.h" static char *hex_table[] = { /* for printing hex digits */ "00", "01", "02", "03", "04", "05", "06", "07", @@ -63,12 +63,7 @@ static char *hex_table[] = { /* for printing hex digits */ void -fprintfhex (fp, len, cp) - -register FILE *fp; -unsigned int len; -char *cp; - +fprintfhex(register FILE *fp, unsigned int len, char *cp) { unsigned char *ucp = (unsigned char *) cp; diff --git a/signals.c b/signals.c index 9be9bab..fb9c34d 100644 --- a/signals.c +++ b/signals.c @@ -98,15 +98,16 @@ in this Software without prior written authorization from The Open Group. #include +#include "xsm.h" + int checkpoint_from_signal = 0; extern XtSignalId sig_term_id, sig_usr1_id; extern Bool wantShutdown; -SIGVAL (*Signal (sig, handler))() - int sig; - SIGVAL (*handler)(); +static SIGVAL +Signal(int sig, SIGVAL (*handler)(int)) { #ifndef X_NOT_POSIX struct sigaction sigact, osigact; @@ -114,15 +115,20 @@ SIGVAL (*Signal (sig, handler))() sigemptyset(&sigact.sa_mask); sigact.sa_flags = 0; sigaction(sig, &sigact, &osigact); +# if defined(SIGNALRETURNSINT) return osigact.sa_handler; +# endif #else - return signal(sig, handler); +# if defined(SIGNALRETURNSINT) + return +# endif + signal(sig, handler); #endif } void -sig_child_handler (XtPointer closure, XtSignalId id) +sig_child_handler (int sig) { int pid, olderrno = errno; @@ -231,10 +237,7 @@ register_signals (XtAppContext appContext) int -execute_system_command (s) - -char *s; - +execute_system_command (char *s) { int stat; diff --git a/xsm.h b/xsm.h index cf48cb2..d6fa0b7 100644 --- a/xsm.h +++ b/xsm.h @@ -210,9 +210,11 @@ extern void remote_start(char *restart_protocol, char *restart_machine, char *non_local_session_env ); /* signals.c */ -extern void sig_child_handler(void); -extern void sig_term_handler(void); -extern void sig_usr1_handler(void); +extern void sig_child_handler(int sig); +extern void sig_term_handler(int sig); +extern void sig_usr1_handler(int sig); +extern void xt_sig_term_handler(XtPointer closure, XtSignalId *id); +extern void xt_sig_usr1_handler(XtPointer closure, XtSignalId *id); extern void register_signals(XtAppContext); extern int execute_system_command(char *s); -- 1.5.3.2