summaryrefslogtreecommitdiff
path: root/parseutils.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-10 15:33:17 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-11 15:36:06 -0800
commit1fb639c97fc28b8ed66b5553eafbbeed07e4cb09 (patch)
tree9d8da033bf81897198e4ca47b5e5b6efe4a3a90f /parseutils.c
parent8e58b7949ab96180d60fb13f7820d6cc01c228ae (diff)
downloadxorg-app-xkbcomp-1fb639c97fc28b8ed66b5553eafbbeed07e4cb09.tar.gz
Replace malloc()+bzero() pairs with calloc() calls
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'parseutils.c')
-rw-r--r--parseutils.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/parseutils.c b/parseutils.c
index 5c70f81..3ae7de0 100644
--- a/parseutils.c
+++ b/parseutils.c
@@ -451,10 +451,9 @@ ShapeDeclCreate(Atom name, OutlineDef * outlines)
{
ShapeDef *shape;
- shape = malloc(sizeof(ShapeDef));
+ shape = calloc(1, sizeof(ShapeDef));
if (shape != NULL)
{
- bzero(shape, sizeof(ShapeDef));
*shape = (ShapeDef) {
.common.stmtType = StmtShapeDef,
.common.next = NULL,
@@ -478,10 +477,9 @@ OutlineCreate(Atom field, ExprDef * points)
{
OutlineDef *outline;
- outline = malloc(sizeof(OutlineDef));
+ outline = calloc(1, sizeof(OutlineDef));
if (outline != NULL)
{
- bzero(outline, sizeof(OutlineDef));
*outline = (OutlineDef) {
.common.stmtType = StmtOutlineDef,
.common.next = NULL,
@@ -506,10 +504,9 @@ KeyDeclCreate(char *name, ExprDef * expr)
{
KeyDef *key;
- key = malloc(sizeof(KeyDef));
+ key = calloc(1, sizeof(KeyDef));
if (key != NULL)
{
- bzero(key, sizeof(KeyDef));
*key = (KeyDef) {
.common.stmtType = StmtKeyDef,
.common.next = NULL,
@@ -537,10 +534,9 @@ RowDeclCreate(KeyDef * keys)
{
RowDef *row;
- row = malloc(sizeof(RowDef));
+ row = calloc(1, sizeof(RowDef));
if (row != NULL)
{
- bzero(row, sizeof(RowDef));
*row = (RowDef) {
.common.stmtType = StmtRowDef,
.common.next = NULL,
@@ -561,10 +557,9 @@ SectionDeclCreate(Atom name, RowDef * rows)
{
SectionDef *section;
- section = malloc(sizeof(SectionDef));
+ section = calloc(1, sizeof(SectionDef));
if (section != NULL)
{
- bzero(section, sizeof(SectionDef));
*section = (SectionDef) {
.common.stmtType = StmtSectionDef,
.common.next = NULL,
@@ -586,10 +581,9 @@ OverlayKeyCreate(char *under, char *over)
{
OverlayKeyDef *key;
- key = malloc(sizeof(OverlayKeyDef));
+ key = calloc(1, sizeof(OverlayKeyDef));
if (key != NULL)
{
- bzero(key, sizeof(OverlayKeyDef));
*key = (OverlayKeyDef) {
.common.stmtType = StmtOverlayKeyDef
};
@@ -606,10 +600,9 @@ OverlayDeclCreate(Atom name, OverlayKeyDef * keys)
{
OverlayDef *ol;
- ol = malloc(sizeof(OverlayDef));
+ ol = calloc(1, sizeof(OverlayDef));
if (ol != NULL)
{
- bzero(ol, sizeof(OverlayDef));
*ol = (OverlayDef) {
.common.stmtType = StmtOverlayDef,
.name = name,
@@ -629,10 +622,9 @@ DoodadCreate(unsigned type, Atom name, VarDef * body)
{
DoodadDef *doodad;
- doodad = malloc(sizeof(DoodadDef));
+ doodad = calloc(1, sizeof(DoodadDef));
if (doodad != NULL)
{
- bzero(doodad, sizeof(DoodadDef));
*doodad = (DoodadDef) {
.common.stmtType = StmtDoodadDef,
.common.next = NULL,
@@ -857,11 +849,10 @@ CreateXKBFile(int type, char *name, ParseCommon * defs, unsigned flags)
XkbFile *file;
static int fileID;
- file = malloc(sizeof(XkbFile));
+ file = calloc(1, sizeof(XkbFile));
if (file)
{
XkbEnsureSafeMapName(name);
- bzero(file, sizeof(XkbFile));
*file = (XkbFile) {
.type = type,
.topName = uStringDup(name),