Fix gcc -Wwrite-strings warnings in XkbGetRulesDflts

Stop temporarily storing a pointer to a constant literal string
in a char *, just to strdup it a few lines later.

Fixes gcc -Wwrite-strings warnings:

xkbInit.c: In function 'XkbGetRulesDflts':
xkbInit.c:121:38: warning: assignment discards qualifiers from pointer target type
xkbInit.c:123:23: warning: assignment discards qualifiers from pointer target type
xkbInit.c:125:24: warning: assignment discards qualifiers from pointer target type
xkbInit.c:127:25: warning: assignment discards qualifiers from pointer target type
xkbInit.c:129:25: warning: assignment discards qualifiers from pointer target type

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
This commit is contained in:
Alan Coopersmith 2011-11-03 21:21:19 -07:00
parent 0bc41d5f8d
commit 232f1ddf3d

View File

@ -117,22 +117,11 @@ static Bool XkbWantRulesProp= XKB_DFLT_RULES_PROP;
void
XkbGetRulesDflts(XkbRMLVOSet *rmlvo)
{
if (XkbRulesDflt) rmlvo->rules = XkbRulesDflt;
else rmlvo->rules = XKB_DFLT_RULES;
if (XkbModelDflt) rmlvo->model= XkbModelDflt;
else rmlvo->model= XKB_DFLT_MODEL;
if (XkbLayoutDflt) rmlvo->layout= XkbLayoutDflt;
else rmlvo->layout= XKB_DFLT_LAYOUT;
if (XkbVariantDflt) rmlvo->variant= XkbVariantDflt;
else rmlvo->variant= XKB_DFLT_VARIANT;
if (XkbOptionsDflt) rmlvo->options= XkbOptionsDflt;
else rmlvo->options= XKB_DFLT_OPTIONS;
rmlvo->rules = strdup(rmlvo->rules);
rmlvo->model = strdup(rmlvo->model);
rmlvo->layout = strdup(rmlvo->layout);
rmlvo->variant = strdup(rmlvo->variant);
rmlvo->options = strdup(rmlvo->options);
rmlvo->rules = strdup(XkbRulesDflt ? XkbRulesDflt : XKB_DFLT_RULES);
rmlvo->model = strdup(XkbModelDflt ? XkbModelDflt : XKB_DFLT_MODEL);
rmlvo->layout = strdup(XkbLayoutDflt ? XkbLayoutDflt : XKB_DFLT_LAYOUT);
rmlvo->variant= strdup(XkbVariantDflt ? XkbVariantDflt : XKB_DFLT_VARIANT);
rmlvo->options= strdup(XkbOptionsDflt ? XkbOptionsDflt : XKB_DFLT_OPTIONS);
}
void