summaryrefslogtreecommitdiff
path: root/xkb/maprules.c
diff options
context:
space:
mode:
authorMikhail Gusarov <dottedmag@dottedmag.net>2010-05-06 01:44:06 +0700
committerMikhail Gusarov <dottedmag@dottedmag.net>2010-05-13 00:22:37 +0700
commit3f3ff971ecff9936cebafc813af9193b97bba89c (patch)
treefdbbad794a42488b7ffe41eed7aba4e498335f55 /xkb/maprules.c
parent96c7ab27c383ec767f62a7a11e5fd76f86363fbc (diff)
Replace X-allocation functions with their C89 counterparts
The only remaining X-functions used in server are XNF*, the rest is converted to plain alloc/calloc/realloc/free/strdup. X* functions are still exported from server and x* macros are still defined in header file, so both ABI and API are not affected by this change. Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'xkb/maprules.c')
-rw-r--r--xkb/maprules.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/xkb/maprules.c b/xkb/maprules.c
index 3467c4238..3b15a4749 100644
--- a/xkb/maprules.c
+++ b/xkb/maprules.c
@@ -78,7 +78,7 @@ static void
FreeInputLine(InputLine *line)
{
if (line->line!=line->buf)
- xfree(line->line);
+ free(line->line);
line->line_num= 1;
line->num_line= 0;
line->sz_line= DFLT_LINE_SIZE;
@@ -91,11 +91,11 @@ InputLineAddChar(InputLine *line,int ch)
{
if (line->num_line>=line->sz_line) {
if (line->line==line->buf) {
- line->line= xalloc(line->sz_line*2);
+ line->line= malloc(line->sz_line*2);
memcpy(line->line,line->buf,line->sz_line);
}
else {
- line->line= xrealloc((char *)line->line,line->sz_line*2);
+ line->line= realloc((char *)line->line,line->sz_line*2);
}
line->sz_line*= 2;
}
@@ -474,7 +474,7 @@ int len;
if ((!str1)||(!str2))
return str1;
len= strlen(str1)+strlen(str2)+1;
- str1= xrealloc(str1,len * sizeof(char));
+ str1= realloc(str1,len * sizeof(char));
if (str1)
strcat(str1,str2);
return str1;
@@ -553,9 +553,9 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
static void
FreeMultiDefs(XkbRF_MultiDefsPtr defs)
{
- if (defs->options) xfree(defs->options);
- if (defs->layout[1]) xfree(defs->layout[1]);
- if (defs->variant[1]) xfree(defs->variant[1]);
+ if (defs->options) free(defs->options);
+ if (defs->layout[1]) free(defs->layout[1]);
+ if (defs->variant[1]) free(defs->variant[1]);
}
static void
@@ -769,7 +769,7 @@ int len, ndx;
}
str= index(&str[0],'%');
}
- name= xalloc(len+1);
+ name= malloc(len+1);
str= orig;
outstr= name;
while (*str!='\0') {
@@ -819,7 +819,7 @@ int len, ndx;
}
*outstr++= '\0';
if (orig!=name)
- xfree(orig);
+ free(orig);
return name;
}
@@ -864,11 +864,11 @@ XkbRF_AddRule(XkbRF_RulesPtr rules)
if (rules->sz_rules<1) {
rules->sz_rules= 16;
rules->num_rules= 0;
- rules->rules= xcalloc(rules->sz_rules, sizeof(XkbRF_RuleRec));
+ rules->rules= calloc(rules->sz_rules, sizeof(XkbRF_RuleRec));
}
else if (rules->num_rules>=rules->sz_rules) {
rules->sz_rules*= 2;
- rules->rules= xrealloc(rules->rules,
+ rules->rules= realloc(rules->rules,
rules->sz_rules * sizeof(XkbRF_RuleRec));
}
if (!rules->rules) {
@@ -886,11 +886,11 @@ XkbRF_AddGroup(XkbRF_RulesPtr rules)
if (rules->sz_groups<1) {
rules->sz_groups= 16;
rules->num_groups= 0;
- rules->groups= xcalloc(rules->sz_groups, sizeof(XkbRF_GroupRec));
+ rules->groups= calloc(rules->sz_groups, sizeof(XkbRF_GroupRec));
}
else if (rules->num_groups >= rules->sz_groups) {
rules->sz_groups *= 2;
- rules->groups= xrealloc(rules->groups,
+ rules->groups= realloc(rules->groups,
rules->sz_groups * sizeof(XkbRF_GroupRec));
}
if (!rules->groups) {
@@ -972,7 +972,7 @@ Bool ok;
XkbRF_RulesPtr
XkbRF_Create(void)
{
- return xcalloc(1, sizeof( XkbRF_RulesRec));
+ return calloc(1, sizeof( XkbRF_RulesRec));
}
/***====================================================================***/
@@ -988,32 +988,32 @@ XkbRF_GroupPtr group;
return;
if (rules->rules) {
for (i=0,rule=rules->rules;i<rules->num_rules;i++,rule++) {
- if (rule->model) xfree(rule->model);
- if (rule->layout) xfree(rule->layout);
- if (rule->variant) xfree(rule->variant);
- if (rule->option) xfree(rule->option);
- if (rule->keycodes) xfree(rule->keycodes);
- if (rule->symbols) xfree(rule->symbols);
- if (rule->types) xfree(rule->types);
- if (rule->compat) xfree(rule->compat);
- if (rule->geometry) xfree(rule->geometry);
+ if (rule->model) free(rule->model);
+ if (rule->layout) free(rule->layout);
+ if (rule->variant) free(rule->variant);
+ if (rule->option) free(rule->option);
+ if (rule->keycodes) free(rule->keycodes);
+ if (rule->symbols) free(rule->symbols);
+ if (rule->types) free(rule->types);
+ if (rule->compat) free(rule->compat);
+ if (rule->geometry) free(rule->geometry);
bzero((char *)rule,sizeof(XkbRF_RuleRec));
}
- xfree(rules->rules);
+ free(rules->rules);
rules->num_rules= rules->sz_rules= 0;
rules->rules= NULL;
}
if (rules->groups) {
for (i=0, group=rules->groups;i<rules->num_groups;i++,group++) {
- if (group->name) xfree(group->name);
- if (group->words) xfree(group->words);
+ if (group->name) free(group->name);
+ if (group->words) free(group->words);
}
- xfree(rules->groups);
+ free(rules->groups);
rules->num_groups= 0;
rules->groups= NULL;
}
if (freeRules)
- xfree(rules);
+ free(rules);
return;
}