diff options
author | Jim Meyering <jim@meyering.net> | 2001-11-03 07:33:32 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2001-11-03 07:33:32 +0000 |
commit | 93b4e4074feaacf770435aa7d71075cac9b0f7b9 (patch) | |
tree | cc91edc918aff19f021037d16ad0040f956c67f1 /src/ls.c | |
parent | f1bafaa2378ae2977fa5d5683c135bfc3b0c8417 (diff) | |
download | coreutils-93b4e4074feaacf770435aa7d71075cac9b0f7b9.tar.xz |
(DEV_INO_PUSH): Avoid unnecessary copies.
(dev_ino_pop): Likewise.
Diffstat (limited to 'src/ls.c')
-rw-r--r-- | src/ls.c | 25 |
1 files changed, 12 insertions, 13 deletions
@@ -892,14 +892,15 @@ static struct obstack subdired_obstack; static struct obstack dev_ino_obstack; /* Push a pair onto the device/inode stack. */ -#define DEV_INO_PUSH(Dev, Ino) \ - do \ - { \ - struct dev_ino di; \ - di.st_dev = (Dev); \ - di.st_ino = (Ino); \ - obstack_grow (&dev_ino_obstack, &di, sizeof (di)); \ - } \ +#define DEV_INO_PUSH(Dev, Ino) \ + do \ + { \ + struct dev_ino *di; \ + obstack_blank (&dev_ino_obstack, sizeof (struct dev_ino)); \ + di = -1 + (struct dev_ino *) obstack_next_free (&dev_ino_obstack); \ + di->st_dev = (Dev); \ + di->st_ino = (Ino); \ + } \ while (0) /* Pop a dev/ino struct off the global dev_ino_obstack @@ -907,11 +908,9 @@ static struct obstack dev_ino_obstack; static struct dev_ino dev_ino_pop (void) { - struct dev_ino di; - assert (sizeof di <= obstack_object_size (&dev_ino_obstack)); - obstack_blank (&dev_ino_obstack, -(int) (sizeof di)); - di = *(struct dev_ino*) obstack_next_free (&dev_ino_obstack); - return di; + assert (sizeof (struct dev_ino) <= obstack_object_size (&dev_ino_obstack)); + obstack_blank (&dev_ino_obstack, -(int) (sizeof (struct dev_ino))); + return *(struct dev_ino*) obstack_next_free (&dev_ino_obstack); } #define ASSERT_MATCHING_DEV_INO(Name, Di) \ |