]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(add_fs_type, add_excluded_fs_type, main): Use `sizeof *var' rather
authorJim Meyering <jim@meyering.net>
Sun, 2 Nov 2003 20:22:54 +0000 (20:22 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 2 Nov 2003 20:22:54 +0000 (20:22 +0000)
than `sizeof EXPLICIT_TYPE'.
The former is more maintainable and usually shorter.
(main): Also remove anachronistic cast of xmalloc return value.

src/df.c

index 85097a25eb4db9221b6546053fabe4b03699e44e..14a83bc8126be36f069b301ceee40639f970363f 100644 (file)
--- a/src/df.c
+++ b/src/df.c
@@ -697,7 +697,7 @@ add_fs_type (const char *fstype)
 {
   struct fs_type_list *fsp;
 
-  fsp = xmalloc (sizeof (struct fs_type_list));
+  fsp = xmalloc (sizeof *fsp);
   fsp->fs_name = (char *) fstype;
   fsp->fs_next = fs_select_list;
   fs_select_list = fsp;
@@ -710,7 +710,7 @@ add_excluded_fs_type (const char *fstype)
 {
   struct fs_type_list *fsp;
 
-  fsp = xmalloc (sizeof (struct fs_type_list));
+  fsp = xmalloc (sizeof *fsp);
   fsp->fs_name = (char *) fstype;
   fsp->fs_next = fs_exclude_list;
   fs_exclude_list = fsp;
@@ -890,8 +890,7 @@ main (int argc, char **argv)
 
       /* stat all the given entries to make sure they get automounted,
         if necessary, before reading the filesystem table.  */
-      stats = (struct stat *)
-       xmalloc ((argc - optind) * sizeof (struct stat));
+      stats = xmalloc ((argc - optind) * sizeof *stats);
       for (i = optind; i < argc; ++i)
        {
          if (stat (argv[i], &stats[i - optind]))