Convert cvt code to use XNFasprintf()

Requires linking xprintf.c into standalone cvt utility

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
This commit is contained in:
Alan Coopersmith 2010-11-28 09:41:17 -08:00
parent d2c42b1027
commit 446482efaa
3 changed files with 23 additions and 10 deletions

View File

@ -279,15 +279,7 @@ xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
if (Interlaced)
Mode->VTotal *= 2;
{
char Name[256];
Name[0] = 0;
snprintf(Name, 256, "%dx%d", HDisplay, VDisplay);
Mode->name = xnfalloc(strlen(Name) + 1);
memcpy(Mode->name, Name, strlen(Name) + 1);
}
XNFasprintf(&Mode->name, "%dx%d", HDisplay, VDisplay);
if (Reduced)
Mode->Flags |= V_PHSYNC | V_NVSYNC;

View File

@ -27,7 +27,10 @@ INCLUDES = $(XORG_INCS) \
-I$(top_srcdir)/hw/xfree86/parser
# gah
cvt_SOURCES = cvt.c $(top_srcdir)/hw/xfree86/modes/xf86cvt.c
cvt_SOURCES = cvt.c \
$(top_srcdir)/hw/xfree86/modes/xf86cvt.c \
$(top_srcdir)/os/xprintf.c
cvt_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
man1_MANS = cvt.man

View File

@ -25,6 +25,24 @@
#include "xf86.h"
/* Error implementation used by the server code we built in */
void
Error(const char *str)
{
perror(str);
}
/* FatalError implementation used by the server code we built in */
void
FatalError(const char *f, ...)
{
va_list args;
va_start(args, f);
vfprintf(stderr, f, args);
va_end(args);
exit(1);
}
/* xnfalloc implementation used by the server code we built in */
pointer
XNFalloc(unsigned long n)