config: Remove useless xf86conf{{m,c,re}alloc},free} macros
This commit is contained in:
parent
485946120a
commit
69e73e5ce0
|
@ -260,7 +260,7 @@ configureInputSection (void)
|
|||
#endif
|
||||
}
|
||||
|
||||
mouse = xf86confcalloc(1, sizeof(XF86ConfInputRec));
|
||||
mouse = calloc(1, sizeof(XF86ConfInputRec));
|
||||
mouse->inp_identifier = "Mouse0";
|
||||
mouse->inp_driver = "mouse";
|
||||
mouse->inp_option_lst =
|
||||
|
@ -285,18 +285,18 @@ configureScreenSection (int screennum)
|
|||
int depths[] = { 1, 4, 8, 15, 16, 24/*, 32*/ };
|
||||
parsePrologue (XF86ConfScreenPtr, XF86ConfScreenRec)
|
||||
|
||||
ptr->scrn_identifier = xf86confmalloc(18);
|
||||
ptr->scrn_identifier = malloc(18);
|
||||
sprintf(ptr->scrn_identifier, "Screen%d", screennum);
|
||||
ptr->scrn_monitor_str = xf86confmalloc(19);
|
||||
ptr->scrn_monitor_str = malloc(19);
|
||||
sprintf(ptr->scrn_monitor_str, "Monitor%d", screennum);
|
||||
ptr->scrn_device_str = xf86confmalloc(16);
|
||||
ptr->scrn_device_str = malloc(16);
|
||||
sprintf(ptr->scrn_device_str, "Card%d", screennum);
|
||||
|
||||
for (i=0; i<sizeof(depths)/sizeof(depths[0]); i++)
|
||||
{
|
||||
XF86ConfDisplayPtr display;
|
||||
|
||||
display = xf86confcalloc(1, sizeof(XF86ConfDisplayRec));
|
||||
display = calloc(1, sizeof(XF86ConfDisplayRec));
|
||||
display->disp_depth = depths[i];
|
||||
display->disp_black.red = display->disp_white.red = -1;
|
||||
display->disp_black.green = display->disp_white.green = -1;
|
||||
|
@ -419,7 +419,7 @@ configureLayoutSection (void)
|
|||
{
|
||||
XF86ConfInputrefPtr iptr;
|
||||
|
||||
iptr = xf86confmalloc (sizeof (XF86ConfInputrefRec));
|
||||
iptr = malloc (sizeof (XF86ConfInputrefRec));
|
||||
iptr->list.next = NULL;
|
||||
iptr->iref_option_lst = NULL;
|
||||
iptr->iref_inputdev_str = "Mouse0";
|
||||
|
@ -432,7 +432,7 @@ configureLayoutSection (void)
|
|||
{
|
||||
XF86ConfInputrefPtr iptr;
|
||||
|
||||
iptr = xf86confmalloc (sizeof (XF86ConfInputrefRec));
|
||||
iptr = malloc (sizeof (XF86ConfInputrefRec));
|
||||
iptr->list.next = NULL;
|
||||
iptr->iref_option_lst = NULL;
|
||||
iptr->iref_inputdev_str = "Keyboard0";
|
||||
|
@ -445,7 +445,7 @@ configureLayoutSection (void)
|
|||
for (scrnum = 0; scrnum < nDevToConfig; scrnum++) {
|
||||
XF86ConfAdjacencyPtr aptr;
|
||||
|
||||
aptr = xf86confmalloc (sizeof (XF86ConfAdjacencyRec));
|
||||
aptr = malloc (sizeof (XF86ConfAdjacencyRec));
|
||||
aptr->list.next = NULL;
|
||||
aptr->adj_x = 0;
|
||||
aptr->adj_y = 0;
|
||||
|
@ -494,7 +494,7 @@ configureModuleSection (void)
|
|||
for (el = elist; *el; el++) {
|
||||
XF86LoadPtr module;
|
||||
|
||||
module = xf86confcalloc(1, sizeof(XF86LoadRec));
|
||||
module = calloc(1, sizeof(XF86LoadRec));
|
||||
module->load_name = *el;
|
||||
ptr->mod_load_lst = (XF86LoadPtr)xf86addListItem(
|
||||
(glp)ptr->mod_load_lst, (glp)module);
|
||||
|
@ -523,7 +523,7 @@ configureMonitorSection (int screennum)
|
|||
{
|
||||
parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
|
||||
|
||||
ptr->mon_identifier = xf86confmalloc(19);
|
||||
ptr->mon_identifier = malloc(19);
|
||||
sprintf(ptr->mon_identifier, "Monitor%d", screennum);
|
||||
ptr->mon_vendor = strdup("Monitor Vendor");
|
||||
ptr->mon_modelname = strdup("Monitor Model");
|
||||
|
@ -542,10 +542,10 @@ configureDDCMonitorSection (int screennum)
|
|||
|
||||
parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
|
||||
|
||||
ptr->mon_identifier = xf86confmalloc(19);
|
||||
ptr->mon_identifier = malloc(19);
|
||||
sprintf(ptr->mon_identifier, "Monitor%d", screennum);
|
||||
ptr->mon_vendor = strdup(ConfiguredMonitor->vendor.name);
|
||||
ptr->mon_modelname = xf86confmalloc(12);
|
||||
ptr->mon_modelname = malloc(12);
|
||||
sprintf(ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id);
|
||||
|
||||
/* features in centimetres, we want millimetres */
|
||||
|
@ -570,8 +570,7 @@ configureDDCMonitorSection (int screennum)
|
|||
len = 0;
|
||||
}
|
||||
if ((ptr->mon_comment =
|
||||
xf86confrealloc(ptr->mon_comment,
|
||||
len+strlen(displaySize_string)))) {
|
||||
realloc(ptr->mon_comment, len+strlen(displaySize_string)))) {
|
||||
strcpy(ptr->mon_comment + len, displaySize_string);
|
||||
}
|
||||
}
|
||||
|
@ -581,7 +580,7 @@ configureDDCMonitorSection (int screennum)
|
|||
for (i=0;i<4;i++) {
|
||||
switch (ConfiguredMonitor->det_mon[i].type) {
|
||||
case DS_NAME:
|
||||
ptr->mon_modelname = xf86confrealloc(ptr->mon_modelname,
|
||||
ptr->mon_modelname = realloc(ptr->mon_modelname,
|
||||
strlen((char*)(ConfiguredMonitor->det_mon[i].section.name))
|
||||
+ 1);
|
||||
strcpy(ptr->mon_modelname,
|
||||
|
|
|
@ -92,18 +92,14 @@ LexRec, *LexPtr;
|
|||
|
||||
#include "configProcs.h"
|
||||
#include <stdlib.h>
|
||||
#define xf86confmalloc malloc
|
||||
#define xf86confrealloc realloc
|
||||
#define xf86confcalloc calloc
|
||||
#define xf86conffree free
|
||||
|
||||
#define TestFree(a) if (a) { xf86conffree (a); a = NULL; }
|
||||
#define TestFree(a) if (a) { free (a); a = NULL; }
|
||||
|
||||
#define parsePrologue(typeptr,typerec) typeptr ptr; \
|
||||
if( (ptr=(typeptr)xf86confcalloc(1,sizeof(typerec))) == NULL ) { return NULL; }
|
||||
if( (ptr=calloc(1,sizeof(typerec))) == NULL ) { return NULL; }
|
||||
|
||||
#define parsePrologueVoid(typeptr,typerec) int token; typeptr ptr; \
|
||||
if( (ptr=(typeptr)xf86confcalloc(1,sizeof(typerec))) == NULL ) { return; }
|
||||
if( (ptr=calloc(1,sizeof(typerec))) == NULL ) { return; }
|
||||
|
||||
#define HANDLE_RETURN(f,func)\
|
||||
if ((ptr->f=func) == NULL)\
|
||||
|
|
|
@ -58,7 +58,7 @@ xf86freeBuffersList (XF86ConfBuffersPtr ptr)
|
|||
TestFree (ptr->buf_comment);
|
||||
prev = ptr;
|
||||
ptr = ptr->list.next;
|
||||
xf86conffree (prev);
|
||||
free (prev);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,5 +183,5 @@ xf86freeDRI (XF86ConfDRIPtr ptr)
|
|||
|
||||
xf86freeBuffersList (ptr->dri_buffers_lst);
|
||||
TestFree (ptr->dri_comment);
|
||||
xf86conffree (ptr);
|
||||
free (ptr);
|
||||
}
|
||||
|
|
|
@ -353,7 +353,7 @@ xf86freeDeviceList (XF86ConfDevicePtr ptr)
|
|||
|
||||
prev = ptr;
|
||||
ptr = ptr->list.next;
|
||||
xf86conffree (prev);
|
||||
free (prev);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -107,5 +107,5 @@ xf86freeExtensions (XF86ConfExtensionsPtr ptr)
|
|||
|
||||
xf86optionListFree (ptr->ext_option_lst);
|
||||
TestFree (ptr->extensions_comment);
|
||||
xf86conffree (ptr);
|
||||
free (ptr);
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ xf86parseFilesSection (void)
|
|||
str = val.str;
|
||||
if (ptr->file_fontpath == NULL)
|
||||
{
|
||||
ptr->file_fontpath = xf86confmalloc (1);
|
||||
ptr->file_fontpath = malloc (1);
|
||||
ptr->file_fontpath[0] = '\0';
|
||||
i = strlen (str) + 1;
|
||||
}
|
||||
|
@ -117,12 +117,12 @@ xf86parseFilesSection (void)
|
|||
}
|
||||
}
|
||||
ptr->file_fontpath =
|
||||
xf86confrealloc (ptr->file_fontpath, i);
|
||||
realloc (ptr->file_fontpath, i);
|
||||
if (j)
|
||||
strcat (ptr->file_fontpath, ",");
|
||||
|
||||
strcat (ptr->file_fontpath, str);
|
||||
xf86conffree (val.str);
|
||||
free (val.str);
|
||||
break;
|
||||
case MODULEPATH:
|
||||
if (xf86getSubToken (&(ptr->file_comment)) != STRING)
|
||||
|
@ -131,7 +131,7 @@ xf86parseFilesSection (void)
|
|||
str = val.str;
|
||||
if (ptr->file_modulepath == NULL)
|
||||
{
|
||||
ptr->file_modulepath = xf86confmalloc (1);
|
||||
ptr->file_modulepath = malloc (1);
|
||||
ptr->file_modulepath[0] = '\0';
|
||||
k = strlen (str) + 1;
|
||||
}
|
||||
|
@ -144,12 +144,12 @@ xf86parseFilesSection (void)
|
|||
l = TRUE;
|
||||
}
|
||||
}
|
||||
ptr->file_modulepath = xf86confrealloc (ptr->file_modulepath, k);
|
||||
ptr->file_modulepath = realloc (ptr->file_modulepath, k);
|
||||
if (l)
|
||||
strcat (ptr->file_modulepath, ",");
|
||||
|
||||
strcat (ptr->file_modulepath, str);
|
||||
xf86conffree (val.str);
|
||||
free (val.str);
|
||||
break;
|
||||
case LOGFILEPATH:
|
||||
if (xf86getSubToken (&(ptr->file_comment)) != STRING)
|
||||
|
@ -241,5 +241,5 @@ xf86freeFiles (XF86ConfFilesPtr p)
|
|||
TestFree (p->file_comment);
|
||||
TestFree (p->file_xkbdir);
|
||||
|
||||
xf86conffree (p);
|
||||
free (p);
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ xf86parseFlagsSection (void)
|
|||
} else {
|
||||
if (tokentype != NUMBER)
|
||||
Error (NUMBER_MSG, tmp);
|
||||
valstr = xf86confmalloc(16);
|
||||
valstr = malloc(16);
|
||||
if (valstr)
|
||||
sprintf(valstr, "%d", val.num);
|
||||
}
|
||||
|
@ -201,11 +201,11 @@ addNewOption2 (XF86OptionPtr head, char *name, char *val, int used)
|
|||
/* Don't allow duplicates, free old strings */
|
||||
if (head != NULL && (old = xf86findOption(head, name)) != NULL) {
|
||||
new = old;
|
||||
xf86conffree(new->opt_name);
|
||||
xf86conffree(new->opt_val);
|
||||
free(new->opt_name);
|
||||
free(new->opt_val);
|
||||
}
|
||||
else
|
||||
new = xf86confcalloc (1, sizeof (XF86OptionRec));
|
||||
new = calloc (1, sizeof (XF86OptionRec));
|
||||
new->opt_name = name;
|
||||
new->opt_val = val;
|
||||
new->opt_used = used;
|
||||
|
@ -228,7 +228,7 @@ xf86freeFlags (XF86ConfFlagsPtr flags)
|
|||
return;
|
||||
xf86optionListFree (flags->flg_option_lst);
|
||||
TestFree(flags->flg_comment);
|
||||
xf86conffree (flags);
|
||||
free (flags);
|
||||
}
|
||||
|
||||
XF86OptionPtr
|
||||
|
@ -260,7 +260,7 @@ xf86optionListFree (XF86OptionPtr opt)
|
|||
TestFree (opt->opt_comment);
|
||||
prev = opt;
|
||||
opt = opt->list.next;
|
||||
xf86conffree (prev);
|
||||
free (prev);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -285,7 +285,7 @@ xf86newOption(char *name, char *value)
|
|||
{
|
||||
XF86OptionPtr opt;
|
||||
|
||||
opt = xf86confcalloc(1, sizeof (XF86OptionRec));
|
||||
opt = calloc(1, sizeof (XF86OptionRec));
|
||||
if (!opt)
|
||||
return NULL;
|
||||
|
||||
|
@ -365,10 +365,10 @@ xf86optionListCreate( const char **options, int count, int used )
|
|||
for (i = 0; i < count; i += 2)
|
||||
{
|
||||
/* can't use strdup because it calls malloc */
|
||||
t1 = xf86confmalloc (sizeof (char) *
|
||||
t1 = malloc (sizeof (char) *
|
||||
(strlen (options[i]) + 1));
|
||||
strcpy (t1, options[i]);
|
||||
t2 = xf86confmalloc (sizeof (char) *
|
||||
t2 = malloc (sizeof (char) *
|
||||
(strlen (options[i + 1]) + 1));
|
||||
strcpy (t2, options[i + 1]);
|
||||
p = addNewOption2 (p, t1, t2, used);
|
||||
|
@ -434,7 +434,7 @@ xf86uLongToString(unsigned long i)
|
|||
int l;
|
||||
|
||||
l = (int)(ceil(log10((double)i) + 2.5));
|
||||
s = xf86confmalloc(l);
|
||||
s = malloc(l);
|
||||
if (!s)
|
||||
return NULL;
|
||||
sprintf(s, "%lu", i);
|
||||
|
@ -451,7 +451,7 @@ xf86parseOption(XF86OptionPtr head)
|
|||
if ((token = xf86getSubToken(&comment)) != STRING) {
|
||||
xf86parseError(BAD_OPTION_MSG, NULL);
|
||||
if (comment)
|
||||
xf86conffree(comment);
|
||||
free(comment);
|
||||
return (head);
|
||||
}
|
||||
|
||||
|
@ -478,10 +478,10 @@ xf86parseOption(XF86OptionPtr head)
|
|||
/* Don't allow duplicates */
|
||||
if (head != NULL && (old = xf86findOption(head, name)) != NULL) {
|
||||
cnew = old;
|
||||
xf86conffree(option->opt_name);
|
||||
free(option->opt_name);
|
||||
TestFree(option->opt_val);
|
||||
TestFree(option->opt_comment);
|
||||
xf86conffree(option);
|
||||
free(option);
|
||||
}
|
||||
else
|
||||
cnew = option;
|
||||
|
|
|
@ -163,7 +163,7 @@ xf86freeInputList (XF86ConfInputPtr ptr)
|
|||
|
||||
prev = ptr;
|
||||
ptr = ptr->list.next;
|
||||
xf86conffree (prev);
|
||||
free (prev);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -116,10 +116,10 @@ xf86parseLayoutSection (void)
|
|||
{
|
||||
XF86ConfInactivePtr iptr;
|
||||
|
||||
iptr = xf86confcalloc (1, sizeof (XF86ConfInactiveRec));
|
||||
iptr = calloc (1, sizeof (XF86ConfInactiveRec));
|
||||
iptr->list.next = NULL;
|
||||
if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
|
||||
xf86conffree (iptr);
|
||||
free (iptr);
|
||||
Error (INACTIVE_MSG, NULL);
|
||||
}
|
||||
iptr->inactive_device_str = val.str;
|
||||
|
@ -132,7 +132,7 @@ xf86parseLayoutSection (void)
|
|||
XF86ConfAdjacencyPtr aptr;
|
||||
int absKeyword = 0;
|
||||
|
||||
aptr = xf86confcalloc (1, sizeof (XF86ConfAdjacencyRec));
|
||||
aptr = calloc (1, sizeof (XF86ConfAdjacencyRec));
|
||||
aptr->list.next = NULL;
|
||||
aptr->adj_scrnum = -1;
|
||||
aptr->adj_where = CONF_ADJ_OBSOLETE;
|
||||
|
@ -145,7 +145,7 @@ xf86parseLayoutSection (void)
|
|||
xf86unGetToken (token);
|
||||
token = xf86getSubToken(&(ptr->lay_comment));
|
||||
if (token != STRING) {
|
||||
xf86conffree(aptr);
|
||||
free(aptr);
|
||||
Error (SCREEN_MSG, NULL);
|
||||
}
|
||||
aptr->adj_screen_str = val.str;
|
||||
|
@ -173,7 +173,7 @@ xf86parseLayoutSection (void)
|
|||
absKeyword = 1;
|
||||
break;
|
||||
case EOF_TOKEN:
|
||||
xf86conffree(aptr);
|
||||
free(aptr);
|
||||
Error (UNEXPECTED_EOF_MSG, NULL);
|
||||
break;
|
||||
default:
|
||||
|
@ -194,13 +194,13 @@ xf86parseLayoutSection (void)
|
|||
aptr->adj_x = val.num;
|
||||
token = xf86getSubToken(&(ptr->lay_comment));
|
||||
if (token != NUMBER) {
|
||||
xf86conffree(aptr);
|
||||
free(aptr);
|
||||
Error(INVALID_SCR_MSG, NULL);
|
||||
}
|
||||
aptr->adj_y = val.num;
|
||||
} else {
|
||||
if (absKeyword) {
|
||||
xf86conffree(aptr);
|
||||
free(aptr);
|
||||
Error(INVALID_SCR_MSG, NULL);
|
||||
} else
|
||||
xf86unGetToken (token);
|
||||
|
@ -213,7 +213,7 @@ xf86parseLayoutSection (void)
|
|||
case CONF_ADJ_RELATIVE:
|
||||
token = xf86getSubToken(&(ptr->lay_comment));
|
||||
if (token != STRING) {
|
||||
xf86conffree(aptr);
|
||||
free(aptr);
|
||||
Error(INVALID_SCR_MSG, NULL);
|
||||
}
|
||||
aptr->adj_refscreen = val.str;
|
||||
|
@ -221,13 +221,13 @@ xf86parseLayoutSection (void)
|
|||
{
|
||||
token = xf86getSubToken(&(ptr->lay_comment));
|
||||
if (token != NUMBER) {
|
||||
xf86conffree(aptr);
|
||||
free(aptr);
|
||||
Error(INVALID_SCR_MSG, NULL);
|
||||
}
|
||||
aptr->adj_x = val.num;
|
||||
token = xf86getSubToken(&(ptr->lay_comment));
|
||||
if (token != NUMBER) {
|
||||
xf86conffree(aptr);
|
||||
free(aptr);
|
||||
Error(INVALID_SCR_MSG, NULL);
|
||||
}
|
||||
aptr->adj_y = val.num;
|
||||
|
@ -239,21 +239,21 @@ xf86parseLayoutSection (void)
|
|||
|
||||
/* bottom */
|
||||
if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
|
||||
xf86conffree(aptr);
|
||||
free(aptr);
|
||||
Error (SCREEN_MSG, NULL);
|
||||
}
|
||||
aptr->adj_bottom_str = val.str;
|
||||
|
||||
/* left */
|
||||
if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
|
||||
xf86conffree(aptr);
|
||||
free(aptr);
|
||||
Error (SCREEN_MSG, NULL);
|
||||
}
|
||||
aptr->adj_left_str = val.str;
|
||||
|
||||
/* right */
|
||||
if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
|
||||
xf86conffree(aptr);
|
||||
free(aptr);
|
||||
Error (SCREEN_MSG, NULL);
|
||||
}
|
||||
aptr->adj_right_str = val.str;
|
||||
|
@ -267,11 +267,11 @@ xf86parseLayoutSection (void)
|
|||
{
|
||||
XF86ConfInputrefPtr iptr;
|
||||
|
||||
iptr = xf86confcalloc (1, sizeof (XF86ConfInputrefRec));
|
||||
iptr = calloc (1, sizeof (XF86ConfInputrefRec));
|
||||
iptr->list.next = NULL;
|
||||
iptr->iref_option_lst = NULL;
|
||||
if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
|
||||
xf86conffree(iptr);
|
||||
free(iptr);
|
||||
Error (INPUTDEV_MSG, NULL);
|
||||
}
|
||||
iptr->iref_inputdev_str = val.str;
|
||||
|
@ -397,7 +397,7 @@ xf86freeAdjacencyList (XF86ConfAdjacencyPtr ptr)
|
|||
|
||||
prev = ptr;
|
||||
ptr = ptr->list.next;
|
||||
xf86conffree (prev);
|
||||
free (prev);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -413,7 +413,7 @@ xf86freeInputrefList (XF86ConfInputrefPtr ptr)
|
|||
xf86optionListFree (ptr->iref_option_lst);
|
||||
prev = ptr;
|
||||
ptr = ptr->list.next;
|
||||
xf86conffree (prev);
|
||||
free (prev);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -431,7 +431,7 @@ xf86freeLayoutList (XF86ConfLayoutPtr ptr)
|
|||
xf86freeInputrefList (ptr->lay_input_lst);
|
||||
prev = ptr;
|
||||
ptr = ptr->list.next;
|
||||
xf86conffree (prev);
|
||||
free (prev);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -108,11 +108,11 @@ xf86parseModuleSubSection (XF86LoadPtr head, char *name)
|
|||
break;
|
||||
case EOF_TOKEN:
|
||||
xf86parseError (UNEXPECTED_EOF_MSG, NULL);
|
||||
xf86conffree(ptr);
|
||||
free(ptr);
|
||||
return NULL;
|
||||
default:
|
||||
xf86parseError (INVALID_KEYWORD_MSG, xf86tokenString ());
|
||||
xf86conffree(ptr);
|
||||
free(ptr);
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ xf86addNewLoadDirective (XF86LoadPtr head, char *name, int type, XF86OptionPtr o
|
|||
XF86LoadPtr new;
|
||||
int token;
|
||||
|
||||
new = xf86confcalloc (1, sizeof (XF86LoadRec));
|
||||
new = calloc (1, sizeof (XF86LoadRec));
|
||||
new->load_name = name;
|
||||
new->load_type = type;
|
||||
new->load_opt = opts;
|
||||
|
@ -263,7 +263,7 @@ xf86freeModules (XF86ConfModulePtr ptr)
|
|||
TestFree (lptr->load_comment);
|
||||
prev = lptr;
|
||||
lptr = lptr->list.next;
|
||||
xf86conffree (prev);
|
||||
free (prev);
|
||||
}
|
||||
lptr = ptr->mod_disable_lst;
|
||||
while (lptr)
|
||||
|
@ -272,8 +272,8 @@ xf86freeModules (XF86ConfModulePtr ptr)
|
|||
TestFree (lptr->load_comment);
|
||||
prev = lptr;
|
||||
lptr = lptr->list.next;
|
||||
xf86conffree (prev);
|
||||
free (prev);
|
||||
}
|
||||
TestFree (ptr->mod_comment);
|
||||
xf86conffree (ptr);
|
||||
free (ptr);
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ xf86freeModeLineList (XF86ConfModeLinePtr ptr)
|
|||
TestFree (ptr->ml_comment);
|
||||
prev = ptr;
|
||||
ptr = ptr->list.next;
|
||||
xf86conffree (prev);
|
||||
free (prev);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -580,7 +580,7 @@ VertDone:
|
|||
|
||||
/* add to the end of the list of modes sections
|
||||
referenced here */
|
||||
mptr = xf86confcalloc (1, sizeof (XF86ConfModesLinkRec));
|
||||
mptr = calloc (1, sizeof (XF86ConfModesLinkRec));
|
||||
mptr->list.next = NULL;
|
||||
mptr->ml_modes_str = val.str;
|
||||
mptr->ml_modes = NULL;
|
||||
|
@ -822,7 +822,7 @@ xf86freeMonitorList (XF86ConfMonitorPtr ptr)
|
|||
xf86freeModeLineList (ptr->mon_modeline_lst);
|
||||
prev = ptr;
|
||||
ptr = ptr->list.next;
|
||||
xf86conffree (prev);
|
||||
free (prev);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -838,7 +838,7 @@ xf86freeModesList (XF86ConfModesPtr ptr)
|
|||
xf86freeModeLineList (ptr->mon_modeline_lst);
|
||||
prev = ptr;
|
||||
ptr = ptr->list.next;
|
||||
xf86conffree (prev);
|
||||
free (prev);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -186,15 +186,15 @@ xf86parsePointerSection (void)
|
|||
Error (ZAXISMAPPING_MSG, NULL);
|
||||
s1 = xf86uLongToString(val.num);
|
||||
if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) {
|
||||
xf86conffree(s1);
|
||||
free(s1);
|
||||
Error (ZAXISMAPPING_MSG, NULL);
|
||||
}
|
||||
s2 = xf86uLongToString(val.num);
|
||||
l = strlen(s1) + 1 + strlen(s2) + 1;
|
||||
s = xf86confmalloc(l);
|
||||
s = malloc(l);
|
||||
sprintf(s, "%s %s", s1, s2);
|
||||
xf86conffree(s1);
|
||||
xf86conffree(s2);
|
||||
free(s1);
|
||||
free(s2);
|
||||
break;
|
||||
case XAXIS:
|
||||
s = strdup("x");
|
||||
|
|
|
@ -169,7 +169,7 @@ xf86parseDisplaySubSection (void)
|
|||
|
||||
while ((token = xf86getSubTokenWithTab (&(ptr->disp_comment), DisplayTab)) == STRING)
|
||||
{
|
||||
mptr = xf86confcalloc (1, sizeof (XF86ModeRec));
|
||||
mptr = calloc (1, sizeof (XF86ModeRec));
|
||||
mptr->mode_name = val.str;
|
||||
mptr->list.next = NULL;
|
||||
ptr->disp_mode_lst = (XF86ModePtr)
|
||||
|
@ -292,7 +292,7 @@ xf86parseScreenSection (void)
|
|||
|
||||
if (aptr == NULL)
|
||||
{
|
||||
aptr = xf86confcalloc (1, sizeof (XF86ConfAdaptorLinkRec));
|
||||
aptr = calloc (1, sizeof (XF86ConfAdaptorLinkRec));
|
||||
aptr->list.next = NULL;
|
||||
aptr->al_adaptor_str = val.str;
|
||||
ptr->scrn_adaptor_lst = (XF86ConfAdaptorLinkPtr)
|
||||
|
@ -315,7 +315,7 @@ xf86parseScreenSection (void)
|
|||
if (xf86getSubToken (&(ptr->scrn_comment)) != STRING)
|
||||
Error (QUOTE_MSG, "SubSection");
|
||||
{
|
||||
xf86conffree(val.str);
|
||||
free(val.str);
|
||||
HANDLE_LIST (scrn_display_lst, xf86parseDisplaySubSection,
|
||||
XF86ConfDisplayPtr);
|
||||
}
|
||||
|
@ -456,7 +456,7 @@ xf86freeScreenList (XF86ConfScreenPtr ptr)
|
|||
xf86freeDisplayList (ptr->scrn_display_lst);
|
||||
prev = ptr;
|
||||
ptr = ptr->list.next;
|
||||
xf86conffree (prev);
|
||||
free (prev);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -470,7 +470,7 @@ xf86freeAdaptorLinkList (XF86ConfAdaptorLinkPtr ptr)
|
|||
TestFree (ptr->al_adaptor_str);
|
||||
prev = ptr;
|
||||
ptr = ptr->list.next;
|
||||
xf86conffree (prev);
|
||||
free (prev);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -485,7 +485,7 @@ xf86freeDisplayList (XF86ConfDisplayPtr ptr)
|
|||
xf86optionListFree (ptr->disp_option_lst);
|
||||
prev = ptr;
|
||||
ptr = ptr->list.next;
|
||||
xf86conffree (prev);
|
||||
free (prev);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -499,7 +499,7 @@ xf86freeModeList (XF86ModePtr ptr)
|
|||
TestFree (ptr->mode_name);
|
||||
prev = ptr;
|
||||
ptr = ptr->list.next;
|
||||
xf86conffree (prev);
|
||||
free (prev);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ xf86freeVendorList (XF86ConfVendorPtr p)
|
|||
TestFree (p->vnd_identifier);
|
||||
TestFree (p->vnd_comment);
|
||||
xf86optionListFree (p->vnd_option_lst);
|
||||
xf86conffree (p);
|
||||
free (p);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -239,6 +239,6 @@ xf86freeVendorSubList (XF86ConfVendSubPtr ptr)
|
|||
xf86optionListFree (ptr->vs_option_lst);
|
||||
prev = ptr;
|
||||
ptr = ptr->list.next;
|
||||
xf86conffree (prev);
|
||||
free (prev);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ xf86freeVideoPortList (XF86ConfVideoPortPtr ptr)
|
|||
xf86optionListFree (ptr->vp_option_lst);
|
||||
prev = ptr;
|
||||
ptr = ptr->list.next;
|
||||
xf86conffree (prev);
|
||||
free (prev);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,7 @@ xf86freeVideoAdaptorList (XF86ConfVideoAdaptorPtr ptr)
|
|||
xf86optionListFree (ptr->va_option_lst);
|
||||
prev = ptr;
|
||||
ptr = ptr->list.next;
|
||||
xf86conffree (prev);
|
||||
free (prev);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ xf86readConfigFile (void)
|
|||
int token;
|
||||
XF86ConfigPtr ptr = NULL;
|
||||
|
||||
if ((ptr = xf86confcalloc (1, sizeof (XF86ConfigRec))) == NULL)
|
||||
if ((ptr = calloc (1, sizeof (XF86ConfigRec))) == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -118,107 +118,107 @@ xf86readConfigFile (void)
|
|||
xf86setSection (val.str);
|
||||
if (xf86nameCompare (val.str, "files") == 0)
|
||||
{
|
||||
xf86conffree(val.str);
|
||||
free(val.str);
|
||||
val.str = NULL;
|
||||
HANDLE_RETURN (conf_files, xf86parseFilesSection ());
|
||||
}
|
||||
else if (xf86nameCompare (val.str, "serverflags") == 0)
|
||||
{
|
||||
xf86conffree(val.str);
|
||||
free(val.str);
|
||||
val.str = NULL;
|
||||
HANDLE_RETURN (conf_flags, xf86parseFlagsSection ());
|
||||
}
|
||||
else if (xf86nameCompare (val.str, "pointer") == 0)
|
||||
{
|
||||
xf86conffree(val.str);
|
||||
free(val.str);
|
||||
val.str = NULL;
|
||||
HANDLE_LIST (conf_input_lst, xf86parsePointerSection,
|
||||
XF86ConfInputPtr);
|
||||
}
|
||||
else if (xf86nameCompare (val.str, "videoadaptor") == 0)
|
||||
{
|
||||
xf86conffree(val.str);
|
||||
free(val.str);
|
||||
val.str = NULL;
|
||||
HANDLE_LIST (conf_videoadaptor_lst, xf86parseVideoAdaptorSection,
|
||||
XF86ConfVideoAdaptorPtr);
|
||||
}
|
||||
else if (xf86nameCompare (val.str, "device") == 0)
|
||||
{
|
||||
xf86conffree(val.str);
|
||||
free(val.str);
|
||||
val.str = NULL;
|
||||
HANDLE_LIST (conf_device_lst, xf86parseDeviceSection,
|
||||
XF86ConfDevicePtr);
|
||||
}
|
||||
else if (xf86nameCompare (val.str, "monitor") == 0)
|
||||
{
|
||||
xf86conffree(val.str);
|
||||
free(val.str);
|
||||
val.str = NULL;
|
||||
HANDLE_LIST (conf_monitor_lst, xf86parseMonitorSection,
|
||||
XF86ConfMonitorPtr);
|
||||
}
|
||||
else if (xf86nameCompare (val.str, "modes") == 0)
|
||||
{
|
||||
xf86conffree(val.str);
|
||||
free(val.str);
|
||||
val.str = NULL;
|
||||
HANDLE_LIST (conf_modes_lst, xf86parseModesSection,
|
||||
XF86ConfModesPtr);
|
||||
}
|
||||
else if (xf86nameCompare (val.str, "screen") == 0)
|
||||
{
|
||||
xf86conffree(val.str);
|
||||
free(val.str);
|
||||
val.str = NULL;
|
||||
HANDLE_LIST (conf_screen_lst, xf86parseScreenSection,
|
||||
XF86ConfScreenPtr);
|
||||
}
|
||||
else if (xf86nameCompare(val.str, "inputdevice") == 0)
|
||||
{
|
||||
xf86conffree(val.str);
|
||||
free(val.str);
|
||||
val.str = NULL;
|
||||
HANDLE_LIST (conf_input_lst, xf86parseInputSection,
|
||||
XF86ConfInputPtr);
|
||||
}
|
||||
else if (xf86nameCompare (val.str, "module") == 0)
|
||||
{
|
||||
xf86conffree(val.str);
|
||||
free(val.str);
|
||||
val.str = NULL;
|
||||
HANDLE_RETURN (conf_modules, xf86parseModuleSection ());
|
||||
}
|
||||
else if (xf86nameCompare (val.str, "serverlayout") == 0)
|
||||
{
|
||||
xf86conffree(val.str);
|
||||
free(val.str);
|
||||
val.str = NULL;
|
||||
HANDLE_LIST (conf_layout_lst, xf86parseLayoutSection,
|
||||
XF86ConfLayoutPtr);
|
||||
}
|
||||
else if (xf86nameCompare (val.str, "vendor") == 0)
|
||||
{
|
||||
xf86conffree(val.str);
|
||||
free(val.str);
|
||||
val.str = NULL;
|
||||
HANDLE_LIST (conf_vendor_lst, xf86parseVendorSection,
|
||||
XF86ConfVendorPtr);
|
||||
}
|
||||
else if (xf86nameCompare (val.str, "dri") == 0)
|
||||
{
|
||||
xf86conffree(val.str);
|
||||
free(val.str);
|
||||
val.str = NULL;
|
||||
HANDLE_RETURN (conf_dri, xf86parseDRISection ());
|
||||
}
|
||||
else if (xf86nameCompare (val.str, "extensions") == 0)
|
||||
{
|
||||
xf86conffree(val.str);
|
||||
free(val.str);
|
||||
val.str = NULL;
|
||||
HANDLE_RETURN (conf_extensions, xf86parseExtensionsSection ());
|
||||
}
|
||||
else
|
||||
{
|
||||
Error (INVALID_SECTION_MSG, xf86tokenString ());
|
||||
xf86conffree(val.str);
|
||||
free(val.str);
|
||||
val.str = NULL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Error (INVALID_KEYWORD_MSG, xf86tokenString ());
|
||||
xf86conffree(val.str);
|
||||
free(val.str);
|
||||
val.str = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -306,5 +306,5 @@ xf86freeConfig (XF86ConfigPtr p)
|
|||
xf86freeExtensions (p->conf_extensions);
|
||||
TestFree(p->conf_comment);
|
||||
|
||||
xf86conffree (p);
|
||||
free (p);
|
||||
}
|
||||
|
|
|
@ -180,8 +180,8 @@ xf86getNextLine(void)
|
|||
|
||||
if (configBufLen != CONFIG_BUF_LEN) {
|
||||
|
||||
tmpConfigBuf = xf86confmalloc(CONFIG_BUF_LEN);
|
||||
tmpConfigRBuf = xf86confmalloc(CONFIG_BUF_LEN);
|
||||
tmpConfigBuf = malloc(CONFIG_BUF_LEN);
|
||||
tmpConfigRBuf = malloc(CONFIG_BUF_LEN);
|
||||
|
||||
if (!tmpConfigBuf || !tmpConfigRBuf) {
|
||||
|
||||
|
@ -190,8 +190,8 @@ xf86getNextLine(void)
|
|||
* and free any partial allocations
|
||||
*/
|
||||
|
||||
xf86conffree(tmpConfigBuf);
|
||||
xf86conffree(tmpConfigRBuf);
|
||||
free(tmpConfigBuf);
|
||||
free(tmpConfigRBuf);
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -202,8 +202,8 @@ xf86getNextLine(void)
|
|||
|
||||
configBufLen = CONFIG_BUF_LEN;
|
||||
|
||||
xf86conffree(configBuf);
|
||||
xf86conffree(configRBuf);
|
||||
free(configBuf);
|
||||
free(configRBuf);
|
||||
|
||||
configBuf = tmpConfigBuf;
|
||||
configRBuf = tmpConfigRBuf;
|
||||
|
@ -237,8 +237,8 @@ xf86getNextLine(void)
|
|||
|
||||
if (!eolFound) {
|
||||
|
||||
tmpConfigBuf = xf86confrealloc(configBuf, configBufLen + CONFIG_BUF_LEN);
|
||||
tmpConfigRBuf = xf86confrealloc(configRBuf, configBufLen + CONFIG_BUF_LEN);
|
||||
tmpConfigBuf = realloc(configBuf, configBufLen + CONFIG_BUF_LEN);
|
||||
tmpConfigRBuf = realloc(configRBuf, configBufLen + CONFIG_BUF_LEN);
|
||||
|
||||
if (!tmpConfigBuf || !tmpConfigRBuf) {
|
||||
|
||||
|
@ -420,7 +420,7 @@ again:
|
|||
}
|
||||
while ((c != '\"') && (c != '\n') && (c != '\r') && (c != '\0'));
|
||||
configRBuf[i] = '\0';
|
||||
val.str = xf86confmalloc (strlen (configRBuf) + 1);
|
||||
val.str = malloc (strlen (configRBuf) + 1);
|
||||
strcpy (val.str, configRBuf); /* private copy ! */
|
||||
return (STRING);
|
||||
}
|
||||
|
@ -595,7 +595,7 @@ xf86pathIsSafe(const char *path)
|
|||
#endif
|
||||
|
||||
#define BAIL_OUT do { \
|
||||
xf86conffree(result); \
|
||||
free(result); \
|
||||
return NULL; \
|
||||
} while (0)
|
||||
|
||||
|
@ -632,7 +632,7 @@ DoSubstitution(const char *template, const char *cmdline, const char *projroot,
|
|||
if (envUsed)
|
||||
*envUsed = 0;
|
||||
|
||||
result = xf86confmalloc(PATH_MAX + 1);
|
||||
result = malloc(PATH_MAX + 1);
|
||||
l = 0;
|
||||
for (i = 0; template[i]; i++) {
|
||||
if (template[i] != '%') {
|
||||
|
@ -669,11 +669,11 @@ DoSubstitution(const char *template, const char *cmdline, const char *projroot,
|
|||
break;
|
||||
case 'H':
|
||||
if (!hostname) {
|
||||
if ((hostname = xf86confmalloc(MAXHOSTNAMELEN + 1))) {
|
||||
if ((hostname = malloc(MAXHOSTNAMELEN + 1))) {
|
||||
if (gethostname(hostname, MAXHOSTNAMELEN) == 0) {
|
||||
hostname[MAXHOSTNAMELEN] = '\0';
|
||||
} else {
|
||||
xf86conffree(hostname);
|
||||
free(hostname);
|
||||
hostname = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -791,7 +791,7 @@ xf86openConfigFile(const char *path, const char *cmdline, const char *projroot)
|
|||
|
||||
if (!path || !path[0])
|
||||
path = DEFAULT_CONF_PATH;
|
||||
pathcopy = xf86confmalloc(strlen(path) + 1);
|
||||
pathcopy = malloc(strlen(path) + 1);
|
||||
strcpy(pathcopy, path);
|
||||
if (!projroot || !projroot[0])
|
||||
projroot = PROJECTROOT;
|
||||
|
@ -811,7 +811,7 @@ xf86openConfigFile(const char *path, const char *cmdline, const char *projroot)
|
|||
}
|
||||
}
|
||||
if (configPath && !configFile) {
|
||||
xf86conffree(configPath);
|
||||
free(configPath);
|
||||
configPath = NULL;
|
||||
}
|
||||
template = strtok(NULL, ",");
|
||||
|
@ -834,21 +834,21 @@ xf86openConfigFile(const char *path, const char *cmdline, const char *projroot)
|
|||
}
|
||||
}
|
||||
if (configPath && !configFile) {
|
||||
xf86conffree(configPath);
|
||||
free(configPath);
|
||||
configPath = NULL;
|
||||
}
|
||||
template = strtok(NULL, ",");
|
||||
}
|
||||
}
|
||||
|
||||
xf86conffree(pathcopy);
|
||||
free(pathcopy);
|
||||
if (!configFile) {
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
configBuf = xf86confmalloc (CONFIG_BUF_LEN);
|
||||
configRBuf = xf86confmalloc (CONFIG_BUF_LEN);
|
||||
configBuf = malloc (CONFIG_BUF_LEN);
|
||||
configRBuf = malloc (CONFIG_BUF_LEN);
|
||||
configBuf[0] = '\0'; /* sanity ... */
|
||||
|
||||
return configPath;
|
||||
|
@ -857,11 +857,11 @@ xf86openConfigFile(const char *path, const char *cmdline, const char *projroot)
|
|||
void
|
||||
xf86closeConfigFile (void)
|
||||
{
|
||||
xf86conffree (configPath);
|
||||
free (configPath);
|
||||
configPath = NULL;
|
||||
xf86conffree (configRBuf);
|
||||
free (configRBuf);
|
||||
configRBuf = NULL;
|
||||
xf86conffree (configBuf);
|
||||
free (configBuf);
|
||||
configBuf = NULL;
|
||||
|
||||
if (configFile) {
|
||||
|
@ -878,8 +878,8 @@ xf86setBuiltinConfig(const char *config[])
|
|||
{
|
||||
builtinConfig = config;
|
||||
configPath = strdup("<builtin configuration>");
|
||||
configBuf = xf86confmalloc (CONFIG_BUF_LEN);
|
||||
configRBuf = xf86confmalloc (CONFIG_BUF_LEN);
|
||||
configBuf = malloc (CONFIG_BUF_LEN);
|
||||
configRBuf = malloc (CONFIG_BUF_LEN);
|
||||
configBuf[0] = '\0'; /* sanity ... */
|
||||
|
||||
}
|
||||
|
@ -915,8 +915,8 @@ void
|
|||
xf86setSection (char *section)
|
||||
{
|
||||
if (configSection)
|
||||
xf86conffree(configSection);
|
||||
configSection = xf86confmalloc(strlen (section) + 1);
|
||||
free(configSection);
|
||||
configSection = malloc(strlen (section) + 1);
|
||||
strcpy (configSection, section);
|
||||
}
|
||||
|
||||
|
@ -1013,7 +1013,7 @@ xf86addComment(char *cur, char *add)
|
|||
endnewline = add[len - 1] == '\n';
|
||||
len += 1 + iscomment + (!hasnewline) + (!endnewline) + eol_seen;
|
||||
|
||||
if ((str = xf86confrealloc(cur, len + curlen)) == NULL)
|
||||
if ((str = realloc(cur, len + curlen)) == NULL)
|
||||
return (cur);
|
||||
|
||||
cur = str;
|
||||
|
|
Loading…
Reference in New Issue
Block a user