[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] [PATCH v3] text: set and reset the Modified state corre
From: |
Benno Schulenberg |
Subject: |
Re: [Nano-devel] [PATCH v3] text: set and reset the Modified state correctly when undoing/redoing |
Date: |
Wed, 20 Dec 2017 20:09:00 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 |
Op 20-12-17 om 10:00 schreef Brand Huntsman:
On Tue, 19 Dec 2017 19:24:04 +0100 Benno Schulenberg <address@hidden>
wrote:
Unset the "Modified" marker only at the point where the file was last saved
-- if there is such a point, because it can be missing when the undo stack
was discarded.
+ thefile->last_saved = (undo *)0xbeeb;
Wouldn't 0x1 be a better magic number? I know allocations would never happen
in the lower 64k on a "normal" OS, but it could be possible on a non-standard
OS. No OS would begin allocations at 0x0 and even if allocating began at 0x1,
nano would have made numerous permanent allocations before any undo nodes.
Notice that 0xbeeb is not an even number, and I am pretty sure that
allocations will happen at multiples of 4 (or even 8 or 16). So even
if the OS would allocate undo items in lower memory, the addresses of
those items will never match 0xbeeb. So... I think 0xbeeb will do
admirably as a magic number. :)
Other than that, the patch seems to work fine.
Thanks for testing.
Benno