| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
| |
* src/dfa.c (icatalloc): Change type of "old" parameter
from "char const *" to "char *".
Don't cast-away const on realloc argument.
Remove now-unnecessary const-discarding cast.
Don't (void)-cast strcpy result.
* src/dosbuf.c (undossify_input): Remove anachronistic
cast-to-"char *" of realloc argument.
|
|
|
|
|
|
|
|
|
|
| |
* src/dfa.c (enlist): Use xnrealloc, not realloc.
Also, remove unnecessary cast-to-(char *).
(dfamust): Use xnmalloc, not malloc. Before, this code would
return upon malloc failure (xnmalloc exits upon failure), but
later, via the *ALLOC macros, it could already exit, so this
new potential exit point is nothing new. The same applies
to enlist, since it is called only through dfamust.
|
|
|
|
|
| |
* src/main.c (parse_grep_colors): Use xstrdup in place of xmalloc,
a useless test, strlen, and strcpy.
|
|
|
|
|
|
|
| |
* src/dfa.c (REALLOC_IF_NECESSARY, CALLOC, MALLOC, REALLOC):
Use functions from xalloc.h to avoid overflow.
* src/dfasearch.c (GEAcompile): Use xnrealloc rather than realloc.
* src/pcresearch.c (Pcompile): Use xnmalloc, not xmalloc.
|
|
|
|
|
|
|
| |
* src/dfa.c (setbit_c, setbit_case_fold_c): Compare the btowc
return value against WEOF, not EOF. Suggested by Eli Zaretskii.
On a system like MinGW with unsigned wint_t, comparing a btowc
return value against EOF (-1) would always be false.
|
|
|
|
|
|
|
|
|
|
|
| |
* src/dfa.c (dfaanalyze): Allocate space for twice as many
positions as there are leaves. Before this change, for some
regular expressions, DFA analysis would have inserted far more
"positions" than dfa->nleaves (up to double).
Reported by Raymond Russell in http://savannah.gnu.org/bugs/?33547
* tests/dfa-heap-overrun: Trigger the overrun.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
|
|
|
|
|
| |
* src/dfa.c (addtok): Compile characters to an alternation. Handle the
case when nothing else remains in the MBCSET.
|
|
|
|
|
| |
* src/dfa.c (parse_bracket_exp): Move optimization of MBCSET from here...
(addtok): ... to here.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This provides a better fix for the unibyte-bracket-expr and high-bit-range
testcases, and fixes the latent bug tested by bogus-wctob.
* src/dfa.c (setbit_case_fold): Remove, replace with...
(setbit_wc, setbit_c, setbit_case_fold_c): ... these.
(parse_bracket_exp): Use setbit_case_fold_c when iterating over
single-byte sequences. Use setbit_wc for multi-byte character sets,
and setbit_case_fold_c for single-byte character sets.
(lex): Use setbit_case_fold_c for single-byte character sets.
|
|
|
|
|
|
|
|
| |
* src/dfa.c (setbit_case_fold): Also handle uni-byte locales
like the one mentioned in the original report: see 2011-05-07
commit d98338eb. Re-reported by Santiago Ruano Rincón.
Note that most uni-byte locales are not affected.
* NEWS (Bug fixes): Mention it.
|
|
|
|
|
|
|
|
|
| |
* src/pcresearch.c (Pexecute): Handle PCRE_ERROR_MATCHLIMIT.
* tests/Makefile.am (XFAIL_TESTS): Remove pcre-abort.
* tests/pcre-abort: Expect failure, no output, and increase
the length of the input string, in case the backtracking limit
is ever raised. Adjust comment.
* NEWS (Bug fixes): Mention it.
|
|
|
|
|
|
| |
* src/Makefile.am (sc_tight_scope): Remove rule.
Now it's provided via gnulib's maint.mk.
* cfg.mk (sc_tight_scope): Likewise.
|
|
|
|
|
| |
* src/grep.h (matchers): Declare consistently, so the sc_tight_scope
rule detects this as an extern-marked variable.
|
|
|
|
|
|
| |
* src/dfa.c (setbit_case_fold) [MBS_SUPPORT]: Set the bit also
when wctob returns EOF.
* NEWS (Bug fixes): Mention it.
|
| |
|
| |
|
|
|
|
|
|
|
| |
This ensures that the only externally scoped symbols are ones
that are explicitly marked as "extern" or white-listed like "main".
* src/Makefile.am (sc_tight_scope): New rule, copied from coreutils.
* cfg.mk (sc_tight_scope): Define, to hook to it from the top level.
|
|
|
|
| |
* src/search.h: Add "extern" keyword to each function declaration.
|
|
|
|
|
| |
* src/dfa.c (SUCCEEDS_IN_CONTEXT): Remove doubled "a".
* src/dfa.c (BACKREF): s/it it/it is/
|
|
|
|
| |
* src/dfa.c (check_matching_with_multibyte_ops, dfastate): As above.
|
|
|
|
|
| |
* lib/savedir.c: Don't include <stddef.h>. Not needed.
* src/dfa.c: Likewise.
|
|
|
|
| |
Run "make update-copyright", so "make syntax-check" works in 2011.
|
|
|
|
|
| |
* NEWS: Update.
* src/main.c (main): Set exit_failure. Reported by Guy Shaw.
|
|
|
|
|
| |
* src/system.h: Add multiple inclusion guards.
* src/grep.h: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The actual meaning of range expressions in glibc is not exactly strcoll,
which makes the behavior of grep hard to predict when compiled with the
system regex. Leave to the system regex matcher the decision of which
single-byte characters are matched by a range expression.
This partially reverts a change made in commit 0d38a8bb (which made
sense at the time, but not now that src/dfa.c is not doing multibyte
character set matching anymore).
* src/dfa.c (in_coll_range): Remove.
(parse_bracket_exp): Use system regex to find which single-char
bytes match a range expression.
|
|
|
|
| |
* src/Makefile.am (LDADD): Add $(LIBICONV).
|
|
|
|
|
|
| |
* src/dfasearch.c (dfawarn): Rename enum symbols to use DW_ prefix,
so as not to collide with "GNU", which is defined by the Hurd.
Reported by Matthias Lanzinger in http://savannah.gnu.org/bugs/?31096
|
|
|
|
|
| |
* src/dfa.c (prepare_wc_buf) [!MBS_SUPPORT]: Do not compile this
function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch enables full support of equivalence classes and multicharacter
collation symbols. It can also improve performance problems in some
cases for multibyte grep. Both of these changes however depend on the
glibc version installed in the system.
For UTF-8 it will trigger only in the presence of MBCSET, e.g. [a-z].
For other character sets all brackets and `.` as well will trigger it.
* NEWS: Document this.
* src/dfa.c (dfaexec): Fall back to glibc for multibyte matches,
if possible.
|
|
|
|
|
|
|
|
| |
* src/dfa.c (dfaanalyze): Allocate GRPS and LABELS arrays from heap,
not on the stack. With this change, grep can now run in these UEFI
simulators:
http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=EDK
http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=EDK2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When I make a mistake like this:
grep '[:lower:]' ...
be it in a script or on the command line, I want to know about
it as soon as possible. I don't want grep to print a mere warning
that it is interpreting this suspicious and almost guaranteed-wrong
regular expression as a set of just 6 bytes. And I certainly don't
want grep to silently do the wrong thing, even if that would be
officially standards-conforming. It's obvious that I intended
[[:lower:]], and I want my error to be diagnosed in a way that is
most likely to get my attention. Thus, with this change, grep now
prints a diagnostic and exits with status 2 the moment it
encounters an offending [:char_class:] construct.
This changes the way grep works by default, rather than
putting this new behavior on an option. A new option
would seldom be used in scripts (not portable), and would
probably be used only rarely by those who need it the most.
This new functionality provides a valuable safety measure
and incurs truly negligible risk.
For strict POSIX compliance, set POSIXLY_CORRECT in
your environment. That disables this new feature.
Revert the changes from commit 2cd3bcea, "grep: add
--warnings={always,never,auto}.", and then do the following:
* src/dfasearch.c (dfawarn): Call getenv("POSIXLY_CORRECT") here;
Remove "warning: " from the diagnostic, now that it's more than
a warning, and exit with status 2.
* NEWS (New features): Describe the new semantics.
* tests/warn-char-classes: Adjust one test to accommodate this change.
* doc/grep.texi (Character Classes and Bracket Expressions): Document.
(Environment Variables): Cross-reference it.
Remove reference to obsolete getopt illegal vs. invalid difference.
Thanks to Paul Eggert for suggestions and an initial prod.
|
|
|
|
|
|
|
|
| |
This includes author names and keeps the copyright year up to date.
* bootstrap.conf (gnulib_modules): Add propername and version-etc-fsf.
* src/main.c (AUTHORS): Define.
(main): Use version_etc, rather than hard-coding the copyright text.
Prompted by a patch from Paolo Bonzini.
|
|
|
|
|
|
|
|
| |
* src/dfa.c (parse_bracket_exp): Warn on regular expressions such as
[:space:].
* src/dfa.h (dfawarn): New prototype.
* src/dfasearch.c (dfawarn): New.
* NEWS: Document.
|
|
|
|
|
|
|
| |
* src/grep.h (no_warnings): New declaration.
* src/main.c (no_warnings): New.
(WARNINGS_OPTION): Add to enum.
(main): Add --warnings. Handle color_option == 2 together with it.
|
|
|
|
|
|
| |
* bootstrap.conf: Include gnulib module minmax.
* src/searchutils.c (mbtolower): Handle *N == 0 case.
* src/system.h: Include minmax.h from gnulib.
|
|
|
|
| |
* dfa.c (dfaexec): Declare saved_end at the beginning of the function.
|
|
|
|
|
|
|
|
|
|
| |
The semantics of excluded_file_name changed (when operating on
an "included" file name list).
* src/main.c (main): Adjust for changed semantics of excluded_file_name
simply by removing a negation.
* NEWS (Bug fixes): Mention this fix.
* tests/include-exclude: Add a test for this.
Reported by Joe Perches in http://savannah.gnu.org/bugs/?29876.
|
|
|
|
|
| |
* src/main.c (context_length_arg, grepdir): Remove a stray \n in
each of two diagnostics.
|
|
|
|
|
| |
* src/dfasearch.c (EGexecute): Avoid access beyond end of buffer
that could happen if start != beg - buf.
|
|
|
|
| |
* src/dfa.c (dfaexec): Cast p when passing it to prepare_wc_buf.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There's no "multibyte pain" in these two classes, since POSIX
and ISO C99 mandate their contents.
Time for "./grep -x '[[:digit:]]' /usr/share/dict/linux.words"
Before: 1.5s, after: 0.07s. (sed manages only 0.5s).
* src/dfa.c (predicates): Declare struct dfa_ctype separately
from definition. Add sb_only.
(find_pred): Return const struct dfa_ctype *.
(parse_bracket_exp): Return const struct dfa_ctype *. Do
not fill MBCSET for sb_only character types.
|
|
|
|
|
|
| |
* src/dfa.c (dfaexec): Handle the cases in which mbrtowc returns
(size_t)-1 or (size_t)-2, rather than setting mblen_buf[i] to an
outrageously large value.
|
|
|
|
| |
* grep.c (Gcompile): Remove RE_HAT_LISTS_NOT_NEWLINE.
|
|
|
|
|
|
|
|
|
|
|
| |
This provides a nice speedup for -m in general, but especially
it avoids quadratic complexity in case we have to go to glibc.
* NEWS: Document change.
* src/dfa.c (prepare_wc_buf): Extract out of dfaexec. Convert
only up to the next newline.
(dfaexec): Exit multibyte processing loop if past buf_end.
Call prepare_wc_buf again after processing a newline.
|
|
|
|
| |
* src/mbsupport.h: Don't test HAVE_STDLIB_H.
|
|
|
|
|
|
|
| |
* src/dfa.c (struct dfa): Remove "#if MBS_SUPPORT" guard that made
several member declarations conditional on this cpp definition.
(token): Likewise.
Reported by Anders Wallin.
|
|
|
|
|
| |
* src/dfa.c (add_utf8_anychar): Check for RE_DOT_NEWLINE and
RE_DOT_NOT_NULL.
|
|
|
|
|
| |
* NEWS: Document bugfix.
* main.c (main): Ignore MMAP_OPTION.
|
|
|
|
| |
* src/dfa.c (atom): Expand TABs in indentation.
|
|
|
|
|
| |
* src/dfasearch.c (patterns, pcount): Declare these file-scoped
globals to be static.
|