From: Jim Meyering Date: Tue, 4 Nov 2003 06:07:01 +0000 (+0000) Subject: (initseq, add_field, make_blank): Use `sizeof *var' rather X-Git-Tag: v5.1.0~260 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d63bdf9a4d66e18abec04d6455efabb3c54e44a2;p=thirdparty%2Fcoreutils.git (initseq, add_field, make_blank): Use `sizeof *var' rather than `sizeof EXPLICIT_TYPE'. The former is more maintainable and usually shorter. --- diff --git a/src/join.c b/src/join.c index 16097837e0..5b6ed31e7a 100644 --- a/src/join.c +++ b/src/join.c @@ -288,7 +288,7 @@ initseq (struct seq *seq) { seq->count = 0; seq->alloc = 1; - seq->lines = xmalloc (seq->alloc * sizeof (struct line)); + seq->lines = xmalloc (seq->alloc * sizeof *seq->lines); } /* Read a line from FP and add it to SEQ. Return 0 if EOF, 1 otherwise. */ @@ -609,7 +609,7 @@ add_field (int file, int field) assert (file == 0 || file == 1 || file == 2); assert (file == 0 ? field < 0 : field >= 0); - o = xmalloc (sizeof (struct outlist)); + o = xmalloc (sizeof *o); o->file = file; o->field = field; o->next = NULL; @@ -720,8 +720,7 @@ make_blank (struct line *blank, int count) blank->buf.size = blank->buf.length = count + 1; blank->buf.buffer = xmalloc (blank->buf.size); buffer = (unsigned char *) blank->buf.buffer; - blank->fields = fields = - xmalloc (sizeof (struct field) * count); + blank->fields = fields = xmalloc (count * sizeof *fields); for (i = 0; i < count; i++) { buffer[i] = '\t';