This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 9.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.1.x by this push:
new e8f8386 Set pcre_malloc/free function pointers in core main() only.
(#7608)
e8f8386 is described below
commit e8f8386ef32212f2526e074086605c57ed432206
Author: Walt Karas <[email protected]>
AuthorDate: Thu Mar 18 16:08:09 2021 -0500
Set pcre_malloc/free function pointers in core main() only. (#7608)
(cherry picked from commit 42db8bb284d63e3f019e2d9d986e4d34f750f69a)
---
plugins/experimental/cookie_remap/cookie_remap.cc | 24 -----------------------
plugins/regex_remap/regex_remap.cc | 23 ----------------------
plugins/regex_revalidate/regex_revalidate.c | 15 --------------
3 files changed, 62 deletions(-)
diff --git a/plugins/experimental/cookie_remap/cookie_remap.cc
b/plugins/experimental/cookie_remap/cookie_remap.cc
index 6e9dd9b..5515497 100644
--- a/plugins/experimental/cookie_remap/cookie_remap.cc
+++ b/plugins/experimental/cookie_remap/cookie_remap.cc
@@ -43,21 +43,6 @@ using namespace std;
const int OVECCOUNT = 30; // We support $1 - $9 only, and this needs to be 3x
that
-///////////////////////////////////////////////////////////////////////////////
-// Helpers for memory management (to make sure pcre uses the TS APIs).
-//
-inline void *
-ink_malloc(size_t s)
-{
- return TSmalloc(s);
-}
-
-inline void
-ink_free(void *s)
-{
- return TSfree(s);
-}
-
class UrlComponents
{
public:
@@ -182,13 +167,6 @@ private:
}
};
-void
-setup_memory_allocation()
-{
- pcre_malloc = &ink_malloc;
- pcre_free = &ink_free;
-}
-
enum operation_type { UNKNOWN = -1, EXISTS = 1, NOTEXISTS, REGEXP, STRING,
BUCKET };
enum target_type {
@@ -914,8 +892,6 @@ using OpsQueue = std::vector<const op *>;
TSReturnCode
TSRemapInit(TSRemapInterface *api_info, char *errbuf, int errbuf_size)
{
- setup_memory_allocation();
-
return TS_SUCCESS;
}
diff --git a/plugins/regex_remap/regex_remap.cc
b/plugins/regex_remap/regex_remap.cc
index b640d33..9412301 100644
--- a/plugins/regex_remap/regex_remap.cc
+++ b/plugins/regex_remap/regex_remap.cc
@@ -639,28 +639,6 @@ struct RemapInstance {
};
///////////////////////////////////////////////////////////////////////////////
-// Helpers for memory management (to make sure pcre uses the TS APIs).
-//
-inline void *
-ts_malloc(size_t s)
-{
- return TSmalloc(s);
-}
-
-inline void
-ts_free(void *s)
-{
- return TSfree(s);
-}
-
-void
-setup_memory_allocation()
-{
- pcre_malloc = &ts_malloc;
- pcre_free = &ts_free;
-}
-
-///////////////////////////////////////////////////////////////////////////////
// Initialize the plugin.
//
TSReturnCode
@@ -677,7 +655,6 @@ TSRemapInit(TSRemapInterface *api_info, char *errbuf, int
errbuf_size)
return TS_ERROR;
}
- setup_memory_allocation();
TSDebug(PLUGIN_NAME, "Plugin is successfully initialized");
return TS_SUCCESS;
}
diff --git a/plugins/regex_revalidate/regex_revalidate.c
b/plugins/regex_revalidate/regex_revalidate.c
index 52a9e97..2fa32c5 100644
--- a/plugins/regex_revalidate/regex_revalidate.c
+++ b/plugins/regex_revalidate/regex_revalidate.c
@@ -45,18 +45,6 @@
#define LOG_ROLL_INTERVAL 86400
#define LOG_ROLL_OFFSET 0
-static inline void *
-ts_malloc(size_t s)
-{
- return TSmalloc(s);
-}
-
-static inline void
-ts_free(void *s)
-{
- return TSfree(s);
-}
-
typedef struct invalidate_t {
const char *regex_text;
pcre *regex;
@@ -519,9 +507,6 @@ TSPluginInit(int argc, const char *argv[])
TSDebug(LOG_PREFIX, "Plugin registration succeeded");
}
- pcre_malloc = &ts_malloc;
- pcre_free = &ts_free;
-
main_cont = TSContCreate(main_handler, NULL);
TSContDataSet(main_cont, (void *)pstate);
TSHttpHookAdd(TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK, main_cont);