From: Bruno Haible Date: Tue, 14 Jan 2003 13:36:58 +0000 (+0000) Subject: Compile classpath.c once, instead of #including it twice. X-Git-Tag: v0.12~1171 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4aba34a042ccefad4f0c3c9cdf82a3c9b36654dd;p=thirdparty%2Fgettext.git Compile classpath.c once, instead of #including it twice. --- diff --git a/lib/ChangeLog b/lib/ChangeLog index 84bbb4f1c..0baf3c0d3 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,13 @@ +2003-01-12 Bruno Haible + + * classpath.h: New file. + * classpath.c: Turn into an independent source file. + (new_classpath, set_classpath, reset_classpath): Make non-static. + * javacomp.c: Include classpath.h instead of classpath.c. + * javaexec.c: Likewise. + * Makefile.am (libgettextlib_la_SOURCES): Add classpath.h, classpath.c. + (EXTRA_DIST): Remove classpath.c. + 2003-01-12 Bruno Haible * localcharset.h: New file. diff --git a/lib/Makefile.am b/lib/Makefile.am index c300e0e38..b1e9ab445 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -36,6 +36,7 @@ libgettextlib_la_SOURCES = \ basename.h basename.c \ binary-io.h \ c-ctype.h c-ctype.c \ + classpath.h classpath.c \ copy-file.h copy-file.c \ error.h error.c \ execute.h execute.c \ @@ -115,7 +116,7 @@ gettextsrc_DATA = gettext.h noinst_HEADERS = gettext.h -EXTRA_DIST += classpath.c \ +EXTRA_DIST += \ $(LIBADD_SOURCE) $(UNUSED_SOURCE) \ gen-lbrkprop.c 3level.h Combining.txt diff --git a/lib/classpath.c b/lib/classpath.c index a58924f29..ae88a3d67 100644 --- a/lib/classpath.c +++ b/lib/classpath.c @@ -1,5 +1,5 @@ /* Java CLASSPATH handling. - Copyright (C) 2001-2002 Free Software Foundation, Inc. + Copyright (C) 2001-2003 Free Software Foundation, Inc. Written by Bruno Haible , 2001. This program is free software; you can redistribute it and/or modify @@ -16,6 +16,19 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +# include +#endif + +/* Specification. */ +#include "classpath.h" + +#include +#include +#include + +#include "xsetenv.h" +#include "xmalloc.h" /* Separator in PATH like lists of pathnames. */ #if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__ @@ -26,11 +39,10 @@ # define PATH_SEPARATOR ':' #endif - /* Return the new CLASSPATH value. The given classpaths are prepended to the current CLASSPATH value. If use_minimal_classpath, the current CLASSPATH is ignored. */ -static char * +char * new_classpath (const char * const *classpaths, unsigned int classpaths_count, bool use_minimal_classpath) { @@ -75,7 +87,7 @@ new_classpath (const char * const *classpaths, unsigned int classpaths_count, } /* Set CLASSPATH and returns a safe copy of its old value. */ -static char * +char * set_classpath (const char * const *classpaths, unsigned int classpaths_count, bool use_minimal_classpath, bool verbose) { @@ -95,7 +107,7 @@ set_classpath (const char * const *classpaths, unsigned int classpaths_count, } /* Restore CLASSPATH to its previous value. */ -static void +void reset_classpath (char *old_classpath) { if (old_classpath != NULL) diff --git a/lib/classpath.h b/lib/classpath.h new file mode 100644 index 000000000..cce847f10 --- /dev/null +++ b/lib/classpath.h @@ -0,0 +1,34 @@ +/* Java CLASSPATH handling. + Copyright (C) 2003 Free Software Foundation, Inc. + Written by Bruno Haible , 2003. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include + +/* Return the new CLASSPATH value. The given classpaths are prepended to + the current CLASSPATH value. If use_minimal_classpath, the current + CLASSPATH is ignored. */ +extern char * new_classpath (const char * const *classpaths, + unsigned int classpaths_count, + bool use_minimal_classpath); + +/* Set CLASSPATH and returns a safe copy of its old value. */ +extern char * set_classpath (const char * const *classpaths, + unsigned int classpaths_count, + bool use_minimal_classpath, bool verbose); + +/* Restore CLASSPATH to its previous value. */ +extern void reset_classpath (char *old_classpath); diff --git a/lib/javacomp.c b/lib/javacomp.c index 06a2c3a0a..03c9fe11b 100644 --- a/lib/javacomp.c +++ b/lib/javacomp.c @@ -31,6 +31,7 @@ #include "execute.h" #include "pipe.h" #include "wait-process.h" +#include "classpath.h" #include "xsetenv.h" #include "sh-quote.h" #include "safe-read.h" @@ -41,9 +42,6 @@ #define _(str) gettext (str) -/* CLASSPATH handling subroutines. */ -#include "classpath.c" - /* Survey of Java compilers. A = does it work without CLASSPATH being set diff --git a/lib/javaexec.c b/lib/javaexec.c index 8193a07eb..fcfe596fe 100644 --- a/lib/javaexec.c +++ b/lib/javaexec.c @@ -29,6 +29,7 @@ #include #include "execute.h" +#include "classpath.h" #include "xsetenv.h" #include "sh-quote.h" #include "pathname.h" @@ -39,9 +40,6 @@ #define _(str) gettext (str) -/* CLASSPATH handling subroutines. */ -#include "classpath.c" - /* Survey of Java virtual machines. A = does it work without CLASSPATH being set