[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: cpio -o -H newc
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2008-03-31 2:03:21
Message-ID: 200803310403.21619.vda.linux () googlemail ! com
[Download RAW message or body]

hi Pascal,

On Saturday 29 March 2008 21:25, Pascal Bellard wrote:
> Please find attached a patch-file to add 'cpio -o -H newc' feature.

Patch seems to have rather inconsistent tab/space usage
and occasional broken indentation (or maybe it only looks
wrong when I set tab == 8 spaces...)

               struct inodes_s *inode = xzalloc(sizeof(*inode));
+
+               if (!inode) {
+       abort_cpio_o:
+                       bb_perror_msg_and_die(name);
+               }

xzalloc never returns NULL.

+               if (line) {
+               /* Strip leading `./' from the filename.  */
+               for (name = line; name[0] == '.' && name[1] == '/';) {
+                   while (*++name == '/');
+               }

I find this use of for() to be a bit of excercise in
"how can I use for() for this?". I prefer "how to do it
efficiently, _yet_ not hard to understand?"
In this case:

               name = line;
               while (name[0] == '.' && name[1] == '/') {
                       while (*++name == '/')
                               continue;
               }
--
vda

_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic