summaryrefslogtreecommitdiff
path: root/hw/xfree86/parser/Pointer.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2010-11-27 22:36:44 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2010-12-07 11:10:35 -0800
commit2416255f7e3fd9190a9e01bda57c992932de4bd9 (patch)
treeab6b2a07898f737b7bfc6b5f4b5147bfb1ce6211 /hw/xfree86/parser/Pointer.c
parent03e8bfa1d122f7dea905d48c93cfd54afd991dfd (diff)
Convert hw/xfree86/parser code to use asprintf() calls
Requires linking xprintf.c into libxf86config for those who build it. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Diffstat (limited to 'hw/xfree86/parser/Pointer.c')
-rw-r--r--hw/xfree86/parser/Pointer.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/hw/xfree86/parser/Pointer.c b/hw/xfree86/parser/Pointer.c
index 56a26ba74..65397cd81 100644
--- a/hw/xfree86/parser/Pointer.c
+++ b/hw/xfree86/parser/Pointer.c
@@ -62,6 +62,7 @@
#include "xf86Parser.h"
#include "xf86tokens.h"
#include "Configint.h"
+#include "Xprintf.h"
extern LexRec val;
@@ -99,8 +100,8 @@ static xf86ConfigSymTabRec ZMapTab[] =
XF86ConfInputPtr
xf86parsePointerSection (void)
{
- char *s, *s1, *s2;
- int l;
+ char *s;
+ unsigned long val1;
int token;
parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
@@ -184,17 +185,12 @@ xf86parsePointerSection (void)
case NUMBER:
if (val.num < 0)
Error (ZAXISMAPPING_MSG, NULL);
- s1 = xf86uLongToString(val.num);
+ val1 = val.num;
if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) {
- free(s1);
Error (ZAXISMAPPING_MSG, NULL);
}
- s2 = xf86uLongToString(val.num);
- l = strlen(s1) + 1 + strlen(s2) + 1;
- s = malloc(l);
- sprintf(s, "%s %s", s1, s2);
- free(s1);
- free(s2);
+ if (asprintf(&s, "%ul %ul", val1, val.num) == -1)
+ s = NULL;
break;
case XAXIS:
s = strdup("x");