You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by br...@apache.org on 2003/01/23 02:04:09 UTC
cvs commit: apr-iconv configure.in
brane 2003/01/22 17:04:09
Modified: lib iconv_module.c iconv.h
include apr_iconv.h
. configure.in
Log:
A search path for conversion modules can now be defined in the
APR_ICONV_PATH environment variable.
* configure.in: Make ':' the path separator in APR_ICONV_PATH on Unix.
* include/apr_iconv.h: Remove private stuff that belongs in lib/iconv.h.
* lib/iconv.h: Make ';' the path separator on Windows. Remove issetgid.
* lib/iconv_module.c (iconv_getpath): Replace the old ICONV_PATH
handling with properly APR-ized APR_ICONV_PATH handling. Use a
subpool throughout this function, because iconv_getpathname can be
called several times and it's really not nice to keep all those
allocated strings hanging around.
CVS: ----------------------------------------------------------------------
CVS: PR:
CVS: If this change addresses a PR in the problem report tracking
CVS: database, then enter the PR number(s) here.
CVS: Obtained from:
CVS: If this change has been taken from another system, such as NCSA,
CVS: then name the system in this line, otherwise delete it.
CVS: Submitted by:
CVS: If this code has been contributed to Apache by someone else; i.e.,
CVS: they sent us a patch or a new module, then include their name/email
CVS: address here. If this is your work then delete this line.
CVS: Reviewed by:
CVS: If we are doing pre-commit code reviews and someone else has
CVS: reviewed your changes, include their name(s) here.
CVS: If you have not had it reviewed then delete this line.
Revision Changes Path
1.10 +25 -17 apr-iconv/lib/iconv_module.c
Index: iconv_module.c
===================================================================
RCS file: /home/cvs/apr-iconv/lib/iconv_module.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- iconv_module.c 12 Jan 2003 23:46:28 -0000 1.9
+++ iconv_module.c 23 Jan 2003 01:04:09 -0000 1.10
@@ -75,30 +75,38 @@
iconv_getpath(char *buf, const char *name, apr_pool_t *ctx)
{
char buffer[APR_PATH_MAX];
+ apr_pool_t *subpool;
+ apr_status_t status;
char *ptr;
+ status = apr_pool_create(&subpool, ctx);
+ if (status)
+ return status;
+
if (apr_tolower(name[0]) == 'x' && name[1] == '-')
name += 2;
ptr = buffer;
while (0 != (*ptr++ = apr_tolower(*name++)))
;
- if(!issetugid()) {
- char *dir, *p;
- ptr = getenv("ICONV_PATH");
- if (ptr != NULL) {
- p = strdup(ptr);
- if (p == NULL)
- return ENOMEM;
- for (ptr = p; (dir = strtok(p, ":")); p = NULL) {
- if (iconv_getpathname(buf, dir, buffer, ctx) == 0) {
- free(ptr);
- return 0;
- }
- }
- free(ptr); /* otherwise memory leak */
- }
- }
- return iconv_getpathname(buf, ICONV_DEFAULT_PATH, buffer, ctx);
+ ptr = getenv("APR_ICONV_PATH");
+ if (ptr != NULL)
+ {
+ char *dir, *last;
+ for (ptr = apr_pstrdup(subpool, ptr);
+ (dir = apr_strtok(ptr, API_PATH_SEPARATOR, &last));
+ ptr = NULL)
+ {
+ if (iconv_getpathname(buf, dir, buffer, subpool) == 0)
+ {
+ apr_pool_destroy(subpool);
+ return APR_SUCCESS;
+ }
+ }
+ }
+
+ status = iconv_getpathname(buf, ICONV_DEFAULT_PATH, buffer, subpool);
+ apr_pool_destroy(subpool);
+ return status;
}
static int
1.14 +3 -5 apr-iconv/lib/iconv.h
Index: iconv.h
===================================================================
RCS file: /home/cvs/apr-iconv/lib/iconv.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- iconv.h 12 Jan 2003 23:46:28 -0000 1.13
+++ iconv.h 23 Jan 2003 01:04:09 -0000 1.14
@@ -38,15 +38,13 @@
#ifdef WIN32
#define ICONV_DEFAULT_PATH "iconv"
#define API_USE_BUILTIN_ALIASES /* Use the built-in charset alias table */
+#define API_PATH_SEPARATOR ";"
#else
-#include "apr_iconv_private.h" /* contains ICONV_DEFAULT_PATH */
+/* contains ICONV_DEFAULT_PATH, API_PATH_SEPARATOR */
+#include "apr_iconv_private.h"
#endif
#include <stddef.h>
-
-/* apr additions */
-#define issetugid() 0
-/* apr additions */
#ifdef ICONV_INTERNAL
1.4 +0 -10 apr-iconv/include/apr_iconv.h
Index: apr_iconv.h
===================================================================
RCS file: /home/cvs/apr-iconv/include/apr_iconv.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- apr_iconv.h 10 Jan 2003 15:13:51 -0000 1.3
+++ apr_iconv.h 23 Jan 2003 01:04:09 -0000 1.4
@@ -34,17 +34,7 @@
#include "apr.h"
#include "apr_pools.h"
-#ifdef WIN32
-#define ICONV_DEFAULT_PATH "iconv"
-#else
-#include "apr_iconv_private.h" /* contains ICONV_DEFAULT_PATH */
-#endif
-
#include <stddef.h>
-
-/* apr additions */
-#define issetugid() 0
-/* apr additions */
/**
* API_DECLARE_EXPORT is defined when building the libapriconv dynamic
1.5 +8 -2 apr-iconv/configure.in
Index: configure.in
===================================================================
RCS file: /home/cvs/apr-iconv/configure.in,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- configure.in 21 Jun 2001 09:06:50 -0000 1.4
+++ configure.in 23 Jan 2003 01:04:09 -0000 1.5
@@ -58,12 +58,18 @@
AC_SUBST(APRUTIL_EXPORT_LIBS)
-#
-# Adds in config *.h file
+dnl
+dnl Adds in config *.h file
+dnl
AC_DEFINE_UNQUOTED(ICONV_DEFAULT_PATH,"$prefix/lib/iconv",
[ Directory where the *.so tables are stored ] )
iconv_libdir=$prefix/lib/iconv
AC_SUBST(iconv_libdir)
+
+dnl
+dnl The path separator character, for APR_ICONV_PATH
+dnl
+AC_DEFINE_UNQUOTED(API_PATH_SEPARATOR,":",[ Separator in APR_ICONV_PATH ])
dnl
dnl BSD/OS (BSDi) needs to use a different include syntax in the Makefiles
Re: cvs commit: apr-iconv configure.in
Posted by Branko Čibej <br...@xbc.nu>.
brane@apache.org wrote:
>brane 2003/01/22 17:04:09
>
> Modified: lib iconv_module.c iconv.h
> include apr_iconv.h
> . configure.in
> Log:
> A search path for conversion modules can now be defined in the
> APR_ICONV_PATH environment variable.
>
> * configure.in: Make ':' the path separator in APR_ICONV_PATH on Unix.
> * include/apr_iconv.h: Remove private stuff that belongs in lib/iconv.h.
> * lib/iconv.h: Make ';' the path separator on Windows. Remove issetgid.
> * lib/iconv_module.c (iconv_getpath): Replace the old ICONV_PATH
> handling with properly APR-ized APR_ICONV_PATH handling. Use a
> subpool throughout this function, because iconv_getpathname can be
> called several times and it's really not nice to keep all those
> allocated strings hanging around.
> CVS: ----------------------------------------------------------------------
> CVS: PR:
> CVS: If this change addresses a PR in the problem report tracking
> CVS: database, then enter the PR number(s) here.
> CVS: Obtained from:
> CVS: If this change has been taken from another system, such as NCSA,
> CVS: then name the system in this line, otherwise delete it.
> CVS: Submitted by:
> CVS: If this code has been contributed to Apache by someone else; i.e.,
> CVS: they sent us a patch or a new module, then include their name/email
> CVS: address here. If this is your work then delete this line.
> CVS: Reviewed by:
> CVS: If we are doing pre-commit code reviews and someone else has
> CVS: reviewed your changes, include their name(s) here.
> CVS: If you have not had it reviewed then delete this line.
>
Blast! I thought CVS was supposed to strip those lines from the log
message? Duh. If some kindly member of the cvsadmin group would care to
fix those logs, I'd be eternally grateful...
--
Brane Čibej <br...@xbc.nu> http://www.xbc.nu/brane/
Re: cvs commit: apr-iconv configure.in
Posted by Cliff Woolley <jw...@virginia.edu>.
On Thu, 23 Jan 2003, [UTF-8] Branko Čibej wrote:
> Not me. My changes don't contain tabs, the rest of the code does. Would
> you rather I did an M-x untabify before committing? :-)
Oh, oops, my bad. Didn't notice which way around it was. You did the
right thing then. :)
Re: cvs commit: apr-iconv configure.in
Posted by Branko Čibej <br...@xbc.nu>.
Cliff Woolley wrote:
>On 23 Jan 2003 brane@apache.org wrote:
>
>
>
>> {
>> char buffer[APR_PATH_MAX];
>> + apr_pool_t *subpool;
>> + apr_status_t status;
>> char *ptr;
>>
>> + status = apr_pool_create(&subpool, ctx);
>> + if (status)
>> + return status;
>> +
>> if (apr_tolower(name[0]) == 'x' && name[1] == '-')
>>
>>
>
>The tab police are gonna git you.. ;)
>
>
Not me. My changes don't contain tabs, the rest of the code does. Would
you rather I did an M-x untabify before committing? :-)
--
Brane Čibej <br...@xbc.nu> http://www.xbc.nu/brane/
Re: cvs commit: apr-iconv configure.in
Posted by Cliff Woolley <jw...@virginia.edu>.
On 23 Jan 2003 brane@apache.org wrote:
> {
> char buffer[APR_PATH_MAX];
> + apr_pool_t *subpool;
> + apr_status_t status;
> char *ptr;
>
> + status = apr_pool_create(&subpool, ctx);
> + if (status)
> + return status;
> +
> if (apr_tolower(name[0]) == 'x' && name[1] == '-')
The tab police are gonna git you.. ;)