Andrew V. Samoilov
82f580f857
* syntax.c (get_args): Use in "args_size" argument instead of
...
in out "argc". Return number of found entries.
Adjust all callers.
2004-11-18 10:02:33 +00:00
Andrew V. Samoilov
f22b5d749f
* syntax.c (get_args): Use "argc" to check "args" size.
...
(edit_read_syntax_rules): Add new parameter "argc" (size of the
"args" buffer) to prevent buffer overflow.
2004-11-16 19:46:46 +00:00
Roland Illig
5d5237e557
* syntax.c (read_one_line): Fixed SEGV when reading syntax file
...
with "\r\n" line endings on Unix.
2004-10-16 13:33:21 +00:00
Roland Illig
a3c3564d4d
* syntax.c (this_try_alloc_color_pair): Added const qualifiers.
2004-09-25 14:28:10 +00:00
Andrew V. Samoilov
12d24222db
* edit.c (edit_clean): g_free handles NULL argument too,
...
no need for the comparison.
(edit_move_backward_lots): Likewise.
* editcmd.c (edit_set_filename): Likewise.
(edit_replace_cmd): Likewise.
(edit_search_cmd): Likewise.
(edit_sort_cmd): Likewise.
(edit_mail_dialog): Likewise.
* syntax.c (syntax_g_free): Likewise.
(edit_read_syntax_rules): Likewise.
2004-09-24 22:37:00 +00:00
Roland Illig
9c65d36bdd
* edit.c: Replaced NULL with (char *) NULL. Likewise for 0, where
...
NULL was meant.
* editcmd.c: Likewise.
* editlock.c: Likewise.
* editwidget.c: Likewise.
* syntax.c: Likewise.
2004-09-24 14:57:57 +00:00
Andrew V. Samoilov
83de09639c
* syntax.c(this_try_alloc_color_pair): Use g_strlcpy instead
...
sequence strncpy(), name[len] = '\0'
(edit_read_syntax_rules):Likewise.
2004-09-01 18:37:14 +00:00
Roland Illig
243e84706e
* Code cleanup: Added const qualifier for variables and
...
function declarations where possible. No functional changes.
2004-08-29 18:45:56 +00:00
Andrew V. Samoilov
bb8bf1756e
* syntax.c (edit_read_syntax_rules): Dynamically allocate
...
more space for contexts and for words in context.
2004-08-22 20:47:56 +00:00
Roland Illig
3dcf497216
Added more const-ness to variables.
2004-08-16 17:53:07 +00:00
Roland Illig
29010bfdd1
Removed explicit loop unrolling in xx_strchr as that is the job of the compiler.
2004-08-16 17:48:38 +00:00
Dmitry Alexeyev
c459caead1
* syntax.c (edit_read_syntax_rules): Fix crash if syntax file
...
has more than 1024 keywords.
2003-12-24 07:38:49 +00:00
Pavel Roskin
8bc40b44f0
Fix includes not to rely on $(top_srcdir) being in the include path.
2003-10-29 08:54:22 +00:00
Pavel Roskin
ad84a71c64
* edit-widget.h (struct WEdit): Add GTree *defines field.
...
* syntax.c: Use edit->defines instead of static defines.
2003-10-23 23:23:46 +00:00
Pavel Roskin
f426c570a6
* syntax.c (compare_word_to_right): More checks for braces and
...
brackets.
2003-10-16 20:31:06 +00:00
Pavel Roskin
7f8dfa977d
* syntax.c (compare_word_to_right): Fix recent breakage - rules
...
ending with wildcard (e.g. "$+") won't match.
2003-10-16 20:16:38 +00:00
Pavel Roskin
fce42c9316
* syntax.c: Give names to numeric tokens.
2003-09-22 23:04:48 +00:00
Pavel Roskin
daab7bd737
* syntax.c (compare_word_to_right): Add checks that we don't go
...
beyond text length for certain invalid rules.
Reported by Juan C. Olivares <juancri@TAGnet.org>
2003-09-22 22:30:48 +00:00
Andrew V. Samoilov
6f35fce869
* syntax.c (edit_read_syntax_file): Fix segmentation violation.
2003-03-06 18:42:33 +00:00
Andrew V. Samoilov
902cd4834b
* syntax.c (edit_read_syntax_rules): Check for list of defines
...
is already initialized.
(edit_read_syntax_file): Process `include ...` before first
`file ...`, so color definitions can be stored separately.
2003-03-04 09:52:40 +00:00
Andrew V. Samoilov
599f3e8bfb
* syntax.c (subst_defines): New function to substitute defines.
...
(this_try_alloc_color_pair): Move color substitution ...
(edit_read_syntax_rules): ... here. Use subst_defines() to
substitute colors for contexts and keywords. Allow multiword
defines.
2003-03-03 13:37:45 +00:00
Andrew V. Samoilov
0c03bd9dd3
* (edit_read_syntax_rules): Fix memory corruption if key is redefined
2003-03-03 08:55:11 +00:00
Andrew V. Samoilov
f0a33821e6
* syntax.c (edit_read_syntax_rules): Add args argument and it
...
use instead of own auto args array to share this area with ...
(edit_read_syntax_file): ... this. Adjust for the above.
Use strncpy() instead of unsafe strcpy().
2003-02-26 19:15:27 +00:00
Andrew V. Samoilov
4dc31f3e06
(this_try_alloc_color_pair): Set fg to f if fg is not NULL. Likewise for
...
fg and bg.
(edit_free_syntax_rules): Call destroy_defines() even if there is no rules.
2003-02-25 16:16:18 +00:00
Pavel Roskin
0158eaf0f3
* syntax.c (defines): New static variable for list of defines.
...
(mc_defines_destroy): New function to release memory of key
pair.
(destroy_defines): New function to destroy list of defines
completely.
(this_try_alloc_color_pair): Use strncpy() instead of unsafe
strcpy(). Use values from list of defines to substitute given
parameters.
(edit_read_syntax_rules): Initialize list of defines and process
new "define" keyword. Use strncpy() instead of unsafe strcpy().
(edit_free_syntax_rules): Destroy list of defines.
2003-02-25 15:07:53 +00:00
Pavel Roskin
aaf569bd48
* edit.h: Don't inclide malloc.h. Use g_malloc() and g_free()
...
instead. Adjust all dependencies.
2002-12-15 18:55:53 +00:00
Pavel Roskin
2f2864e500
* syntax.c (edit_load_syntax): Reuse more informative error
...
message.
2002-12-08 01:57:35 +00:00
Pavel Roskin
75fbf0b2f5
* syntax.c: Make structures key_word, context_rule and
...
_syntax_marker opaque.
2002-11-30 18:07:42 +00:00
Pavel Roskin
b628d515c0
* edit.h: Don't define HAVE_SYNTAXH.
...
* syntax.c: Syntax highlighting is no more optional.
(edit_check_spelling): Remove.
2002-11-30 02:29:43 +00:00
Pavel Roskin
18de4488e3
* edit-widget.h: Move typedef WEdit and file names ...
...
* edit.h: ... here. Don't include edit-widget.h. Adjust all
dependencies.
2002-11-29 03:01:06 +00:00
Pavel Roskin
5cb2ef30f3
Fix duplicate declarations.
2002-11-15 06:38:55 +00:00
Pavel Roskin
7969f851bb
* edit.h: Decentralize includes.
2002-11-14 19:38:26 +00:00
Pavel Roskin
e741be7a5d
* *.c: Fix all global functions without declarations - declare,
...
make static or remove.
2002-11-13 04:32:00 +00:00
Pavel Roskin
47ab84d950
* syntax.c (syntax_change_callback): Remove, it's unused.
...
(edit_set_syntax_change_callback): Likewise.
2002-11-13 02:13:37 +00:00
Pavel Roskin
da7e82d253
Global removal of RCS Id: flags.
2002-09-26 23:13:45 +00:00
Andrew V. Samoilov
790b85b555
* edit.h (struct key_word): Remove time field.
...
* syntax.c: Remove MAD support.
2002-09-26 12:23:13 +00:00
Pavel Roskin
3a93326ce7
* editoptions.c: Make some variables static.
...
* edit.h: Take extern declaratrions from all C files.
2002-08-19 01:23:24 +00:00
Pavel Roskin
d6a8671055
* syntax.c: Remove all references to MAD.
2002-08-01 20:44:24 +00:00
Pavel Roskin
2e17e22122
* syntax.c (apply_rules_going_right): Recheck keyword rules when
...
a keyword is found on the left border of a context.
2002-07-20 09:12:55 +00:00
Pavel Roskin
72a5fc5cc1
* syntax.c (edit_get_syntax_color): Return colorpair index, not
...
attribute, when syntax highlighting is disabled. Handle black
and white mode separately.
2002-07-14 22:39:07 +00:00
Pavel Roskin
3c437c273d
* syntax.c (edit_load_syntax): Do nothing in black and white
...
mode.
2002-07-14 22:19:49 +00:00
Pavel Roskin
a23618b2ef
* edit.h (struct key_word): Remove unused "bg" field, rename
...
"fg" to "color", since it keeps all color information.
* syntax.c (edit_get_syntax_color): Replace "fg" and "bg"
arguments with a single argument "color".
Adjust all dependencies.
2002-07-14 17:56:47 +00:00
Pavel Roskin
4655fbbb6b
* editdraw.c (edit_status): Use EDITOR_NORMAL_COLOR instead of
...
NORMAL_COLOR.
* syntax.c (edit_get_syntax_color) [!HAVE_SYNTAXH]: Likewise.
2002-07-14 06:17:02 +00:00
Andrew V. Samoilov
47f1ce66af
* syntax.c (edit_read_syntax_file): Use system wide Syntax
...
Highlighting definitions' file if there is no users one.
2002-03-25 07:52:53 +00:00
Andrew V. Samoilov
fc3ef44f3b
* syntax.c (convert): Fix buffer overflow for ".*\" cases.
2002-02-18 14:48:36 +00:00
Andrew V. Samoilov
e41f4c01e4
(edit_read_syntax_rules): Eliminate c->single_char.
...
It's only written but never read.
* edit.h (struct context_rule): Comment out single_char field.
It is written once but never read.
2002-01-15 01:41:18 +00:00
Andrew V. Samoilov
3eea969c3b
* syntax.c (syntax_g_free): New macro to release and NULLify
...
glib allocated memory area(s).
(strdup_convert): Rename to ...
(convert): ... this. Don't strdup passed string.
(get_args): Use convert instead of strdup_convert.
(free_args): Make it do notning macro.
(open_include_file): Eliminate p array. Use glib function to
construct error_file_name. Use PATH_SEP instead of '/';
(edit_read_syntax_file): Use PATH_SEP_STR.
(edit_load_syntax): Use syntax_g_free to release error_file_name.
(edit_read_syntax_rules): Likewise.
2002-01-15 01:32:59 +00:00
Andrew V. Samoilov
bd3bdac638
* syntax.c (read_one_line): Undo last patch - errno is a
...
function on some systems. Check ferror() status before
everithing else if fgetc returns EOF.
Accept last line without trailing newline.
(compare_word_to_right): Don't cast p and q to unsigned long.
(apply_rules_going_right): Likewise.
2001-12-22 16:00:30 +00:00
Pavel Roskin
6c821c8ad5
* syntax.c (read_one_line): Clear errno before using it. Don't
...
use the result of fgetc() if errno is EINTR.
2001-12-21 23:33:18 +00:00
Andrew V. Samoilov
a34c2786cb
* syntax.c (apply_rules_going_right): Fix crush for lines like
...
\s+ \n lightgray/13 red
in Syntax file.
(read_one_line): Use EOF instead of -1.
(get_args): Fix buffer overflow for l without trailing
whitespace(s).
(break_a): New macro.
(edit_read_syntax_rules): Use break_a to fix memory leaks.
(edit_load_syntax): Eliminate s and use message to prevent
buffer overflow.
2001-11-28 12:40:18 +00:00