[0/5] obstacks again

Message ID 54A1EC04.8020103@draigBrady.com
State Not applicable
Headers

Commit Message

Pádraig Brady Dec. 30, 2014, 12:04 a.m. UTC
  On 05/12/14 19:13, Eric Blake wrote:
> On 10/29/2014 09:35 PM, Paul Eggert wrote:
>> Alan Modra wrote:
>>
>>> One thing though, I didn't put the ChangeLog diffs in the patch as I
>>> usually add them when committing.
>>
>> Oh, I missed that.  I added them now.  For Gnulib it's better to put
>> them into the patch.
>>
>>> It is no longer possible to shrink an obstack with obstack_blank (but
>>> you can still do that with obstack_blank_fast).
>>
>> Ouch, I hadn't noticed that.  That's an incompatible change and I expect
>> it will break real-world usage for no particularly good reason, so we
>> really need to fix this.  How about making the 2nd argument to
>> obstack_blank and obstack_blank_fast be of type ptrdiff_t rather than
>> size_t?
> 
> It breaks GNU M4, for a starter :)  But at least we predicted that it
> would happen, and I'm hoping the fallback of obstack_blank_fast does the
> job.

For reference ls is also impacted.  Hopefully this suffices:


thanks,
Pádraig.
  

Comments

Paul Eggert Dec. 30, 2014, 12:24 a.m. UTC | #1
Pádraig Brady wrote:
> For reference ls is also impacted.  Hopefully this suffices:

Yes, thanks, that should be enough -- could you please install it?
  

Patch

diff --git a/src/ls.c b/src/ls.c
index 82402ee..5bee5e6 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -990,7 +990,7 @@  dev_ino_pop (void)
   struct dev_ino *di;
   int dev_ino_size = sizeof *di;
   assert (dev_ino_size <= obstack_object_size (&dev_ino_obstack));
-  obstack_blank (&dev_ino_obstack, -dev_ino_size);
+  obstack_blank_fast (&dev_ino_obstack, -dev_ino_size);
   vdi = obstack_next_free (&dev_ino_obstack);
   di = vdi;
   return *di;