bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: minor mkdir-p.c and idcache.c clean-up


From: Jim Meyering
Subject: FYI: minor mkdir-p.c and idcache.c clean-up
Date: Thu, 30 Jun 2005 00:03:48 +0200

I've just checked in these changes in both gnulib and coreutils:

2005-06-29  Jim Meyering  <address@hidden>

        * mkdir-p.c (make_dir_parents): Don't apply sizeof to a hard-coded
        type name.  Use the variable name instead.
        * idcache.c (getuser, getuidbyname, getgroup, getgidbyname): Likewise.

Index: mkdir-p.c
===================================================================
RCS file: /fetish/cu/lib/mkdir-p.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -p -u -r1.8 -r1.9
--- mkdir-p.c   15 Jun 2005 08:31:44 -0000      1.8
+++ mkdir-p.c   29 Jun 2005 21:22:06 -0000      1.9
@@ -207,7 +207,7 @@ make_dir_parents (char const *arg,
              if (re_protect)
                {
                  struct ptr_list *new = (struct ptr_list *)
-                   alloca (sizeof (struct ptr_list));
+                   alloca (sizeof *new);
                  new->dirname_end = slash;
                  new->next = leading_dirs;
                  leading_dirs = new;
Index: idcache.c
===================================================================
RCS file: /fetish/cu/lib/idcache.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -p -u -r1.14 -r1.15
--- idcache.c   30 May 2005 07:30:31 -0000      1.14
+++ idcache.c   29 Jun 2005 21:24:44 -0000      1.15
@@ -66,7 +66,7 @@ getuser (uid_t uid)
       return tail->name;
 
   pwent = getpwuid (uid);
-  tail = xmalloc (sizeof (struct userid));
+  tail = xmalloc (sizeof *tail);
   tail->id.u = uid;
   tail->name = pwent ? xstrdup (pwent->pw_name) : NULL;
 
@@ -108,7 +108,7 @@ getuidbyname (const char *user)
     }
 #endif
 
-  tail = xmalloc (sizeof (struct userid));
+  tail = xmalloc (sizeof *tail);
   tail->name = xstrdup (user);
 
   /* Add to the head of the list, so most recently used is first.  */
@@ -142,7 +142,7 @@ getgroup (gid_t gid)
       return tail->name;
 
   grent = getgrgid (gid);
-  tail = xmalloc (sizeof (struct userid));
+  tail = xmalloc (sizeof *tail);
   tail->id.g = gid;
   tail->name = grent ? xstrdup (grent->gr_name) : NULL;
 
@@ -184,7 +184,7 @@ getgidbyname (const char *group)
     }
 #endif
 
-  tail = xmalloc (sizeof (struct userid));
+  tail = xmalloc (sizeof *tail);
   tail->name = xstrdup (group);
 
   /* Add to the head of the list, so most recently used is first.  */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]