From: Jim Meyering Date: Sun, 2 Nov 2003 20:24:14 +0000 (+0000) Subject: (new_item, record_relation): Use `sizeof *var' rather X-Git-Tag: v5.1.0~269 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0abb38e5874b51c6e33cdfe428021ea82425a3f9;p=thirdparty%2Fcoreutils.git (new_item, record_relation): Use `sizeof *var' rather than `sizeof EXPLICIT_TYPE'. The former is more maintainable and usually shorter. --- diff --git a/src/tsort.c b/src/tsort.c index c6b7855a45..3cae86d206 100644 --- a/src/tsort.c +++ b/src/tsort.c @@ -111,7 +111,7 @@ With no FILE, or when FILE is -, read standard input.\n\ static struct item * new_item (const char *str) { - struct item *k = xmalloc (sizeof (struct item)); + struct item *k = xmalloc (sizeof *k); k->str = (str ? xstrdup (str): NULL); k->left = k->right = NULL; @@ -286,7 +286,7 @@ record_relation (struct item *j, struct item *k) if (!STREQ (j->str, k->str)) { k->count++; - p = xmalloc (sizeof (struct successor)); + p = xmalloc (sizeof *p); p->suc = k; p->next = j->top; j->top = p;