> No, people use realloc with variable size arrays at the end of
> structs. xrenewvec (or xresizevec) is a good idea, but you still need
> xrenew (or xresize).
Bernando, you've now got an interface which allows reallocating to a
variable size, but not allocating to one... There's no need for a
rush, let's give people some time to comment before putting this into
libiberty. As DJ says, it's hard to take things out of libiberty.
/* Utility macros to allocate typed memory. Avoids errors like:
struct foo *foo = xmalloc (sizeof struct bar); and memset (foo,
sizeof (struct foo), 0). */
#define XZALLOC(TYPE) ((TYPE*) memset (xmalloc (sizeof (TYPE)), 0, sizeof (TYPE)
))
#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
#define XCALLOC(NMEMB, TYPE) ((TYPE*) xcalloc ((NMEMB), sizeof (TYPE)))