Branch: Tag:

2018-01-19

2018-01-19 16:14:39 by Martin Nilsson <nilsson@fastmail.com>

Use the ALLOC_STRUCT macro when possible.

520:    {    struct buffer ob = *initial;    int offset2 = read_uint( buff ); -  struct tile *tile = xalloc(sizeof(struct tile)); +  struct tile *tile = ALLOC_STRUCT(tile);    read_data( &ob, offset );    if(last_tile)    last_tile->next = tile;
572:    tmp = read_property( buff );    if(tmp.type)    { -  struct property *s = xalloc(sizeof(struct property)); +  struct property *s = ALLOC_STRUCT(property);    *s = tmp;    s->next = res.first_property;    res.first_property = s;
609:    tmp = read_property( buff );    if(tmp.type)    { -  struct property *s = xalloc( sizeof(struct property )); +  struct property *s = ALLOC_STRUCT(property);    *s = tmp;    s->next = res.first_property;    res.first_property = s;
648:    tmp = read_property( buff );    if(tmp.type)    { -  struct property *s=xalloc( sizeof(struct property )); +  struct property *s=ALLOC_STRUCT(property);    *s = tmp;    s->next = res.first_property;    res.first_property = s;
661:    if(lm_offset)    {    struct buffer loffset = *initial; -  struct layer_mask *m=xalloc(sizeof(struct layer_mask)); +  struct layer_mask *m=ALLOC_STRUCT(layer_mask);    res.mask = m;    read_data( &loffset, lm_offset );    memset(m, 0, sizeof( struct layer_mask ));
716:    tmp = read_property( data );    if(tmp.type)    { -  struct property *s=xalloc( sizeof(struct property )); +  struct property *s=ALLOC_STRUCT(property);    *s = tmp;    s->next = res.first_property;    res.first_property = s;
731:    tmp = read_layer( &layer_data, &initial );    if( tmp.width && tmp.height )    { -  struct layer *s = xalloc( sizeof(struct layer)); +  struct layer *s = ALLOC_STRUCT(layer);    *s = tmp;    s->next = res.first_layer;    res.first_layer = s;
746:    tmp = read_channel( &channel_data, &initial );    if( tmp.width && tmp.height )    { -  struct channel *s = xalloc( sizeof(struct channel)); +  struct channel *s = ALLOC_STRUCT(channel);    *s = tmp;    s->next = res.first_channel;    res.first_channel = s;