summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-10 13:39:10 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-11 14:35:34 -0800
commit265ea3a77418df2744575f1168f89a33f01e72d4 (patch)
tree7b67b74b0a3b3e519f80b78e56be491acd748653
parent81e51cf1ff494131827df487a0f538c3b07e0407 (diff)
downloadxorg-app-xkbcomp-265ea3a77418df2744575f1168f89a33f01e72d4.tar.gz
Replace uAlloc() and uTypedAlloc() with direct malloc() calls
All these wrappers did was mess with types. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--action.c2
-rw-r--r--compat.c2
-rw-r--r--expr.c2
-rw-r--r--geometry.c10
-rw-r--r--indicators.c2
-rw-r--r--keycodes.c2
-rw-r--r--keytypes.c6
-rw-r--r--listing.c2
-rw-r--r--parseutils.c52
-rw-r--r--symbols.c2
-rw-r--r--utils.c9
-rw-r--r--utils.h11
-rw-r--r--xkbpath.c2
13 files changed, 48 insertions, 56 deletions
diff --git a/action.c b/action.c
index 7aae498..c6ff547 100644
--- a/action.c
+++ b/action.c
@@ -1449,7 +1449,7 @@ SetActionField(XkbDescPtr xkb,
if (!actionsInitialized)
ActionsInit();
- new = uTypedAlloc(ActionInfo);
+ new = malloc(sizeof(ActionInfo));
if (new == NULL)
{
WSGO("Couldn't allocate space for action default\n");
diff --git a/compat.c b/compat.c
index 1902401..2efa5dc 100644
--- a/compat.c
+++ b/compat.c
@@ -161,7 +161,7 @@ NextInterp(CompatInfo * info)
{
SymInterpInfo *si;
- si = uTypedAlloc(SymInterpInfo);
+ si = malloc(sizeof(SymInterpInfo));
if (si)
{
bzero((char *) si, sizeof(SymInterpInfo));
diff --git a/expr.c b/expr.c
index b3d8957..8351f2c 100644
--- a/expr.c
+++ b/expr.c
@@ -765,7 +765,7 @@ ExprResolveString(ExprDef * expr,
int len;
char *new;
len = strlen(leftRtrn.str) + strlen(rightRtrn.str) + 1;
- new = (char *) uAlloc(len);
+ new = malloc(len);
if (new)
{
snprintf(new, len, "%s%s", leftRtrn.str, rightRtrn.str);
diff --git a/geometry.c b/geometry.c
index 49ed6dd..0f375c5 100644
--- a/geometry.c
+++ b/geometry.c
@@ -702,7 +702,7 @@ NextProperty(GeometryInfo * info)
{
PropertyInfo *pi;
- pi = uTypedAlloc(PropertyInfo);
+ pi = malloc(sizeof(PropertyInfo));
if (pi)
{
bzero((char *) pi, sizeof(PropertyInfo));
@@ -780,7 +780,7 @@ NextShape(GeometryInfo * info)
{
ShapeInfo *si;
- si = uTypedAlloc(ShapeInfo);
+ si = malloc(sizeof(ShapeInfo));
if (si)
{
bzero((char *) si, sizeof(ShapeInfo));
@@ -1077,7 +1077,7 @@ NextSection(GeometryInfo * info)
{
SectionInfo *si;
- si = uTypedAlloc(SectionInfo);
+ si = malloc(sizeof(SectionInfo));
if (si)
{
*si = info->dfltSection;
@@ -1167,7 +1167,7 @@ NextRow(SectionInfo * si)
{
RowInfo *row;
- row = uTypedAlloc(RowInfo);
+ row = malloc(sizeof(RowInfo));
if (row)
{
*row = si->dfltRow;
@@ -1204,7 +1204,7 @@ NextKey(RowInfo * row)
{
KeyInfo *key;
- key = uTypedAlloc(KeyInfo);
+ key = malloc(sizeof(KeyInfo));
if (key)
{
*key = row->dfltKey;
diff --git a/indicators.c b/indicators.c
index 4eaa6ae..0e82d4a 100644
--- a/indicators.c
+++ b/indicators.c
@@ -147,7 +147,7 @@ AddIndicatorMap(LEDInfo * oldLEDs, LEDInfo * new)
last = old;
}
/* new definition */
- old = uTypedAlloc(LEDInfo);
+ old = malloc(sizeof(LEDInfo));
if (!old)
{
WSGO("Couldn't allocate indicator map\n");
diff --git a/keycodes.c b/keycodes.c
index 6ec4435..b6efdd1 100644
--- a/keycodes.c
+++ b/keycodes.c
@@ -117,7 +117,7 @@ NextIndicatorName(KeyNamesInfo * info)
{
IndicatorNameInfo *ii;
- ii = uTypedAlloc(IndicatorNameInfo);
+ ii = malloc(sizeof(IndicatorNameInfo));
if (ii)
{
InitIndicatorNameInfo(ii, info);
diff --git a/keytypes.c b/keytypes.c
index a1db622..79e09fc 100644
--- a/keytypes.c
+++ b/keytypes.c
@@ -183,7 +183,7 @@ InitKeyTypesInfo(KeyTypesInfo * info, XkbDescPtr xkb, KeyTypesInfo * from)
for (PreserveInfo *old = from->dflt.preserve;
old; old = (PreserveInfo *) old->defs.next)
{
- PreserveInfo *new = uTypedAlloc(PreserveInfo);
+ PreserveInfo *new = malloc(sizeof(PreserveInfo));
if (!new)
return;
*new = *old;
@@ -245,7 +245,7 @@ NextKeyType(KeyTypesInfo * info)
{
KeyTypeInfo *type;
- type = uTypedAlloc(KeyTypeInfo);
+ type = malloc(sizeof(KeyTypeInfo));
if (type != NULL)
{
bzero(type, sizeof(KeyTypeInfo));
@@ -588,7 +588,7 @@ AddPreserve(XkbDescPtr xkb,
}
return True;
}
- old = uTypedAlloc(PreserveInfo);
+ old = malloc(sizeof(PreserveInfo));
if (!old)
{
WSGO("Couldn't allocate preserve in %s\n", TypeTxt(type));
diff --git a/listing.c b/listing.c
index 92246e2..b747482 100644
--- a/listing.c
+++ b/listing.c
@@ -311,7 +311,7 @@ AddDirectory(char *head, char *ptrn, char *rest, char *map)
if (ptrn && (!XkbNameMatchesPattern(filename, ptrn)))
continue;
tmpsize = (head ? strlen(head) : 0) + strlen(filename) + 2;
- tmp = uAlloc(tmpsize);
+ tmp = malloc(tmpsize);
if (!tmp)
continue;
snprintf(tmp, tmpsize, "%s%s%s",
diff --git a/parseutils.c b/parseutils.c
index dac463a..539aff9 100644
--- a/parseutils.c
+++ b/parseutils.c
@@ -57,7 +57,7 @@ ExprDef *
ExprCreate(unsigned op, unsigned type)
{
ExprDef *expr;
- expr = uTypedAlloc(ExprDef);
+ expr = malloc(sizeof(ExprDef));
if (expr)
{
*expr = (ExprDef) {
@@ -79,7 +79,7 @@ ExprDef *
ExprCreateUnary(unsigned op, unsigned type, ExprDef * child)
{
ExprDef *expr;
- expr = uTypedAlloc(ExprDef);
+ expr = malloc(sizeof(ExprDef));
if (expr)
{
*expr = (ExprDef) {
@@ -102,7 +102,7 @@ ExprDef *
ExprCreateBinary(unsigned op, ExprDef * left, ExprDef * right)
{
ExprDef *expr;
- expr = uTypedAlloc(ExprDef);
+ expr = malloc(sizeof(ExprDef));
if (expr)
{
*expr = (ExprDef) {
@@ -132,7 +132,7 @@ KeycodeCreate(char *name, ExprDef * value)
{
KeycodeDef *def;
- def = uTypedAlloc(KeycodeDef);
+ def = malloc(sizeof(KeycodeDef));
if (def)
{
*def = (KeycodeDef) {
@@ -156,7 +156,7 @@ KeyAliasCreate(char *alias, char *real)
{
KeyAliasDef *def;
- def = uTypedAlloc(KeyAliasDef);
+ def = malloc(sizeof(KeyAliasDef));
if (def)
{
*def = (KeyAliasDef) {
@@ -180,7 +180,7 @@ VModDef *
VModCreate(Atom name, ExprDef * value)
{
VModDef *def;
- def = uTypedAlloc(VModDef);
+ def = malloc(sizeof(VModDef));
if (def)
{
*def = (VModDef) {
@@ -202,7 +202,7 @@ VarDef *
VarCreate(ExprDef * name, ExprDef * value)
{
VarDef *def;
- def = uTypedAlloc(VarDef);
+ def = malloc(sizeof(VarDef));
if (def)
{
*def = (VarDef) {
@@ -237,7 +237,7 @@ InterpCreate(const char *sym_str, ExprDef * match)
{
InterpDef *def;
- def = uTypedAlloc(InterpDef);
+ def = malloc(sizeof(InterpDef));
if (def)
{
*def = (InterpDef) {
@@ -263,7 +263,7 @@ KeyTypeCreate(Atom name, VarDef * body)
{
KeyTypeDef *def;
- def = uTypedAlloc(KeyTypeDef);
+ def = malloc(sizeof(KeyTypeDef));
if (def)
{
*def = (KeyTypeDef) {
@@ -287,7 +287,7 @@ SymbolsCreate(char *keyName, ExprDef * symbols)
{
SymbolsDef *def;
- def = uTypedAlloc(SymbolsDef);
+ def = malloc(sizeof(SymbolsDef));
if (def)
{
*def = (SymbolsDef) {
@@ -312,7 +312,7 @@ GroupCompatCreate(int group, ExprDef * val)
{
GroupCompatDef *def;
- def = uTypedAlloc(GroupCompatDef);
+ def = malloc(sizeof(GroupCompatDef));
if (def)
{
*def = (GroupCompatDef) {
@@ -336,7 +336,7 @@ ModMapCreate(Atom modifier, ExprDef * keys)
{
ModMapDef *def;
- def = uTypedAlloc(ModMapDef);
+ def = malloc(sizeof(ModMapDef));
if (def)
{
*def = (ModMapDef) {
@@ -360,7 +360,7 @@ IndicatorMapCreate(Atom name, VarDef * body)
{
IndicatorMapDef *def;
- def = uTypedAlloc(IndicatorMapDef);
+ def = malloc(sizeof(IndicatorMapDef));
if (def)
{
*def = (IndicatorMapDef) {
@@ -384,7 +384,7 @@ IndicatorNameCreate(int ndx, ExprDef * name, Bool virtual)
{
IndicatorNameDef *def;
- def = uTypedAlloc(IndicatorNameDef);
+ def = malloc(sizeof(IndicatorNameDef));
if (def)
{
*def = (IndicatorNameDef) {
@@ -409,7 +409,7 @@ ActionCreate(Atom name, ExprDef * args)
{
ExprDef *act;
- act = uTypedAlloc(ExprDef);
+ act = malloc(sizeof(ExprDef));
if (act)
{
*act = (ExprDef) {
@@ -451,7 +451,7 @@ ShapeDeclCreate(Atom name, OutlineDef * outlines)
{
ShapeDef *shape;
- shape = uTypedAlloc(ShapeDef);
+ shape = malloc(sizeof(ShapeDef));
if (shape != NULL)
{
bzero(shape, sizeof(ShapeDef));
@@ -478,7 +478,7 @@ OutlineCreate(Atom field, ExprDef * points)
{
OutlineDef *outline;
- outline = uTypedAlloc(OutlineDef);
+ outline = malloc(sizeof(OutlineDef));
if (outline != NULL)
{
bzero(outline, sizeof(OutlineDef));
@@ -506,7 +506,7 @@ KeyDeclCreate(char *name, ExprDef * expr)
{
KeyDef *key;
- key = uTypedAlloc(KeyDef);
+ key = malloc(sizeof(KeyDef));
if (key != NULL)
{
bzero(key, sizeof(KeyDef));
@@ -537,7 +537,7 @@ RowDeclCreate(KeyDef * keys)
{
RowDef *row;
- row = uTypedAlloc(RowDef);
+ row = malloc(sizeof(RowDef));
if (row != NULL)
{
bzero(row, sizeof(RowDef));
@@ -561,7 +561,7 @@ SectionDeclCreate(Atom name, RowDef * rows)
{
SectionDef *section;
- section = uTypedAlloc(SectionDef);
+ section = malloc(sizeof(SectionDef));
if (section != NULL)
{
bzero(section, sizeof(SectionDef));
@@ -586,7 +586,7 @@ OverlayKeyCreate(char *under, char *over)
{
OverlayKeyDef *key;
- key = uTypedAlloc(OverlayKeyDef);
+ key = malloc(sizeof(OverlayKeyDef));
if (key != NULL)
{
bzero(key, sizeof(OverlayKeyDef));
@@ -606,7 +606,7 @@ OverlayDeclCreate(Atom name, OverlayKeyDef * keys)
{
OverlayDef *ol;
- ol = uTypedAlloc(OverlayDef);
+ ol = malloc(sizeof(OverlayDef));
if (ol != NULL)
{
bzero(ol, sizeof(OverlayDef));
@@ -629,7 +629,7 @@ DoodadCreate(unsigned type, Atom name, VarDef * body)
{
DoodadDef *doodad;
- doodad = uTypedAlloc(DoodadDef);
+ doodad = malloc(sizeof(DoodadDef));
if (doodad != NULL)
{
bzero(doodad, sizeof(DoodadDef));
@@ -723,10 +723,10 @@ IncludeCreate(char *str, unsigned merge)
haveSelf = True;
}
if (first == NULL)
- first = incl = uTypedAlloc(IncludeStmt);
+ first = incl = malloc(sizeof(IncludeStmt));
else
{
- incl->next = uTypedAlloc(IncludeStmt);
+ incl->next = malloc(sizeof(IncludeStmt));
incl = incl->next;
}
if (incl)
@@ -861,7 +861,7 @@ CreateXKBFile(int type, char *name, ParseCommon * defs, unsigned flags)
XkbFile *file;
static int fileID;
- file = uTypedAlloc(XkbFile);
+ file = malloc(sizeof(XkbFile));
if (file)
{
XkbEnsureSafeMapName(name);
diff --git a/symbols.c b/symbols.c
index 18e9a2b..ba5af49 100644
--- a/symbols.c
+++ b/symbols.c
@@ -682,7 +682,7 @@ AddModMapEntry(SymbolsInfo * info, ModMapEntry * new)
return True;
}
}
- mm = uTypedAlloc(ModMapEntry);
+ mm = malloc(sizeof(ModMapEntry));
if (mm == NULL)
{
WSGO("Could not allocate modifier map entry\n");
diff --git a/utils.c b/utils.c
index ac920af..2d605dd 100644
--- a/utils.c
+++ b/utils.c
@@ -30,13 +30,6 @@
#include <stdlib.h>
#include <stdarg.h>
-/***====================================================================***/
-
-Opaque
-uAlloc(unsigned size)
-{
- return ((Opaque) malloc(size));
-}
/***====================================================================***/
@@ -315,7 +308,7 @@ uStringDup(const char *str)
if (str == NULL)
return NULL;
- rtrn = (char *) uAlloc(strlen(str) + 1);
+ rtrn = malloc(strlen(str) + 1);
strcpy(rtrn, str);
return rtrn;
}
diff --git a/utils.h b/utils.h
index 0053c84..29e4205 100644
--- a/utils.h
+++ b/utils.h
@@ -29,15 +29,17 @@
/***====================================================================***/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
+#include <stdlib.h>
#include <X11/Xos.h>
#include <X11/Xfuncproto.h>
#include <X11/Xfuncs.h>
#include <stddef.h>
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
#ifndef NUL
#define NUL '\0'
@@ -74,8 +76,6 @@ typedef int Comparison;
/***====================================================================***/
-extern Opaque uAlloc(unsigned /* size */
- );
extern Opaque uCalloc(unsigned /* n */ ,
unsigned /* size */
);
@@ -90,7 +90,6 @@ extern Opaque uRecalloc(Opaque /* old */ ,
extern void uFree(Opaque /* ptr */
);
-#define uTypedAlloc(t) ((t *)uAlloc((unsigned)sizeof(t)))
#define uTypedCalloc(n,t) ((t *)uCalloc((unsigned)n,(unsigned)sizeof(t)))
#define uTypedRealloc(pO,n,t) ((t *)uRealloc((Opaque)pO,((unsigned)n)*sizeof(t)))
#define uTypedRecalloc(pO,o,n,t) ((t *)uRecalloc((Opaque)pO,((unsigned)o),((unsigned)n),sizeof(t)))
diff --git a/xkbpath.c b/xkbpath.c
index dc9a1df..0310872 100644
--- a/xkbpath.c
+++ b/xkbpath.c
@@ -321,7 +321,7 @@ XkbAddFileToCache(char *name, unsigned type, char *path, void *data)
return old;
}
}
- entry = uTypedAlloc(FileCacheEntry);
+ entry = malloc(sizeof(FileCacheEntry));
if (entry != NULL)
{
*entry = (FileCacheEntry) {