Alexandre Julliard : widl: xmalloc shouldn't initialize to zero,
do that explicitly where needed.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Aug 28 05:09:12 CDT 2006
Module: wine
Branch: master
Commit: 883aef172d4efa7fe1bc3d37ad89ae2545ca58cf
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=883aef172d4efa7fe1bc3d37ad89ae2545ca58cf
Author: Alexandre Julliard <julliard at winehq.org>
Date: Sat Aug 26 21:39:44 2006 +0200
widl: xmalloc shouldn't initialize to zero, do that explicitly where needed.
---
tools/widl/parser.y | 2 ++
tools/widl/typelib.c | 4 ++++
tools/widl/utils.c | 11 +++--------
tools/widl/widltypes.h | 2 +-
tools/widl/write_msft.c | 1 +
5 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 2c1e029..ead02cb 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -1144,6 +1144,7 @@ static type_t *make_type(unsigned char t
t->sign = 0;
t->defined = FALSE;
t->written = FALSE;
+ t->user_types_registered = FALSE;
t->typelib_idx = -1;
INIT_LINK(t);
return t;
@@ -1203,6 +1204,7 @@ static var_t *make_var(char *name)
v->name = name;
v->ptr_level = 0;
v->type = NULL;
+ v->args = NULL;
v->tname = NULL;
v->attrs = NULL;
v->array = NULL;
diff --git a/tools/widl/typelib.c b/tools/widl/typelib.c
index 7a1b246..5218070 100644
--- a/tools/widl/typelib.c
+++ b/tools/widl/typelib.c
@@ -220,6 +220,8 @@ void start_typelib(char *name, attr_t *a
typelib->name = xstrdup(name);
typelib->filename = xstrdup(typelib_name);
typelib->attrs = attrs;
+ typelib->entry = NULL;
+ typelib->importlibs = NULL;
}
void end_typelib(void)
@@ -373,6 +375,7 @@ static void read_msft_importlib(importli
importlib->importinfos[i].flags |= MSFT_IMPINFO_OFFSET_IS_GUID;
msft_read_guid(fd, &segdir, base.posguid, &importlib->importinfos[i].guid);
}
+ else memset( &importlib->importinfos[i].guid, 0, sizeof(importlib->importinfos[i].guid));
tlb_lseek(fd, segdir.pNametab.offset + base.NameOffset);
tlb_read(fd, &nameintro, sizeof(nameintro));
@@ -431,6 +434,7 @@ void add_importlib(const char *name)
chat("add_importlib: %s\n", name);
importlib = xmalloc(sizeof(*importlib));
+ memset( importlib, 0, sizeof(*importlib) );
importlib->name = xstrdup(name);
read_importlib(importlib);
diff --git a/tools/widl/utils.c b/tools/widl/utils.c
index 9f82184..fea0540 100644
--- a/tools/widl/utils.c
+++ b/tools/widl/utils.c
@@ -145,7 +145,7 @@ char *dup_basename(const char *name, con
namelen = strlen(name);
/* +4 for later extension and +1 for '\0' */
- base = (char *)xmalloc(namelen +4 +1);
+ base = xmalloc(namelen +4 +1);
strcpy(base, name);
if(!strcasecmp(name + namelen-extlen, ext))
{
@@ -164,12 +164,7 @@ void *xmalloc(size_t size)
{
error("Virtual memory exhausted.\n");
}
- /*
- * We set it to 0.
- * This is *paramount* because we depend on it
- * just about everywhere in the rest of the code.
- */
- memset(res, 0, size);
+ memset(res, 0x55, size);
return res;
}
@@ -192,6 +187,6 @@ char *xstrdup(const char *str)
char *s;
assert(str != NULL);
- s = (char *)xmalloc(strlen(str)+1);
+ s = xmalloc(strlen(str)+1);
return strcpy(s, str);
}
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index cf0f246..eeaa627 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -49,7 +49,7 @@ #define DECL_LINK(type) \
type *l_next; \
type *l_prev
-#define LINK(x,y) do { x->l_next = y; if (y) y->l_prev = x; } while (0)
+#define LINK(x,y) do { x->l_next = y; x->l_prev = NULL; if (y) y->l_prev = x; } while (0)
#define INIT_LINK(x) do { x->l_next = NULL; x->l_prev = NULL; } while (0)
#define NEXT_LINK(x) ((x)->l_next)
diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c
index cac1f7f..2307493 100644
--- a/tools/widl/write_msft.c
+++ b/tools/widl/write_msft.c
@@ -1734,6 +1734,7 @@ static msft_typeinfo_t *create_msft_type
chat("create_msft_typeinfo: name %s kind %d\n", name, kind);
msft_typeinfo = xmalloc(sizeof(*msft_typeinfo));
+ memset( msft_typeinfo, 0, sizeof(*msft_typeinfo) );
msft_typeinfo->typelib = typelib;
More information about the wine-cvs
mailing list