#include <fcntl.h>
#include <errno.h>
#include <sys/stat.h>
+#include <flexmember.h>
#include "character.h"
#include "coding.h"
#include "composite.h"
if (byteorder != XM_TARGETS_TABLE_CUR)
SWAPCARD16 (nitems);
- rec = xmalloc (sizeof *rec + nitems * 4);
+ rec = xmalloc (FLEXSIZEOF (struct xm_targets_table_rec,
+ targets, nitems * 4));
rec->n_targets = nitems;
for (i = 0; i < nitems; ++i)
header.total_data_size = 8 + 2 + ntargets * 4;
recs = xmalloc (sizeof *recs);
- recs[0] = xmalloc (sizeof **recs + ntargets * 4);
+ recs[0] = xmalloc (FLEXSIZEOF (struct xm_targets_table_rec,
+ targets, ntargets * 4));
recs[0]->n_targets = ntargets;
header.target_list_count++;
header.total_data_size += 2 + ntargets * 4;
- recs[header.target_list_count - 1] = xmalloc (sizeof **recs + ntargets * 4);
+ recs[header.target_list_count - 1]
+ = xmalloc (FLEXSIZEOF (struct xm_targets_table_rec,
+ targets, ntargets * 4));
recs[header.target_list_count - 1]->n_targets = ntargets;
for (i = 0; i < ntargets; ++i)