Initialize ef_type and uid automatically in ef_extend()

New struct emptypedstr to avoid depending on empobj.h there.

Remove now superfluous manual initializations elsewhere.

This doesn't fix any missing initializations.
This commit is contained in:
Markus Armbruster 2008-02-24 11:07:18 +01:00
parent d628679a24
commit 6cd3d55c4e
9 changed files with 28 additions and 32 deletions

View file

@ -475,11 +475,17 @@ static void
do_blank(struct empfile *ep, void *buf, int id, int count)
{
int i;
struct emptypedstr *elt;
memset(buf, 0, count * ep->size);
if (ep->init) {
for (i = 0; i < count; i++)
ep->init(id + i, (char *)buf + i * ep->size);
for (i = 0; i < count; i++) {
elt = (struct emptypedstr *)((char *)buf + i * ep->size);
if (ep->flags & EFF_TYPED) {
elt->ef_type = ep->uid;
elt->uid = id + i;
}
if (ep->init)
ep->init(id + i, (void *)elt);
}
}