summaryrefslogtreecommitdiff
path: root/compat/regex/regex.c
AgeCommit message (Collapse)AuthorFilesLines
2017-11-09Replace Free Software Foundation address in license noticesLibravatar Todd Zullinger1-3/+2
The mailing address for the FSF has changed over the years. Rather than updating the address across all files, refer readers to gnu.org, as the GNU GPL documentation now suggests for license notices. The mailing address is retained in the full license files (COPYING and LGPL-2.1). The old address is still present in t/diff-lib/COPYING. This is intentional, as the file is used in tests and the contents are not expected to change. Signed-off-by: Todd Zullinger <tmz@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-06regex: fix a SIZE_MAX macro redefinition warningLibravatar Ramsay Jones1-0/+1
Since commit 56a1a3ab ("Silence GCC's \"cast of pointer to integer of a different size\" warning", 26-10-2015), sparse has been issuing a macro redefinition warning for the SIZE_MAX macro. However, gcc did not issue any such warning. After commit 56a1a3ab, in terms of the order of #includes and #defines, the code looked something like: $ cat -n junk.c 1 #include <stddef.h> 2 3 #define SIZE_MAX ((size_t) -1) 4 5 #include <stdint.h> 6 7 int main(int argc, char *argv[]) 8 { 9 return 0; 10 } $ $ gcc junk.c $ However, if you compile that file with -Wsystem-headers, then it will also issue a warning. Having set -Wsystem-headers in CFLAGS, using the config.mak file, then (on cygwin): $ make compat/regex/regex.o CC compat/regex/regex.o In file included from /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/include/stdint.h:9:0, from compat/regex/regcomp.c:21, from compat/regex/regex.c:77: /usr/include/stdint.h:362:0: warning: "SIZE_MAX" redefined #define SIZE_MAX (__SIZE_MAX__) ^ In file included from compat/regex/regex.c:69:0: compat/regex/regex_internal.h:108:0: note: this is the location of the previous definition # define SIZE_MAX ((size_t) -1) ^ $ The compilation of the compat/regex code is somewhat unusual in that the regex.c file directly #includes the other c files (regcomp.c, regexec.c and regex_internal.c). Commit 56a1a3ab added an #include of <stdint.h> to the regcomp.c file, which results in the redefinition, since this is included after the regex_internal.h header. This header file contains a 'fallback' definition for SIZE_MAX, in order to support systems which do not have the <stdint.h> header (the HAVE_STDINT_H macro is not defined). In order to suppress the warning, we move the #include of <stdint.h> from regcomp.c to the start of the compilation unit, close to the top of regex.c, prior to the #include of the regex_internal.h header. Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-12compat/regex: fix spelling and grammar in commentsLibravatar Stefano Lattarini1-1/+1
Some of these were found using Lucas De Marchi's codespell tool. Others noticed by Eric Sunshine. Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-18compat/regex: use the regex engine from gawk for compatLibravatar Ævar Arnfjörð Bjarmason1-4919/+82
Change the regex engine in compat to use the gawk engine from the gawk-devel module in gawk CVS. This engine supports the REG_STARTEND flag, which was optionally available in Git since v1.7.2-rc0~77^2~1. The source was grabbed from cvs.savannah.gnu.org:/sources/gawk, and these are the upstream versions of the files being included: regcomp.c 1.4 regex.h 1.3 regex.h 1.3 regex_internal.c 1.3 regex_internal.h 1.3 regexec.c 1.3 Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Acked-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-22msvc: Fix a compiler warning due to an incorrect pointer castLibravatar Ramsay Jones1-1/+1
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Acked-by: Sebastian Schuberth <sschuberth@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-18Change regerror() declaration from K&R style to ANSI C (C89)Libravatar Frank Li1-5/+2
The MSVC headers typedef errcode as int, and thus confused the compiler in the K&R style definition. ANSI style deconfuses it. Signed-off-by: Frank Li <lznuaa@gmail.com> Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-22Fix typos / spelling in commentsLibravatar Mike Ralphson1-2/+2
Signed-off-by: Mike Ralphson <mike@abacus.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-10Use compatibility regex library for OSX/DarwinLibravatar Arjen Laarhoven1-0/+4927
The standard libc regex library on OSX does not support alternation in POSIX Basic Regular Expression mode. This breaks the diff.funcname functionality on OSX. To fix this, we use the GNU regex library which is already present in the compat/ diretory for the MinGW port. However, simply adding compat/ to the COMPAT_CFLAGS variable causes a conflict between the system fnmatch.h and the one present in compat/. To remedy this, move the regex and fnmatch functionality to their own subdirectories in compat/ so they can be included seperately. Signed-off-by: Arjen Laarhoven <arjen@yaph.org> Tested-by: Mike Ralphson <mike@abacus.co.uk> (AIX) Tested-by: Johannes Sixt <johannes.sixt@telecom.at> (MinGW) Signed-off-by: Junio C Hamano <gitster@pobox.com>