nano-devel
[Top][All Lists]
Advanced

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

[Nano-devel] patch: filestruct <-> openfilestruct split, etc.


From: David Lawrence Ramsey
Subject: [Nano-devel] patch: filestruct <-> openfilestruct split, etc.
Date: Fri, 22 Mar 2002 20:31:09 -0800 (PST)

--- David Lawrence Ramsey <address@hidden> wrote:
>Sorry it took me so long to get back to you on this.
>
>--- David Benbennick <address@hidden> wrote:
>>And here is a fix for the seg fault reported in my last email.  The
>>problem was caused by the fact that there are two global variables that
>>point to the top of the current file, fileage and open_files->file.

Here's my first attempt at a patch.  It goes with your idea
of splitting open_files into a structure separate from
filestruct.  It also contains your work at making
--enable-tiny and --enable-multibuffer compatible (I added
the fixes to acconfig.h and configure.ac so that the options
wouldn't turn each other off, and so there wouldn't be any
stray comments saying they were incompatible), and your
miscellaneous fixes (your fix to get_next_filename() to
allow INT_MAX possible files, your #ifdef directive fix in
thanks_for_all_the_fish() that properly checked for
DISABLE_OPERATINGDIR's not being defined rather than
ENABLE_MULTIBUFFER's being defined, your memory leak fix in
die_save_file(), and your commenting out of some unused
prototypes in proto.h).  In short, it has everything your
two multibuffer patches had as its foundation, with some
additions of my own.

I've made open_files an openfilestruct, added the few
functions needed to handle them, based on the
filestruct-based functions that handle filestructs the same
way (nano compiled with multibuffer and nanorc support is
only 400-something bytes larger than without this), and
tweaked thanks_for_all_the_fish() to deal with the changes.
The old filestruct <-> openfilestruct member changes are as
follows:

* open_files->data is now open_files->filename
* open_files->file is now open_files->fileage
* open_files->lineno is now open_files->file_lineno
(separate from filestruct's lineno)

>I haven't been able to reproduce this segfault yet; exactly
>how were you able to do so?

Check that; now I have.  I've used your fix for it, too,
except that I put it in the wrapper function
open_file_sync_fileage() and called it near the ends of
do_cut_text(), do_uncut_text(), and close_open_file(), since
all are potentially involved in similar fileage changes.

By the way, while I was in cut.c, I fixed a minor bug with
uncutting-to-end-of-line in a blank buffer, reproduced as
follows:

1. start with a new buffer
2. type in "this is a test"
3. put the cursor at the beginning of that line of text
4. make sure cut-to-end mode is on, and cut the line
5. press delete, after which the cursor position display
detects one line and zero total chars
6. still in (un)cut-to-end mode, uncut the line; there will
be no magicline added to the end as there should be

The fix I put in, which seems to work so far, is commented
in cut.c, and of course is the only one of the three patch
chunks affecting that file that doesn't have
open_file_sync_fileage() in it.

There are also some miscellaneous fixes to indentation
(there were spaces where tabs should be, there were no
spaces where spaces should be, some comments needed updates,
get_next_filename() should have been accepting a const char*
instead of a char*, "Could not pipe" wasn't translated when
it should have been, most of the po files still had "File
already loaded" in them even though it was removed when the
duplicate-checking multibuffer code was, and there was a
typo in es.po).

>>I
>>think fileage should be removed (that is, open_files would be defined in
>>all cases, and would just have ->prev == NULL == ->next if
>>!ENABLE_MULTIBUFFER).  That would generally make the code cleaner.  
>>Perhaps I will do that soon.

I'm going in steps.  The splitting off into a separate
structure was rather tricky, and I'm not sure I got it
entirely right yet.  Once I'm sure it's working properly,
then I'll try and take the step of making fileage exist only
in open_files, since you're right about it's being hackish
to manually set open_files->fileage when fileage changes
within the same file.

Since my website's been having some technical difficulties
lately, I'm bzip2ing the patch and attaching it to this
email.


_____________________________________________________________
Sluggy.Net: The Sluggy Freelance Community!

_____________________________________________________________
Run a small business? Then you need professional email like address@hidden from 
Everyone.net  http://www.everyone.net?tag

Attachment: nanopieces.patch.bz2
Description: Binary data


reply via email to

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