This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: grepjar and libregex


Tom Tromey wrote:
Ranjit>      The "grepjar" tool in "fastjar" needs the regex
Ranjit> functions, which seem to be there within glibc on Linux
Ranjit> but are not a part of the standard C library on Win32.

Can't we just use the regex in libiberty?  We already link grepjar
against libiberty.  Why doesn't that pick up the regex functions?
Good catch!

To use libiberty, one must include "xregex.h" instead of "regex.h".

libiberty defines regexfoo( ) functions as xregexfoo( ) in order
to not clash with the corresponding regex functions provided by
libc - "xregex.h" then defines a regexfoo( ) macro that uses
xregexfoo( ), so that the change is transparent to the programmer.

If fastjar is to remain within the GCC tree, the following patch
(tested with 3.3 for mingw32) proposes to make this change:
---------------------------------- 8< ----------------------------------
2003-01-26  Ranjit Mathew  <rmathew@hotmail.com>

        * jargrep.c: Include xregex.h from libiberty instead of
        system regex.h for better portability.
	
--- jargrep.c	2003-01-26 08:10:53.000000000 +0530
+++ jargrep.c	2003-01-26 08:28:11.000000000 +0530
@@ -106,5 +106,4 @@
 #include <stdio.h>
 #include <unistd.h>
-#include <regex.h>
 #include <errno.h>
 #include <string.h>
@@ -116,4 +115,7 @@
 #include <stdlib.h>
 #endif
+
+#include "xregex.h"
+
 #include "jargrep.h"
 #include "jartool.h"
---------------------------------- 8< ----------------------------------

Sincerely Yours,
Ranjit.

--
Ranjit Mathew        Email: rmathew AT hotmail DOT com
Bangalore,
INDIA.               Web: http://ranjitmathew.tripod.com/



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]