Copy over missing action structs from kbproto
[platform/upstream/libxkbcommon.git] / src / xkbcomp / action.c
index ee9bce7..b149dfd 100644 (file)
@@ -6,25 +6,26 @@
  fee is hereby granted, provided that the above copyright
  notice appear in all copies and that both that copyright
  notice and this permission notice appear in supporting
- documentation, and that the name of Silicon Graphics not be 
- used in advertising or publicity pertaining to distribution 
+ documentation, and that the name of Silicon Graphics not be
+ used in advertising or publicity pertaining to distribution
  of the software without specific prior written permission.
- Silicon Graphics makes no representation about the suitability 
+ Silicon Graphics makes no representation about the suitability
  of this software for any purpose. It is provided "as is"
  without any express or implied warranty.
- SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
- SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
+
+ SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
- GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
- DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 
- DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 
+ GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
  THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
  ********************************************************/
 
 #include "xkbcomp.h"
+#include "xkbmisc.h"
 #include "tokens.h"
 #include "expr.h"
 
@@ -299,16 +300,16 @@ fieldText(unsigned field)
 static Bool
 ReportMismatch(unsigned action, unsigned field, const char *type)
 {
-    ERROR2("Value of %s field must be of type %s\n", fieldText(field), type);
-    ACTION1("Action %s definition ignored\n", XkbActionTypeText(action));
+    ERROR("Value of %s field must be of type %s\n", fieldText(field), type);
+    ACTION("Action %s definition ignored\n", XkbcActionTypeText(action));
     return False;
 }
 
 static Bool
 ReportIllegal(unsigned action, unsigned field)
 {
-    ERROR2("Field %s is not defined for an action of type %s\n",
-           fieldText(field), XkbActionTypeText(action));
+    ERROR("Field %s is not defined for an action of type %s\n",
+           fieldText(field), XkbcActionTypeText(action));
     ACTION("Action definition ignored\n");
     return False;
 }
@@ -316,8 +317,8 @@ ReportIllegal(unsigned action, unsigned field)
 static Bool
 ReportActionNotArray(unsigned action, unsigned field)
 {
-    ERROR2("The %s field in the %s action is not an array\n",
-           fieldText(field), XkbActionTypeText(action));
+    ERROR("The %s field in the %s action is not an array\n",
+           fieldText(field), XkbcActionTypeText(action));
     ACTION("Action definition ignored\n");
     return False;
 }
@@ -325,15 +326,15 @@ ReportActionNotArray(unsigned action, unsigned field)
 static Bool
 ReportNotFound(unsigned action, unsigned field, const char *what, char *bad)
 {
-    ERROR2("%s named %s not found\n", what, bad);
-    ACTION2("Ignoring the %s field of an %s action\n", fieldText(field),
-            XkbActionTypeText(action));
+    ERROR("%s named %s not found\n", what, bad);
+    ACTION("Ignoring the %s field of an %s action\n", fieldText(field),
+            XkbcActionTypeText(action));
     return False;
 }
 
 static Bool
 HandleNoAction(XkbcDescPtr xkb,
-               XkbAnyAction * action,
+               struct xkb_any_action * action,
                unsigned field, ExprDef * array_ndx, ExprDef * value)
 {
     return ReportIllegal(action->type, field);
@@ -372,7 +373,7 @@ CheckModifierField(XkbcDescPtr xkb,
     if (value->op == ExprIdent)
     {
         register char *valStr;
-        valStr = XkbcAtomGetString(NULL, value->value.str);
+        valStr = XkbcAtomText(value->value.str);
         if (valStr && ((uStrCaseCmp(valStr, "usemodmapmods") == 0) ||
                        (uStrCaseCmp(valStr, "modmapmods") == 0)))
         {
@@ -391,14 +392,14 @@ CheckModifierField(XkbcDescPtr xkb,
 
 static Bool
 HandleSetLatchMods(XkbcDescPtr xkb,
-                   XkbAnyAction * action,
+                   struct xkb_any_action * action,
                    unsigned field, ExprDef * array_ndx, ExprDef * value)
 {
-    XkbModAction *act;
+    struct xkb_mod_action *act;
     unsigned rtrn;
     unsigned t1, t2;
 
-    act = (XkbModAction *) action;
+    act = (struct xkb_mod_action *) action;
     if (array_ndx != NULL)
     {
         switch (field)
@@ -426,8 +427,7 @@ HandleSetLatchMods(XkbcDescPtr xkb,
         {
             act->flags = t1;
             act->real_mods = act->mask = (t2 & 0xff);
-            t2 = (t2 >> 8) & 0xffff;
-            XkbSetModActionVMods(act, t2);
+            act->vmods = (t2 >> 8) & 0xffff;
             return True;
         }
         return False;
@@ -437,13 +437,13 @@ HandleSetLatchMods(XkbcDescPtr xkb,
 
 static Bool
 HandleLockMods(XkbcDescPtr xkb,
-               XkbAnyAction * action,
+               struct xkb_any_action * action,
                unsigned field, ExprDef * array_ndx, ExprDef * value)
 {
-    XkbModAction *act;
+    struct xkb_mod_action *act;
     unsigned t1, t2;
 
-    act = (XkbModAction *) action;
+    act = (struct xkb_mod_action *) action;
     if ((array_ndx != NULL) && (field == F_Modifiers))
         return ReportActionNotArray(action->type, field);
     switch (field)
@@ -454,8 +454,7 @@ HandleLockMods(XkbcDescPtr xkb,
         {
             act->flags = t1;
             act->real_mods = act->mask = (t2 & 0xff);
-            t2 = (t2 >> 8) & 0xffff;
-            XkbSetModActionVMods(act, t2);
+            act->vmods = (t2 >> 8) & 0xffff;
             return True;
         }
         return False;
@@ -497,9 +496,9 @@ CheckGroupField(unsigned action,
         return ReportMismatch(action, F_Group, "integer (range 1..8)");
     if ((rtrn.ival < 1) || (rtrn.ival > XkbNumKbdGroups))
     {
-        ERROR2("Illegal group %d (must be in the range 1..%d)\n", rtrn.ival,
+        ERROR("Illegal group %d (must be in the range 1..%d)\n", rtrn.ival,
                XkbNumKbdGroups);
-        ACTION1("Action %s definition ignored\n", XkbActionTypeText(action));
+        ACTION("Action %s definition ignored\n", XkbcActionTypeText(action));
         return False;
     }
     if (value->op == OpNegate)
@@ -513,7 +512,7 @@ CheckGroupField(unsigned action,
 
 static Bool
 HandleSetLatchGroup(XkbcDescPtr xkb,
-                    XkbAnyAction * action,
+                    struct xkb_any_action * action,
                     unsigned field, ExprDef * array_ndx, ExprDef * value)
 {
     XkbGroupAction *act;
@@ -558,7 +557,7 @@ HandleSetLatchGroup(XkbcDescPtr xkb,
 
 static Bool
 HandleLockGroup(XkbcDescPtr xkb,
-                XkbAnyAction * action,
+                struct xkb_any_action * action,
                 unsigned field, ExprDef * array_ndx, ExprDef * value)
 {
     XkbGroupAction *act;
@@ -584,14 +583,14 @@ HandleLockGroup(XkbcDescPtr xkb,
 
 static Bool
 HandleMovePtr(XkbcDescPtr xkb,
-              XkbAnyAction * action,
+              struct xkb_any_action * action,
               unsigned field, ExprDef * array_ndx, ExprDef * value)
 {
     ExprResult rtrn;
-    XkbPtrAction *act;
+    struct xkb_pointer_action *act;
     Bool absolute;
 
-    act = (XkbPtrAction *) action;
+    act = (struct xkb_pointer_action *) action;
     if ((array_ndx != NULL) && ((field == F_X) || (field == F_Y)))
         return ReportActionNotArray(action->type, field);
 
@@ -649,13 +648,13 @@ static LookupEntry lockWhich[] = {
 
 static Bool
 HandlePtrBtn(XkbcDescPtr xkb,
-             XkbAnyAction * action,
+             struct xkb_any_action * action,
              unsigned field, ExprDef * array_ndx, ExprDef * value)
 {
     ExprResult rtrn;
-    XkbPtrBtnAction *act;
+    struct xkb_pointer_button_action *act;
 
-    act = (XkbPtrBtnAction *) action;
+    act = (struct xkb_pointer_button_action *) action;
     if (field == F_Button)
     {
         if (array_ndx != NULL)
@@ -667,7 +666,7 @@ HandlePtrBtn(XkbcDescPtr xkb,
         if ((rtrn.ival < 0) || (rtrn.ival > 5))
         {
             ERROR("Button must specify default or be in the range 1..5\n");
-            ACTION1("Illegal button value %d ignored\n", rtrn.ival);
+            ACTION("Illegal button value %d ignored\n", rtrn.ival);
             return False;
         }
         act->button = rtrn.ival;
@@ -693,7 +692,7 @@ HandlePtrBtn(XkbcDescPtr xkb,
         if ((rtrn.ival < 0) || (rtrn.ival > 255))
         {
             ERROR("The count field must have a value in the range 0..255\n");
-            ACTION1("Illegal count %d ignored\n", rtrn.ival);
+            ACTION("Illegal count %d ignored\n", rtrn.ival);
             return False;
         }
         act->count = rtrn.ival;
@@ -711,7 +710,7 @@ static LookupEntry ptrDflts[] = {
 
 static Bool
 HandleSetPtrDflt(XkbcDescPtr xkb,
-                 XkbAnyAction * action,
+                 struct xkb_any_action * action,
                  unsigned field, ExprDef * array_ndx, ExprDef * value)
 {
     ExprResult rtrn;
@@ -750,7 +749,7 @@ HandleSetPtrDflt(XkbcDescPtr xkb,
         if ((rtrn.ival < 0) || (rtrn.ival > 5))
         {
             ERROR("New default button value must be in the range 1..5\n");
-            ACTION1("Illegal default button value %d ignored\n", rtrn.ival);
+            ACTION("Illegal default button value %d ignored\n", rtrn.ival);
             return False;
         }
         if (rtrn.ival == 0)
@@ -784,15 +783,15 @@ static LookupEntry isoNames[] = {
 
 static Bool
 HandleISOLock(XkbcDescPtr xkb,
-              XkbAnyAction * action,
+              struct xkb_any_action * action,
               unsigned field, ExprDef * array_ndx, ExprDef * value)
 {
     ExprResult rtrn;
-    XkbISOAction *act;
+    struct xkb_iso_action *act;
     unsigned flags, mods;
     int group;
 
-    act = (XkbISOAction *) action;
+    act = (struct xkb_iso_action *) action;
     switch (field)
     {
     case F_Modifiers:
@@ -803,8 +802,7 @@ HandleISOLock(XkbcDescPtr xkb,
         {
             act->flags = flags & (~XkbSA_ISODfltIsGroup);
             act->real_mods = mods & 0xff;
-            mods = (mods >> 8) & 0xff;
-            XkbSetModActionVMods(act, mods);
+            act->vmods = (mods >> 8) & 0xff;
             return True;
         }
         return False;
@@ -815,7 +813,7 @@ HandleISOLock(XkbcDescPtr xkb,
         if (CheckGroupField(action->type, value, &flags, &group))
         {
             act->flags = flags | XkbSA_ISODfltIsGroup;
-            XkbSASetGroup(act, group);
+            act->group = group;
             return True;
         }
         return False;
@@ -832,7 +830,7 @@ HandleISOLock(XkbcDescPtr xkb,
 
 static Bool
 HandleSwitchScreen(XkbcDescPtr xkb,
-                   XkbAnyAction * action,
+                   struct xkb_any_action * action,
                    unsigned field, ExprDef * array_ndx, ExprDef * value)
 {
     ExprResult rtrn;
@@ -860,7 +858,7 @@ HandleSwitchScreen(XkbcDescPtr xkb,
         if ((rtrn.ival < 0) || (rtrn.ival > 255))
         {
             ERROR("Screen index must be in the range 1..255\n");
-            ACTION1("Illegal screen value %d ignored\n", rtrn.ival);
+            ACTION("Illegal screen value %d ignored\n", rtrn.ival);
             return False;
         }
         if (value->op == OpNegate)
@@ -924,13 +922,13 @@ LookupEntry ctrlNames[] = {
 
 static Bool
 HandleSetLockControls(XkbcDescPtr xkb,
-                      XkbAnyAction * action,
+                      struct xkb_any_action * action,
                       unsigned field, ExprDef * array_ndx, ExprDef * value)
 {
     ExprResult rtrn;
-    XkbCtrlsAction *act;
+    struct xkb_controls_action *act;
 
-    act = (XkbCtrlsAction *) action;
+    act = (struct xkb_controls_action *) action;
     if (field == F_Controls)
     {
         if (array_ndx != NULL)
@@ -938,7 +936,7 @@ HandleSetLockControls(XkbcDescPtr xkb,
         if (!ExprResolveMask
             (value, &rtrn, SimpleLookup, (char *) ctrlNames))
             return ReportMismatch(action->type, field, "controls mask");
-        XkbActionSetCtrls(act, rtrn.uval);
+        act->ctrls = rtrn.uval;
         return True;
     }
     return ReportIllegal(action->type, field);
@@ -956,13 +954,13 @@ static LookupEntry evNames[] = {
 
 static Bool
 HandleActionMessage(XkbcDescPtr xkb,
-                    XkbAnyAction * action,
+                    struct xkb_any_action * action,
                     unsigned field, ExprDef * array_ndx, ExprDef * value)
 {
     ExprResult rtrn;
-    XkbMessageAction *act;
+    struct xkb_message_action *act;
 
-    act = (XkbMessageAction *) action;
+    act = (struct xkb_message_action *) action;
     switch (field)
     {
     case F_Report:
@@ -995,7 +993,7 @@ HandleActionMessage(XkbcDescPtr xkb,
                 if ((len < 1) || (len > 6))
                 {
                     WARN("An action message can hold only 6 bytes\n");
-                    ACTION1("Extra %d bytes ignored\n", len - 6);
+                    ACTION("Extra %d bytes ignored\n", len - 6);
                 }
                 strncpy((char *) act->message, rtrn.str, 6);
             }
@@ -1014,7 +1012,7 @@ HandleActionMessage(XkbcDescPtr xkb,
             if (ndx > 5)
             {
                 ERROR("An action message is at most 6 bytes long\n");
-                ACTION1("Attempt to use data[%d] ignored\n", ndx);
+                ACTION("Attempt to use data[%d] ignored\n", ndx);
                 return False;
             }
             if (!ExprResolveInteger(value, &rtrn, NULL, NULL))
@@ -1022,7 +1020,7 @@ HandleActionMessage(XkbcDescPtr xkb,
             if ((rtrn.ival < 0) || (rtrn.ival > 255))
             {
                 ERROR("Message data must be in the range 0..255\n");
-                ACTION1("Illegal datum %d ignored\n", rtrn.ival);
+                ACTION("Illegal datum %d ignored\n", rtrn.ival);
                 return False;
             }
             act->message[ndx] = rtrn.uval;
@@ -1034,18 +1032,18 @@ HandleActionMessage(XkbcDescPtr xkb,
 
 static Bool
 HandleRedirectKey(XkbcDescPtr xkb,
-                  XkbAnyAction * action,
+                  struct xkb_any_action * action,
                   unsigned field, ExprDef * array_ndx, ExprDef * value)
 {
     ExprResult rtrn;
-    XkbRedirectKeyAction *act;
-    unsigned t1, t2, vmods, vmask;
+    struct xkb_redirect_key_action *act;
+    unsigned t1, t2;
     unsigned long tmp;
 
     if (array_ndx != NULL)
         return ReportActionNotArray(action->type, field);
 
-    act = (XkbRedirectKeyAction *) action;
+    act = (struct xkb_redirect_key_action *) action;
     switch (field)
     {
     case F_Keycode:
@@ -1055,8 +1053,7 @@ HandleRedirectKey(XkbcDescPtr xkb,
         if (!FindNamedKey(xkb, tmp, &t1, True, CreateKeyNames(xkb), 0))
         {
             return ReportNotFound(action->type, field, "Key",
-                                  XkbKeyNameText(rtrn.keyName.name,
-                                                 XkbMessage));
+                                  XkbcKeyNameText(rtrn.keyName.name));
         }
         act->new_key = t1;
         return True;
@@ -1072,15 +1069,11 @@ HandleRedirectKey(XkbcDescPtr xkb,
                 act->mods &= ~(t2 & 0xff);
 
             t2 = (t2 >> 8) & 0xffff;
-            vmods = XkbSARedirectVMods(act);
-            vmask = XkbSARedirectVModsMask(act);
-            vmask |= t2;
+            XkbSARedirectSetVModsMask(act, XkbSARedirectVModsMask(act) | t2);
             if (field == F_Modifiers)
-                vmods |= t2;
+                XkbSARedirectSetVMods(act, XkbSARedirectVMods(act) | t2);
             else
-                vmods &= ~t2;
-            XkbSARedirectSetVMods(act, vmods);
-            XkbSARedirectSetVModsMask(act, vmask);
+                XkbSARedirectSetVMods(act, XkbSARedirectVMods(act) & ~t2);
             return True;
         }
         return True;
@@ -1090,7 +1083,7 @@ HandleRedirectKey(XkbcDescPtr xkb,
 
 static Bool
 HandleDeviceBtn(XkbcDescPtr xkb,
-                XkbAnyAction * action,
+                struct xkb_any_action * action,
                 unsigned field, ExprDef * array_ndx, ExprDef * value)
 {
     ExprResult rtrn;
@@ -1107,7 +1100,7 @@ HandleDeviceBtn(XkbcDescPtr xkb,
         if ((rtrn.ival < 0) || (rtrn.ival > 255))
         {
             ERROR("Button must specify default or be in the range 1..255\n");
-            ACTION1("Illegal button value %d ignored\n", rtrn.ival);
+            ACTION("Illegal button value %d ignored\n", rtrn.ival);
             return False;
         }
         act->button = rtrn.ival;
@@ -1133,7 +1126,7 @@ HandleDeviceBtn(XkbcDescPtr xkb,
         if ((rtrn.ival < 0) || (rtrn.ival > 255))
         {
             ERROR("The count field must have a value in the range 0..255\n");
-            ACTION1("Illegal count %d ignored\n", rtrn.ival);
+            ACTION("Illegal count %d ignored\n", rtrn.ival);
             return False;
         }
         act->count = rtrn.ival;
@@ -1149,7 +1142,7 @@ HandleDeviceBtn(XkbcDescPtr xkb,
         if ((rtrn.ival < 0) || (rtrn.ival > 255))
         {
             ERROR("Device must specify default or be in the range 1..255\n");
-            ACTION1("Illegal device value %d ignored\n", rtrn.ival);
+            ACTION("Illegal device value %d ignored\n", rtrn.ival);
             return False;
         }
         act->device = rtrn.ival;
@@ -1160,7 +1153,7 @@ HandleDeviceBtn(XkbcDescPtr xkb,
 
 static Bool
 HandleDeviceValuator(XkbcDescPtr xkb,
-                     XkbAnyAction * action,
+                     struct xkb_any_action * action,
                      unsigned field, ExprDef * array_ndx, ExprDef * value)
 {
 #if 0
@@ -1175,7 +1168,7 @@ HandleDeviceValuator(XkbcDescPtr xkb,
 
 static Bool
 HandlePrivate(XkbcDescPtr xkb,
-              XkbAnyAction * action,
+              struct xkb_any_action * action,
               unsigned field, ExprDef * array_ndx, ExprDef * value)
 {
     ExprResult rtrn;
@@ -1188,7 +1181,7 @@ HandlePrivate(XkbcDescPtr xkb,
         if ((rtrn.ival < 0) || (rtrn.ival > 255))
         {
             ERROR("Private action type must be in the range 0..255\n");
-            ACTION1("Illegal type %d ignored\n", rtrn.ival);
+            ACTION("Illegal type %d ignored\n", rtrn.ival);
             return False;
         }
         action->type = rtrn.uval;
@@ -1204,11 +1197,12 @@ HandlePrivate(XkbcDescPtr xkb,
                 if ((len < 1) || (len > 7))
                 {
                     WARN("A private action has 7 data bytes\n");
-                    ACTION1("Extra %d bytes ignored\n", len - 6);
+                    ACTION("Extra %d bytes ignored\n", len - 6);
                     return False;
                 }
-                strncpy((char *) action->data, rtrn.str, 7);
+                strncpy((char *) action->pad, rtrn.str, XkbcAnyActionDataSize);
             }
+            free(rtrn.str);
             return True;
         }
         else
@@ -1221,10 +1215,10 @@ HandlePrivate(XkbcDescPtr xkb,
                 return False;
             }
             ndx = rtrn.uval;
-            if (ndx > 6)
+            if (ndx >= XkbcAnyActionDataSize)
             {
-                ERROR("The data for a private action is 7 bytes long\n");
-                ACTION1("Attempt to use data[%d] ignored\n", ndx);
+                ERROR("The data for a private action is 18 bytes long\n");
+                ACTION("Attempt to use data[%d] ignored\n", ndx);
                 return False;
             }
             if (!ExprResolveInteger(value, &rtrn, NULL, NULL))
@@ -1232,10 +1226,10 @@ HandlePrivate(XkbcDescPtr xkb,
             if ((rtrn.ival < 0) || (rtrn.ival > 255))
             {
                 ERROR("All data for a private action must be 0..255\n");
-                ACTION1("Illegal datum %d ignored\n", rtrn.ival);
+                ACTION("Illegal datum %d ignored\n", rtrn.ival);
                 return False;
             }
-            action->data[ndx] = rtrn.uval;
+            action->pad[ndx] = rtrn.uval;
             return True;
         }
     }
@@ -1243,7 +1237,7 @@ HandlePrivate(XkbcDescPtr xkb,
 }
 
 typedef Bool(*actionHandler) (XkbcDescPtr /* xkb */ ,
-                              XkbAnyAction * /* action */ ,
+                              struct xkb_any_action * /* action */ ,
                               unsigned /* field */ ,
                               ExprDef * /* array_ndx */ ,
                               ExprDef * /* value */
@@ -1277,13 +1271,13 @@ static actionHandler handleAction[XkbSA_NumActions + 1] = {
 /***====================================================================***/
 
 static void
-ApplyActionFactoryDefaults(XkbAction * action)
+ApplyActionFactoryDefaults(union xkb_action * action)
 {
     if (action->type == XkbSA_SetPtrDflt)
     {                           /* increment default button */
         action->dflt.affect = XkbSA_AffectDfltBtn;
         action->dflt.flags = 0;
-        XkbSASetPtrDfltValue(&action->dflt, 1);
+        action->dflt.value = 1;
     }
     else if (action->type == XkbSA_ISOLock)
     {
@@ -1296,7 +1290,7 @@ ApplyActionFactoryDefaults(XkbAction * action)
 int
 HandleActionDef(ExprDef * def,
                 XkbcDescPtr xkb,
-                XkbAnyAction * action, unsigned mergeMode, ActionInfo * info)
+                struct xkb_any_action * action, unsigned mergeMode, ActionInfo * info)
 {
     ExprDef *arg;
     register char *str;
@@ -1307,11 +1301,11 @@ HandleActionDef(ExprDef * def,
 
     if (def->op != ExprActionDecl)
     {
-        ERROR1("Expected an action definition, found %s\n",
+        ERROR("Expected an action definition, found %s\n",
                exprOpText(def->op));
         return False;
     }
-    str = XkbcAtomGetString(NULL, def->value.action.name);
+    str = XkbcAtomText(def->value.action.name);
     if (!str)
     {
         WSGO("Missing name in action definition!!\n");
@@ -1319,13 +1313,13 @@ HandleActionDef(ExprDef * def,
     }
     if (!stringToAction(str, &tmp))
     {
-        ERROR1("Unknown action %s\n", str);
+        ERROR("Unknown action %s\n", str);
         return False;
     }
     action->type = hndlrType = tmp;
     if (action->type != XkbSA_NoAction)
     {
-        ApplyActionFactoryDefaults((XkbAction *) action);
+        ApplyActionFactoryDefaults((union xkb_action *) action);
         while (info)
         {
             if ((info->action == XkbSA_NoAction)
@@ -1373,15 +1367,21 @@ HandleActionDef(ExprDef * def,
         if (elemRtrn.str != NULL)
         {
             ERROR("Cannot change defaults in an action definition\n");
-            ACTION2("Ignoring attempt to change %s.%s\n", elemRtrn.str,
+            ACTION("Ignoring attempt to change %s.%s\n", elemRtrn.str,
                     fieldRtrn.str);
+            free(elemRtrn.str);
+            free(fieldRtrn.str);
             return False;
         }
         if (!stringToField(fieldRtrn.str, &fieldNdx))
         {
-            ERROR1("Unknown field name %s\n", uStringText(fieldRtrn.str));
+            ERROR("Unknown field name %s\n", uStringText(fieldRtrn.str));
+            free(elemRtrn.str);
+            free(fieldRtrn.str);
             return False;
         }
+        free(elemRtrn.str);
+        free(fieldRtrn.str);
         if (!(*handleAction[hndlrType])
             (xkb, action, fieldNdx, arrayRtrn, value))
         {
@@ -1415,17 +1415,22 @@ SetActionField(XkbcDescPtr xkb,
     else
     {
         if (!stringToAction(elem, &new->action))
+        {
+            free(new);
             return False;
+        }
         if (new->action == XkbSA_NoAction)
         {
-            ERROR1("\"%s\" is not a valid field in a NoAction action\n",
+            ERROR("\"%s\" is not a valid field in a NoAction action\n",
                    field);
+            free(new);
             return False;
         }
     }
     if (!stringToField(field, &new->field))
     {
-        ERROR1("\"%s\" is not a legal field name\n", field);
+        ERROR("\"%s\" is not a legal field name\n", field);
+        free(new);
         return False;
     }
     new->array_ndx = array_ndx;
@@ -1454,12 +1459,12 @@ ActionsInit(void)
         constTrue.common.next = NULL;
         constTrue.op = ExprIdent;
         constTrue.type = TypeBoolean;
-        constTrue.value.str = XkbcInternAtom(NULL, "true", False);
+        constTrue.value.str = XkbcInternAtom("true", False);
         constFalse.common.stmtType = StmtExpr;
         constFalse.common.next = NULL;
         constFalse.op = ExprIdent;
         constFalse.type = TypeBoolean;
-        constFalse.value.str = XkbcInternAtom(NULL, "false", False);
+        constFalse.value.str = XkbcInternAtom("false", False);
         actionsInitialized = 1;
     }
     return;