[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] nano bug #54928: a syntax file should be fully read onl
Re: [Nano-devel] nano bug #54928: a syntax file should be fully read only when the syntax gets actually used
Thu, 15 Nov 2018 09:00:47 -0500
rcfile.c and color.c are your main points of entry.
- color.c -> update_colors
- rcfile.c -> grab_and_store
- rcfile.c -> parse_rcfile
- rcfile.c -> parse_colors
The main issue with this is that we parse the rcfiles before the file
is even opened, which makes things a little complicated.
1. parse_rcfile reads every rc file included.
2. grab_and_store will store the extension, magic, and header to the
static variable live_syntaxes, which will be linked into
3. parse_colors reads every color file and stores it as a string
(after regcomping and regfreeing it immediately simply to check
syntax) in syntaxtype
4. The file is opened.
5. update_colors will scan through the list of syntaxes, check if the
header/magic/extension matches (again by regcomping/regfreeing
immediately), then compile the matching regex.