diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-04-16 17:06:33 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-04-19 22:20:18 +1000 |
commit | 62d2fb68638e9f2aa3c1d72027619c4d38f5b812 (patch) | |
tree | e5082e07ae7f4ad68a223239f2472f0b5276ee6e /xkb | |
parent | ad76656f8869e2065f0c4e66cfbeef0b42c61769 (diff) |
xkb: Add XkbFreeRMLVOSet helper function.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Dan Nicholson <dbn.lists@gmail.com>
Diffstat (limited to 'xkb')
-rw-r--r-- | xkb/xkbInit.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index 9d4d9a212..5ac06feae 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -136,6 +136,24 @@ XkbGetRulesDflts(XkbRMLVOSet *rmlvo) rmlvo->options = strdup(rmlvo->options); } +void +XkbFreeRMLVOSet(XkbRMLVOSet *rmlvo, Bool freeRMLVO) +{ + if (!rmlvo) + return; + + xfree(rmlvo->rules); + xfree(rmlvo->model); + xfree(rmlvo->layout); + xfree(rmlvo->variant); + xfree(rmlvo->options); + + if (freeRMLVO) + xfree(rmlvo); + else + memset(rmlvo, 0, sizeof(XkbRMLVOSet)); +} + static Bool XkbWriteRulesProp(ClientPtr client, pointer closure) { @@ -595,17 +613,7 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet *rmlvo, XkbSetRulesDflts(rmlvo); XkbSetRulesUsed(rmlvo); - - if (rmlvo_dflts.rules) - xfree(rmlvo_dflts.rules); - if (rmlvo_dflts.model) - xfree(rmlvo_dflts.model); - if (rmlvo_dflts.layout) - xfree(rmlvo_dflts.layout); - if (rmlvo_dflts.variant) - xfree(rmlvo_dflts.variant); - if (rmlvo_dflts.options) - xfree(rmlvo_dflts.options); + XkbFreeRMLVOSet(&rmlvo_dflts, FALSE); return TRUE; |