Permalink
Browse files

Added tre_ prefix to all functions.

This fixes long-standing problems where binaries compiled against
libtre would end up using symbols from libc, usually resulting in
crashes.

The #include <tre/regex.h> header now defines macros like this:
  #define regexec tre_regexec
Recompiling is necessary, so updated the libtre ABI version number
accordingly.

darcs-hash:20090919184043-ced27-b309d20f00d9d0f4ab6c6e7102c7870fee1d3921.gz
  • Loading branch information...
1 parent e2cb48d commit 582f9acaa9231c02303cf9f26f8a5b2636890b36 Ville Laurikari committed Sep 19, 2009
View
@@ -1,7 +1,7 @@
## Process this file with automake to produce Makefile.in
lib_LTLIBRARIES = libtre.la
-libtre_la_LDFLAGS = -no-undefined -version-info 6:5:2 $(LDFLAGS)
+libtre_la_LDFLAGS = -no-undefined -version-info 5:0:0 $(LDFLAGS)
libtre_la_LIBADD = $(LTLIBINTL)
noinst_HEADERS = \
@@ -30,5 +30,5 @@ if TRE_APPROX
libtre_la_SOURCES += tre-match-approx.c
endif TRE_APPROX
-dist_pkginclude_HEADERS = regex.h
+dist_pkginclude_HEADERS = tre.h regex.h
nodist_pkginclude_HEADERS = tre-config.h
View
@@ -1,5 +1,5 @@
/*
- regcomp.c - TRE POSIX compatible regex compilation functions.
+ tre_regcomp.c - TRE POSIX compatible regex compilation functions.
This software is released under a BSD-style license.
See the file LICENSE for details and copyright.
@@ -14,12 +14,12 @@
#include <errno.h>
#include <stdlib.h>
-#include "regex.h"
+#include "tre.h"
#include "tre-internal.h"
#include "xmalloc.h"
int
-regncomp(regex_t *preg, const char *regex, size_t n, int cflags)
+tre_regncomp(regex_t *preg, const char *regex, size_t n, int cflags)
{
int ret;
#if TRE_WCHAR
@@ -100,28 +100,28 @@ regncomp(regex_t *preg, const char *regex, size_t n, int cflags)
}
int
-regcomp(regex_t *preg, const char *regex, int cflags)
+tre_regcomp(regex_t *preg, const char *regex, int cflags)
{
- return regncomp(preg, regex, regex ? strlen(regex) : 0, cflags);
+ return tre_regncomp(preg, regex, regex ? strlen(regex) : 0, cflags);
}
#ifdef TRE_WCHAR
int
-regwncomp(regex_t *preg, const wchar_t *regex, size_t n, int cflags)
+tre_regwncomp(regex_t *preg, const wchar_t *regex, size_t n, int cflags)
{
return tre_compile(preg, regex, n, cflags);
}
int
-regwcomp(regex_t *preg, const wchar_t *regex, int cflags)
+tre_regwcomp(regex_t *preg, const wchar_t *regex, int cflags)
{
return tre_compile(preg, regex, regex ? wcslen(regex) : 0, cflags);
}
#endif /* TRE_WCHAR */
void
-regfree(regex_t *preg)
+tre_regfree(regex_t *preg)
{
tre_free(preg);
}
View
@@ -1,5 +1,5 @@
/*
- regerror.c - POSIX regerror() implementation for TRE.
+ tre_regerror.c - POSIX tre_regerror() implementation for TRE.
This software is released under a BSD-style license.
See the file LICENSE for details and copyright.
@@ -19,7 +19,7 @@
#endif /* HAVE_WCTYPE_H */
#include "tre-internal.h"
-#include "regex.h"
+#include "tre.h"
#ifdef HAVE_GETTEXT
#include <libintl.h>
@@ -31,7 +31,7 @@
#define _(String) dgettext(PACKAGE, String)
#define gettext_noop(String) String
-/* Error message strings for error codes listed in `regex.h'. This list
+/* Error message strings for error codes listed in `tre.h'. This list
needs to be in sync with the codes listed there, naturally. */
static const char *tre_error_messages[] =
{ gettext_noop("No error"), /* REG_OK */
@@ -51,7 +51,7 @@ static const char *tre_error_messages[] =
};
size_t
-regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)
+tre_regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)
{
const char *err;
size_t err_len;
Oops, something went wrong.

0 comments on commit 582f9ac

Please sign in to comment.