aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/dmx/config
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/dmx/config')
-rw-r--r--xorg-server/hw/dmx/config/dmxparse.h3
-rw-r--r--xorg-server/hw/dmx/config/dmxprint.c20
2 files changed, 6 insertions, 17 deletions
diff --git a/xorg-server/hw/dmx/config/dmxparse.h b/xorg-server/hw/dmx/config/dmxparse.h
index 7d31b6309..cc2f0eb71 100644
--- a/xorg-server/hw/dmx/config/dmxparse.h
+++ b/xorg-server/hw/dmx/config/dmxparse.h
@@ -38,6 +38,7 @@
#define _DMXPARSE_H_
#include <stdio.h> /* For FILE */
+#include <X11/Xfuncproto.h> /* For _X_ATTRIBUTE_PRINTF */
/** Stores tokens not stored in other structures (e.g., keywords and ;) */
typedef struct _DMXConfigToken {
@@ -203,7 +204,7 @@ extern int yylex(void);
extern int yydebug;
extern void yyerror(const char *message);
-extern void dmxConfigLog(const char *format, ...);
+extern void dmxConfigLog(const char *format, ...) _X_ATTRIBUTE_PRINTF(1,0);
extern void *dmxConfigAlloc(unsigned long bytes);
extern void *dmxConfigRealloc(void *orig,
unsigned long orig_bytes, unsigned long bytes);
diff --git a/xorg-server/hw/dmx/config/dmxprint.c b/xorg-server/hw/dmx/config/dmxprint.c
index 9dec52b5c..c80e830e4 100644
--- a/xorg-server/hw/dmx/config/dmxprint.c
+++ b/xorg-server/hw/dmx/config/dmxprint.c
@@ -130,7 +130,7 @@ dmxConfigPopState(void)
dmxConfigNewline();
}
-static void
+static void _X_ATTRIBUTE_PRINTF(4, 5)
dmxConfigOutput(int addSpace, int doNewline, const char *comment,
const char *format, ...)
{
@@ -261,32 +261,20 @@ dmxConfigPrintString(DMXConfigStringPtr p, int quote)
static int
dmxConfigPrintPair(DMXConfigPairPtr p, int addSpace)
{
- const char *format = NULL;
-
if (!p)
return 0;
- switch (p->token) {
- case T_ORIGIN:
- format = "@%dx%d";
- break;
- case T_DIMENSION:
- format = "%dx%d";
- break;
- case T_OFFSET:
- format = "%c%d%c%d";
- break;
- }
if (p->token == T_OFFSET) {
if (!p->comment && !p->x && !p->y && p->xsign >= 0 && p->ysign >= 0)
return 0;
- dmxConfigOutput(addSpace, 0, p->comment, format,
+ dmxConfigOutput(addSpace, 0, p->comment, "%c%d%c%d",
p->xsign < 0 ? '-' : '+', p->x,
p->ysign < 0 ? '-' : '+', p->y);
}
else {
if (!p->comment && !p->x && !p->y)
return 0;
- dmxConfigOutput(addSpace, 0, p->comment, format, p->x, p->y);
+ dmxConfigOutput(addSpace, 0, p->comment, "%s%dx%d",
+ (p->token == T_ORIGIN) ? "@" : "", p->x, p->y);
}
return 1;
}