Update iconv_module to search APR_ICONV1_PATH, ensuring we don't
collide with apr-iconv version 0.9.x flavor iconv modules
(which weren't compatible.) This was particularly an issue when
mixing flavors of subversion, apache and other apr-based apps
when both 0.9 and 1.x are required.
Reported by: Curt Arnold <carnold apache.org>
git-svn-id: https://svn.apache.org/repos/asf/apr/apr-iconv/trunk@157852 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CHANGES b/CHANGES
index f68de38..7f718d7 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,10 @@
Changes with APR-ICONV 1.1
+ *) APR_ICONV1_PATH distinguishes between our apr-iconv 0.9 and 1.x
+ flavors (changed pool arguments to several internal functions, so the
+ loadable charset modules are not binary compatible.) The older 0.9
+ flavor APR_ICONV_PATH won't be searched. [William Rowe]
+
Changes with APR-ICONV 1.0.2
*) Fix libapriconv.rc for Win32 builds [William Rowe, Justin Erenkrantz]
diff --git a/lib/api_version.c b/lib/api_version.c
index 5b90924..70692fd 100644
--- a/lib/api_version.c
+++ b/lib/api_version.c
@@ -13,8 +13,6 @@
* limitations under the License.
*/
-#include "apr_general.h" /* for APR_STRINGIFY */
-
#include "apr_iconv.h"
#include "api_version.h"
diff --git a/lib/iconv_module.c b/lib/iconv_module.c
index e4dd7fa..bc6c50a 100644
--- a/lib/iconv_module.c
+++ b/lib/iconv_module.c
@@ -39,6 +39,7 @@
#include "apr_strings.h"
#include "apr_tables.h"
#include "apr_lib.h"
+#include "api_version.h"
#include <string.h>
#include <stdlib.h>
@@ -49,6 +50,8 @@
#include "charset_alias.h"
#endif
+#define APR_ICONV_PATH "APR_ICONV" API_STRINGIFY(API_MAJOR_VERSION) "_PATH"
+
static apr_status_t
iconv_getpathname(char *buffer, const char *dir, const char *name, apr_pool_t *ctx)
{
@@ -93,7 +96,7 @@
while (0 != (*ptr++ = apr_tolower(*name++)))
;
- if (!apr_env_get(&ptr, "APR_ICONV_PATH", subpool)
+ if (!apr_env_get(&ptr, APR_ICONV_PATH, subpool)
&& !apr_filepath_list_split(&pathelts, ptr, subpool))
{
int i;