config: s/xf86configStrdup/strdup/

This commit is contained in:
Adam Jackson 2009-04-06 17:51:35 -04:00
parent 5f769b7344
commit 485946120a
6 changed files with 24 additions and 36 deletions

View File

@ -369,14 +369,3 @@ xf86findDevice (const char *ident, XF86ConfDevicePtr p)
}
return (NULL);
}
char *
xf86configStrdup (const char *s)
{
char *tmp;
if (!s) return NULL;
tmp = xf86confmalloc (sizeof (char) * (strlen (s) + 1));
if (tmp)
strcpy (tmp, s);
return (tmp);
}

View File

@ -1,5 +1,4 @@
/*
*
* Copyright (c) 1997 Metro Link Incorporated
*
* Permission is hereby granted, free of charge, to any person obtaining a
@ -134,7 +133,7 @@ xf86parseFlagsSection (void)
{
char *valstr = NULL;
/* can't use strdup because it calls malloc */
tmp = xf86configStrdup (ServerFlagsTab[i].name);
tmp = strdup (ServerFlagsTab[i].name);
if (hasvalue)
{
tokentype = xf86getSubToken(&(ptr->flg_comment));
@ -239,11 +238,11 @@ xf86optionListDup (XF86OptionPtr opt)
while (opt)
{
newopt = xf86addNewOption(newopt, xf86configStrdup(opt->opt_name),
xf86configStrdup(opt->opt_val));
newopt = xf86addNewOption(newopt, strdup(opt->opt_name),
strdup(opt->opt_val));
newopt->opt_used = opt->opt_used;
if (opt->opt_comment)
newopt->opt_comment = xf86configStrdup(opt->opt_comment);
newopt->opt_comment = strdup(opt->opt_comment);
opt = opt->list.next;
}
return newopt;

View File

@ -115,19 +115,19 @@ xf86parsePointerSection (void)
if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
Error (QUOTE_MSG, "Protocol");
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
xf86configStrdup("Protocol"),
strdup("Protocol"),
val.str);
break;
case PDEVICE:
if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
Error (QUOTE_MSG, "Device");
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
xf86configStrdup("Device"),
strdup("Device"),
val.str);
break;
case EMULATE3:
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
xf86configStrdup("Emulate3Buttons"),
strdup("Emulate3Buttons"),
NULL);
break;
case EM3TIMEOUT:
@ -135,12 +135,12 @@ xf86parsePointerSection (void)
Error (POSITIVE_INT_MSG, "Emulate3Timeout");
s = xf86uLongToString(val.num);
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
xf86configStrdup("Emulate3Timeout"),
strdup("Emulate3Timeout"),
s);
break;
case CHORDMIDDLE:
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
xf86configStrdup("ChordMiddle"),
strdup("ChordMiddle"),
NULL);
break;
case PBUTTONS:
@ -148,36 +148,36 @@ xf86parsePointerSection (void)
Error (POSITIVE_INT_MSG, "Buttons");
s = xf86uLongToString(val.num);
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
xf86configStrdup("Buttons"), s);
strdup("Buttons"), s);
break;
case BAUDRATE:
if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
Error (POSITIVE_INT_MSG, "BaudRate");
s = xf86uLongToString(val.num);
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
xf86configStrdup("BaudRate"), s);
strdup("BaudRate"), s);
break;
case SAMPLERATE:
if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
Error (POSITIVE_INT_MSG, "SampleRate");
s = xf86uLongToString(val.num);
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
xf86configStrdup("SampleRate"), s);
strdup("SampleRate"), s);
break;
case PRESOLUTION:
if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
Error (POSITIVE_INT_MSG, "Resolution");
s = xf86uLongToString(val.num);
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
xf86configStrdup("Resolution"), s);
strdup("Resolution"), s);
break;
case CLEARDTR:
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
xf86configStrdup("ClearDTR"), NULL);
strdup("ClearDTR"), NULL);
break;
case CLEARRTS:
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
xf86configStrdup("ClearRTS"), NULL);
strdup("ClearRTS"), NULL);
break;
case ZAXISMAPPING:
switch (xf86getToken(ZMapTab)) {
@ -197,17 +197,17 @@ xf86parsePointerSection (void)
xf86conffree(s2);
break;
case XAXIS:
s = xf86configStrdup("x");
s = strdup("x");
break;
case YAXIS:
s = xf86configStrdup("y");
s = strdup("y");
break;
default:
Error (ZAXISMAPPING_MSG, NULL);
break;
}
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
xf86configStrdup("ZAxisMapping"),
strdup("ZAxisMapping"),
s);
break;
case ALWAYSCORE:
@ -221,10 +221,10 @@ xf86parsePointerSection (void)
}
}
ptr->inp_identifier = xf86configStrdup(CONF_IMPLICIT_POINTER);
ptr->inp_driver = xf86configStrdup("mouse");
ptr->inp_identifier = strdup(CONF_IMPLICIT_POINTER);
ptr->inp_driver = strdup("mouse");
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
xf86configStrdup("CorePointer"), NULL);
strdup("CorePointer"), NULL);
#ifdef DEBUG
printf ("Pointer section parsed\n");

View File

@ -544,7 +544,7 @@ xf86validateScreen (XF86ConfigPtr p)
return (FALSE);
}
adaptor->al_adaptor->va_fwdref = xf86configStrdup(screen->scrn_identifier);
adaptor->al_adaptor->va_fwdref = strdup(screen->scrn_identifier);
adaptor = adaptor->list.next;
}

View File

@ -877,7 +877,7 @@ void
xf86setBuiltinConfig(const char *config[])
{
builtinConfig = config;
configPath = xf86configStrdup("<builtin configuration>");
configPath = strdup("<builtin configuration>");
configBuf = xf86confmalloc (CONFIG_BUF_LEN);
configRBuf = xf86confmalloc (CONFIG_BUF_LEN);
configBuf[0] = '\0'; /* sanity ... */

View File

@ -64,6 +64,7 @@
#ifndef _xf86Optrec_h_
#define _xf86Optrec_h_
#include <stdio.h>
#include <string.h>
#include <X11/Xfuncproto.h>
@ -102,7 +103,6 @@ extern _X_EXPORT XF86OptionPtr xf86findOption(XF86OptionPtr list, const char *na
extern _X_EXPORT char *xf86findOptionValue(XF86OptionPtr list, const char *name);
extern _X_EXPORT XF86OptionPtr xf86optionListCreate(const char **options, int count, int used);
extern _X_EXPORT XF86OptionPtr xf86optionListMerge(XF86OptionPtr head, XF86OptionPtr tail);
extern _X_EXPORT char *xf86configStrdup (const char *s);
extern _X_EXPORT int xf86nameCompare (const char *s1, const char *s2);
extern _X_EXPORT char *xf86uLongToString(unsigned long i);
extern _X_EXPORT XF86OptionPtr xf86parseOption(XF86OptionPtr head);