diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-02-13 21:36:03 -0800 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2017-03-03 21:33:34 +0100 |
commit | bdfb52193b5a2c5e44969b11d997ce19f0310af9 (patch) | |
tree | 7f2b93218eddb984f5ae27e0aa086393e184476c /nx-X11/programs/Xserver/xkb/maprules.c | |
parent | e61e9795c3d19b163ebea9a230c2acc718a70d79 (diff) | |
download | nx-libs-bdfb52193b5a2c5e44969b11d997ce19f0310af9.tar.gz nx-libs-bdfb52193b5a2c5e44969b11d997ce19f0310af9.tar.bz2 nx-libs-bdfb52193b5a2c5e44969b11d997ce19f0310af9.zip |
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>
Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11/programs/Xserver/xkb/maprules.c')
-rw-r--r-- | nx-X11/programs/Xserver/xkb/maprules.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/nx-X11/programs/Xserver/xkb/maprules.c b/nx-X11/programs/Xserver/xkb/maprules.c index c89cc528a..337c8634b 100644 --- a/nx-X11/programs/Xserver/xkb/maprules.c +++ b/nx-X11/programs/Xserver/xkb/maprules.c @@ -426,8 +426,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'; @@ -478,17 +478,17 @@ 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->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->keymap= _XkbDupString(tmp.name[KEYMAP]); + 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= 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->keymap= Xstrdup(tmp.name[KEYMAP]); rule->layout_num = rule->variant_num = 0; for (i = 0; i < nread; i++) { @@ -533,7 +533,7 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs) bzero((char *)mdefs,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) { @@ -542,7 +542,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]); @@ -566,7 +566,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]); @@ -602,7 +602,7 @@ Apply(char *src, char **dst) *dst= _Concat(*dst, src); } else { if (*dst == NULL) - *dst= _XkbDupString(src); + *dst= Xstrdup(src); } } } @@ -1045,8 +1045,8 @@ XkbRF_AddVarDescCopy(XkbRF_DescribeVarsPtr vars,XkbRF_VarDescPtr from) XkbRF_VarDescPtr nd; if ((nd=XkbRF_AddVarDesc(vars))!=NULL) { - nd->name= _XkbDupString(from->name); - nd->desc= _XkbDupString(from->desc); + nd->name= Xstrdup(from->name); + nd->desc= Xstrdup(from->desc); } return nd; } @@ -1074,7 +1074,7 @@ XkbRF_AddVarToDescribe(XkbRF_RulesPtr rules,char *name) rules->extra= NULL; return NULL; } - rules->extra_names[rules->num_extra]= _XkbDupString(name); + rules->extra_names[rules->num_extra]= Xstrdup(name); bzero(&rules->extra[rules->num_extra],sizeof(XkbRF_DescribeVarsRec)); return &rules->extra[rules->num_extra++]; } |