Hello, Philippe Mathieu-Daudé, on ven. 06 oct. 2017 20:49:31 -0300, wrote: > --- a/net/slirp.c > +++ b/net/slirp.c > @@ -869,7 +869,7 @@ net_init_slirp_configs(const StringList *fwd, int flags) > while (fwd) { > struct slirp_config_str *config; > > - config = g_malloc0(sizeof(*config)); > + config = g_new0(struct slirp_config_str, 1);
It doesn't really seem like an improvement to me in such case: we don't have overflow issues here, and using sizeof(*config) makes the line clearly correct, while expliciting the struct behind means we need to make sure of the coherency. > diff --git a/slirp/socket.c b/slirp/socket.c > index cb7b5b608d..2eccb68c2e 100644 > --- a/slirp/socket.c > +++ b/slirp/socket.c > @@ -48,7 +48,7 @@ socreate(Slirp *slirp) > { > struct socket *so; > > - so = (struct socket *)malloc(sizeof(struct socket)); > + so = g_new(struct socket, 1); Similarly, here I'd rather write g_malloc(sizeof(*so)); Samuel