summaryrefslogtreecommitdiff
path: root/xkb/maprules.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-02-13 21:36:03 -0800
committerPeter Hutterer <peter.hutterer@who-t.net>2011-02-15 10:35:41 +1000
commitaac1b435664819008989ed19f73e9c89920602c5 (patch)
treeda97dfec6fe635ec8cd609ee03ad247a07b3e499 /xkb/maprules.c
parenta4a2e814d5d0e6152307a301eda1d6fc1c555aaa (diff)
Replace _XkbDupString with Xstrdup
The two functions have identical semantics, including safely returning NULL when NULL is passed in (which POSIX strdup does not guarantee). Some callers could probably be adjusted to call libc strdup directly, when we know the input is non-NULL. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'xkb/maprules.c')
-rw-r--r--xkb/maprules.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/xkb/maprules.c b/xkb/maprules.c
index 0c91cdc20..f94089982 100644
--- a/xkb/maprules.c
+++ b/xkb/maprules.c
@@ -391,8 +391,8 @@ Bool append = FALSE;
}
if (*words == '\0')
return FALSE;
- group->name = _XkbDupString(gname);
- group->words = _XkbDupString(words);
+ group->name = Xstrdup(gname);
+ group->words = Xstrdup(words);
for (i = 1, words = group->words; *words; words++) {
if ( *words == ' ') {
*words++ = '\0';
@@ -443,16 +443,16 @@ Bool append = FALSE;
rule->flags|= XkbRF_Append;
else
rule->flags|= XkbRF_Normal;
- rule->model= _XkbDupString(tmp.name[MODEL]);
- rule->layout= _XkbDupString(tmp.name[LAYOUT]);
- rule->variant= _XkbDupString(tmp.name[VARIANT]);
- rule->option= _XkbDupString(tmp.name[OPTION]);
+ rule->model= Xstrdup(tmp.name[MODEL]);
+ rule->layout= Xstrdup(tmp.name[LAYOUT]);
+ rule->variant= Xstrdup(tmp.name[VARIANT]);
+ rule->option= Xstrdup(tmp.name[OPTION]);
- rule->keycodes= _XkbDupString(tmp.name[KEYCODES]);
- rule->symbols= _XkbDupString(tmp.name[SYMBOLS]);
- rule->types= _XkbDupString(tmp.name[TYPES]);
- rule->compat= _XkbDupString(tmp.name[COMPAT]);
- rule->geometry= _XkbDupString(tmp.name[GEOMETRY]);
+ rule->keycodes= Xstrdup(tmp.name[KEYCODES]);
+ rule->symbols= Xstrdup(tmp.name[SYMBOLS]);
+ rule->types= Xstrdup(tmp.name[TYPES]);
+ rule->compat= Xstrdup(tmp.name[COMPAT]);
+ rule->geometry= Xstrdup(tmp.name[GEOMETRY]);
rule->layout_num = rule->variant_num = 0;
for (i = 0; i < nread; i++) {
@@ -497,7 +497,7 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
memset((char *)mdefs, 0, sizeof(XkbRF_MultiDefsRec));
mdefs->model = defs->model;
- mdefs->options = _XkbDupString(defs->options);
+ mdefs->options = Xstrdup(defs->options);
if (mdefs->options) squeeze_spaces(mdefs->options);
if (defs->layout) {
@@ -506,7 +506,7 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
} else {
char *p;
int i;
- mdefs->layout[1] = _XkbDupString(defs->layout);
+ mdefs->layout[1] = Xstrdup(defs->layout);
if (mdefs->layout[1] == NULL)
return FALSE;
squeeze_spaces(mdefs->layout[1]);
@@ -530,7 +530,7 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
} else {
char *p;
int i;
- mdefs->variant[1] = _XkbDupString(defs->variant);
+ mdefs->variant[1] = Xstrdup(defs->variant);
if (mdefs->variant[1] == NULL)
return FALSE;
squeeze_spaces(mdefs->variant[1]);
@@ -566,7 +566,7 @@ Apply(char *src, char **dst)
*dst= _Concat(*dst, src);
} else {
if (*dst == NULL)
- *dst= _XkbDupString(src);
+ *dst= Xstrdup(src);
}
}
}