config: s/xf86configStrdup/strdup/
This commit is contained in:
parent
5f769b7344
commit
485946120a
|
@ -369,14 +369,3 @@ xf86findDevice (const char *ident, XF86ConfDevicePtr p)
|
||||||
}
|
}
|
||||||
return (NULL);
|
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);
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/*
|
/*
|
||||||
*
|
|
||||||
* Copyright (c) 1997 Metro Link Incorporated
|
* Copyright (c) 1997 Metro Link Incorporated
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
@ -134,7 +133,7 @@ xf86parseFlagsSection (void)
|
||||||
{
|
{
|
||||||
char *valstr = NULL;
|
char *valstr = NULL;
|
||||||
/* can't use strdup because it calls malloc */
|
/* can't use strdup because it calls malloc */
|
||||||
tmp = xf86configStrdup (ServerFlagsTab[i].name);
|
tmp = strdup (ServerFlagsTab[i].name);
|
||||||
if (hasvalue)
|
if (hasvalue)
|
||||||
{
|
{
|
||||||
tokentype = xf86getSubToken(&(ptr->flg_comment));
|
tokentype = xf86getSubToken(&(ptr->flg_comment));
|
||||||
|
@ -239,11 +238,11 @@ xf86optionListDup (XF86OptionPtr opt)
|
||||||
|
|
||||||
while (opt)
|
while (opt)
|
||||||
{
|
{
|
||||||
newopt = xf86addNewOption(newopt, xf86configStrdup(opt->opt_name),
|
newopt = xf86addNewOption(newopt, strdup(opt->opt_name),
|
||||||
xf86configStrdup(opt->opt_val));
|
strdup(opt->opt_val));
|
||||||
newopt->opt_used = opt->opt_used;
|
newopt->opt_used = opt->opt_used;
|
||||||
if (opt->opt_comment)
|
if (opt->opt_comment)
|
||||||
newopt->opt_comment = xf86configStrdup(opt->opt_comment);
|
newopt->opt_comment = strdup(opt->opt_comment);
|
||||||
opt = opt->list.next;
|
opt = opt->list.next;
|
||||||
}
|
}
|
||||||
return newopt;
|
return newopt;
|
||||||
|
|
|
@ -115,19 +115,19 @@ xf86parsePointerSection (void)
|
||||||
if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
|
if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
|
||||||
Error (QUOTE_MSG, "Protocol");
|
Error (QUOTE_MSG, "Protocol");
|
||||||
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
||||||
xf86configStrdup("Protocol"),
|
strdup("Protocol"),
|
||||||
val.str);
|
val.str);
|
||||||
break;
|
break;
|
||||||
case PDEVICE:
|
case PDEVICE:
|
||||||
if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
|
if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
|
||||||
Error (QUOTE_MSG, "Device");
|
Error (QUOTE_MSG, "Device");
|
||||||
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
||||||
xf86configStrdup("Device"),
|
strdup("Device"),
|
||||||
val.str);
|
val.str);
|
||||||
break;
|
break;
|
||||||
case EMULATE3:
|
case EMULATE3:
|
||||||
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
||||||
xf86configStrdup("Emulate3Buttons"),
|
strdup("Emulate3Buttons"),
|
||||||
NULL);
|
NULL);
|
||||||
break;
|
break;
|
||||||
case EM3TIMEOUT:
|
case EM3TIMEOUT:
|
||||||
|
@ -135,12 +135,12 @@ xf86parsePointerSection (void)
|
||||||
Error (POSITIVE_INT_MSG, "Emulate3Timeout");
|
Error (POSITIVE_INT_MSG, "Emulate3Timeout");
|
||||||
s = xf86uLongToString(val.num);
|
s = xf86uLongToString(val.num);
|
||||||
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
||||||
xf86configStrdup("Emulate3Timeout"),
|
strdup("Emulate3Timeout"),
|
||||||
s);
|
s);
|
||||||
break;
|
break;
|
||||||
case CHORDMIDDLE:
|
case CHORDMIDDLE:
|
||||||
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
||||||
xf86configStrdup("ChordMiddle"),
|
strdup("ChordMiddle"),
|
||||||
NULL);
|
NULL);
|
||||||
break;
|
break;
|
||||||
case PBUTTONS:
|
case PBUTTONS:
|
||||||
|
@ -148,36 +148,36 @@ xf86parsePointerSection (void)
|
||||||
Error (POSITIVE_INT_MSG, "Buttons");
|
Error (POSITIVE_INT_MSG, "Buttons");
|
||||||
s = xf86uLongToString(val.num);
|
s = xf86uLongToString(val.num);
|
||||||
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
||||||
xf86configStrdup("Buttons"), s);
|
strdup("Buttons"), s);
|
||||||
break;
|
break;
|
||||||
case BAUDRATE:
|
case BAUDRATE:
|
||||||
if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
|
if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
|
||||||
Error (POSITIVE_INT_MSG, "BaudRate");
|
Error (POSITIVE_INT_MSG, "BaudRate");
|
||||||
s = xf86uLongToString(val.num);
|
s = xf86uLongToString(val.num);
|
||||||
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
||||||
xf86configStrdup("BaudRate"), s);
|
strdup("BaudRate"), s);
|
||||||
break;
|
break;
|
||||||
case SAMPLERATE:
|
case SAMPLERATE:
|
||||||
if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
|
if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
|
||||||
Error (POSITIVE_INT_MSG, "SampleRate");
|
Error (POSITIVE_INT_MSG, "SampleRate");
|
||||||
s = xf86uLongToString(val.num);
|
s = xf86uLongToString(val.num);
|
||||||
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
||||||
xf86configStrdup("SampleRate"), s);
|
strdup("SampleRate"), s);
|
||||||
break;
|
break;
|
||||||
case PRESOLUTION:
|
case PRESOLUTION:
|
||||||
if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
|
if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
|
||||||
Error (POSITIVE_INT_MSG, "Resolution");
|
Error (POSITIVE_INT_MSG, "Resolution");
|
||||||
s = xf86uLongToString(val.num);
|
s = xf86uLongToString(val.num);
|
||||||
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
||||||
xf86configStrdup("Resolution"), s);
|
strdup("Resolution"), s);
|
||||||
break;
|
break;
|
||||||
case CLEARDTR:
|
case CLEARDTR:
|
||||||
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
||||||
xf86configStrdup("ClearDTR"), NULL);
|
strdup("ClearDTR"), NULL);
|
||||||
break;
|
break;
|
||||||
case CLEARRTS:
|
case CLEARRTS:
|
||||||
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
||||||
xf86configStrdup("ClearRTS"), NULL);
|
strdup("ClearRTS"), NULL);
|
||||||
break;
|
break;
|
||||||
case ZAXISMAPPING:
|
case ZAXISMAPPING:
|
||||||
switch (xf86getToken(ZMapTab)) {
|
switch (xf86getToken(ZMapTab)) {
|
||||||
|
@ -197,17 +197,17 @@ xf86parsePointerSection (void)
|
||||||
xf86conffree(s2);
|
xf86conffree(s2);
|
||||||
break;
|
break;
|
||||||
case XAXIS:
|
case XAXIS:
|
||||||
s = xf86configStrdup("x");
|
s = strdup("x");
|
||||||
break;
|
break;
|
||||||
case YAXIS:
|
case YAXIS:
|
||||||
s = xf86configStrdup("y");
|
s = strdup("y");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Error (ZAXISMAPPING_MSG, NULL);
|
Error (ZAXISMAPPING_MSG, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
||||||
xf86configStrdup("ZAxisMapping"),
|
strdup("ZAxisMapping"),
|
||||||
s);
|
s);
|
||||||
break;
|
break;
|
||||||
case ALWAYSCORE:
|
case ALWAYSCORE:
|
||||||
|
@ -221,10 +221,10 @@ xf86parsePointerSection (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr->inp_identifier = xf86configStrdup(CONF_IMPLICIT_POINTER);
|
ptr->inp_identifier = strdup(CONF_IMPLICIT_POINTER);
|
||||||
ptr->inp_driver = xf86configStrdup("mouse");
|
ptr->inp_driver = strdup("mouse");
|
||||||
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
|
||||||
xf86configStrdup("CorePointer"), NULL);
|
strdup("CorePointer"), NULL);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf ("Pointer section parsed\n");
|
printf ("Pointer section parsed\n");
|
||||||
|
|
|
@ -544,7 +544,7 @@ xf86validateScreen (XF86ConfigPtr p)
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
adaptor->al_adaptor->va_fwdref = xf86configStrdup(screen->scrn_identifier);
|
adaptor->al_adaptor->va_fwdref = strdup(screen->scrn_identifier);
|
||||||
adaptor = adaptor->list.next;
|
adaptor = adaptor->list.next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -877,7 +877,7 @@ void
|
||||||
xf86setBuiltinConfig(const char *config[])
|
xf86setBuiltinConfig(const char *config[])
|
||||||
{
|
{
|
||||||
builtinConfig = config;
|
builtinConfig = config;
|
||||||
configPath = xf86configStrdup("<builtin configuration>");
|
configPath = strdup("<builtin configuration>");
|
||||||
configBuf = xf86confmalloc (CONFIG_BUF_LEN);
|
configBuf = xf86confmalloc (CONFIG_BUF_LEN);
|
||||||
configRBuf = xf86confmalloc (CONFIG_BUF_LEN);
|
configRBuf = xf86confmalloc (CONFIG_BUF_LEN);
|
||||||
configBuf[0] = '\0'; /* sanity ... */
|
configBuf[0] = '\0'; /* sanity ... */
|
||||||
|
|
|
@ -64,6 +64,7 @@
|
||||||
#ifndef _xf86Optrec_h_
|
#ifndef _xf86Optrec_h_
|
||||||
#define _xf86Optrec_h_
|
#define _xf86Optrec_h_
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include <X11/Xfuncproto.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 char *xf86findOptionValue(XF86OptionPtr list, const char *name);
|
||||||
extern _X_EXPORT XF86OptionPtr xf86optionListCreate(const char **options, int count, int used);
|
extern _X_EXPORT XF86OptionPtr xf86optionListCreate(const char **options, int count, int used);
|
||||||
extern _X_EXPORT XF86OptionPtr xf86optionListMerge(XF86OptionPtr head, XF86OptionPtr tail);
|
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 int xf86nameCompare (const char *s1, const char *s2);
|
||||||
extern _X_EXPORT char *xf86uLongToString(unsigned long i);
|
extern _X_EXPORT char *xf86uLongToString(unsigned long i);
|
||||||
extern _X_EXPORT XF86OptionPtr xf86parseOption(XF86OptionPtr head);
|
extern _X_EXPORT XF86OptionPtr xf86parseOption(XF86OptionPtr head);
|
||||||
|
|
Loading…
Reference in New Issue