summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2009-01-14 20:53:22 -0200
committerPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2009-01-14 20:53:22 -0200
commit1f0cc20f6f558ddc059e354453c51fea32f3ee92 (patch)
tree479c1adbd449a39b74aec2f53f1c42cccb27bdb2
parent17d3fc13961d85739d0f0776734bc9a2d6a6b012 (diff)
Ansification and compile warning fixes.
This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, and corrects make distcheck. Most gcc 4.3 and sparse warnings correct (remaining warnings are from yacc generated source).
-rw-r--r--Makefile.am2
-rw-r--r--cfgscan.c4
-rw-r--r--configure.ac8
-rw-r--r--utils.c43
-rw-r--r--utils.h2
-rw-r--r--xkbevd.c16
6 files changed, 34 insertions, 41 deletions
diff --git a/Makefile.am b/Makefile.am
index 7c9904d..45d4972 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -80,6 +80,6 @@ MAINTAINERCLEANFILES += ChangeLog
.PHONY: ChangeLog
ChangeLog:
- (GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
+ $(CHANGELOG_CMD)
dist-hook: ChangeLog
diff --git a/cfgscan.c b/cfgscan.c
index 6eaef0c..4f9ea20 100644
--- a/cfgscan.c
+++ b/cfgscan.c
@@ -241,7 +241,7 @@ int ch;
return ERROR;
}
-struct _Keyword {
+static struct _Keyword {
char *keyword;
int token;
} keywords[] = {
@@ -255,7 +255,7 @@ struct _Keyword {
{ "shell", SHELL },
{ "sound", SOUND }
};
-int numKeywords = sizeof(keywords)/sizeof(struct _Keyword);
+static int numKeywords = sizeof(keywords)/sizeof(struct _Keyword);
static int
yyGetIdent(int first)
diff --git a/configure.ac b/configure.ac
index 1d1bac1..a480b19 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,18 +25,26 @@ AC_INIT(xkbevd,[1.0.2], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
AM_INIT_AUTOMAKE([dist-bzip2])
AM_MAINTAINER_MODE
+# Require xorg-macros: XORG_CWARNFLAGS, XORG_CHANGELOG
+m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.2 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.2)
+
AM_CONFIG_HEADER(config.h)
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_YACC
+XORG_CWARNFLAGS
+
# Checks for pkg-config packages
PKG_CHECK_MODULES(XKBEVD, xkbfile x11)
+XKBEVD_CFLAGS="$CWARNFLAGS $XKBEVD_CFLAGS"
AC_SUBST(XKBEVD_CFLAGS)
AC_SUBST(XKBEVD_LIBS)
XORG_MANPAGE_SECTIONS
XORG_RELEASE_VERSION
+XORG_CHANGELOG
AC_OUTPUT([Makefile])
diff --git a/utils.c b/utils.c
index 4c81e3f..8456fd2 100644
--- a/utils.c
+++ b/utils.c
@@ -32,11 +32,12 @@
#include <ctype.h>
#include <stdlib.h>
+unsigned int DEBUG_VAR;
+
/***====================================================================***/
Opaque
-uAlloc(size)
- unsigned size;
+uAlloc(unsigned size)
{
return((Opaque)malloc(size));
}
@@ -44,9 +45,7 @@ uAlloc(size)
/***====================================================================***/
Opaque
-uCalloc(n,size)
- unsigned n;
- unsigned size;
+uCalloc(unsigned n, unsigned size)
{
return((Opaque)calloc(n,size));
}
@@ -54,9 +53,7 @@ uCalloc(n,size)
/***====================================================================***/
Opaque
-uRealloc(old,newSize)
- Opaque old;
- unsigned newSize;
+uRealloc(Opaque old, unsigned newSize)
{
if (old==NULL)
return((Opaque)malloc(newSize));
@@ -66,11 +63,7 @@ uRealloc(old,newSize)
/***====================================================================***/
Opaque
-uRecalloc(old,nOld,nNew,itemSize)
- Opaque old;
- unsigned nOld;
- unsigned nNew;
- unsigned itemSize;
+uRecalloc(Opaque old, unsigned nOld, unsigned nNew, unsigned itemSize)
{
char *rtrn;
@@ -88,8 +81,7 @@ char *rtrn;
/***====================================================================***/
void
-uFree(ptr)
- Opaque ptr;
+uFree(Opaque ptr)
{
if (ptr!=(Opaque)NULL)
free((char *)ptr);
@@ -101,11 +93,10 @@ uFree(ptr)
/***====================================================================***/
static FILE *entryFile= NULL;
- int uEntryLevel;
+static int uEntryLevel;
Boolean
-uSetEntryFile(name)
- char *name;
+uSetEntryFile(char *name)
{
if ((entryFile!=NULL)&&(entryFile!=stderr)) {
fprintf(entryFile,"switching to %s\n",name?name:"stderr");
@@ -137,9 +128,7 @@ va_list ap;
}
void
-uExit(l,rtVal)
- int l;
- char * rtVal;
+uExit(int l, char *rtVal)
{
int i;
@@ -161,8 +150,7 @@ int i;
int uDebugIndentSize= 4;
Boolean
-uSetDebugFile(name)
- char *name;
+uSetDebugFile(char *name)
{
if ((uDebugFile!=NULL)&&(uDebugFile!=stderr)) {
fprintf(uDebugFile,"switching to %s\n",name?name:"stderr");
@@ -318,8 +306,7 @@ uInternalError(char *s,...)
#ifndef HAVE_STRDUP
char *
-uStringDup(str)
- char *str;
+uStringDup(char *str)
{
char *rtrn;
@@ -333,8 +320,7 @@ char *rtrn;
#ifndef HAVE_STRCASECMP
int
-uStrCaseCmp(str1, str2)
- char *str1, *str2;
+uStrCaseCmp(char *str1, char *str2)
{
char buf1[512],buf2[512];
char c, *s;
@@ -360,8 +346,7 @@ uStrCaseCmp(str1, str2)
}
int
-uStrCasePrefix(prefix, str)
- char *prefix, *str;
+uStrCasePrefix(char *prefix, char *str)
{
char c1;
char c2;
diff --git a/utils.h b/utils.h
index 70d3ca4..1f4f517 100644
--- a/utils.h
+++ b/utils.h
@@ -173,9 +173,7 @@ extern char *uStringDup(
#define DEBUG_VAR debugFlags
#endif
-#ifndef DEBUG_VAR_LOCAL
extern
-#endif
unsigned int DEBUG_VAR;
extern void uDebug( char *s, ... );
diff --git a/xkbevd.c b/xkbevd.c
index 8f9a054..fc5f8c1 100644
--- a/xkbevd.c
+++ b/xkbevd.c
@@ -58,22 +58,24 @@
/***====================================================================***/
-char * dpyName= NULL;
+static char * dpyName= NULL;
Display * dpy= NULL;
-char * cfgFileName= NULL;
+static char * cfgFileName= NULL;
int xkbOpcode= 0;
int xkbEventCode= 0;
Bool detectableRepeat= False;
+static
CfgEntryPtr config= NULL;
+static
unsigned long eventMask= 0;
-Bool synch= False;
-int verbose= 0;
-Bool background= False;
+static Bool synch= False;
+static int verbose= 0;
+static Bool background= False;
-char * soundCmd= NULL;
-char * soundDir= NULL;
+static char * soundCmd= NULL;
+static char * soundDir= NULL;
XkbDescPtr xkb= NULL;