You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2016/07/01 16:18:23 UTC

[trafficserver] branch master updated: TS-4395 Replaces memrchr, since it is not on OSX

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  21d9f6e   TS-4395 Replaces memrchr, since it is not on OSX
21d9f6e is described below

commit 21d9f6e9987466939abaef6809a2b2cefcb5c041
Author: Leif Hedstrom <zw...@apache.org>
AuthorDate: Fri Jul 1 10:17:20 2016 -0600

    TS-4395 Replaces memrchr, since it is not on OSX
---
 plugins/experimental/remap_purge/remap_purge.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/plugins/experimental/remap_purge/remap_purge.c b/plugins/experimental/remap_purge/remap_purge.c
index 1233197..a99a1da 100644
--- a/plugins/experimental/remap_purge/remap_purge.c
+++ b/plugins/experimental/remap_purge/remap_purge.c
@@ -217,9 +217,13 @@ handle_purge(TSHttpTxn txnp, PurgeInstance *purge)
 
           TSDebug(PLUGIN_NAME, "Checking PATH = %.*s", path_len, path);
           if (path && (path_len >= purge->secret_len)) {
-            const char *s_path = (const char *)memrchr(path, '/', path_len);
+            int s_path = path_len - 1;
 
-            if (!memcmp(s_path ? s_path + 1 : path, purge->secret, purge->secret_len)) {
+            while ((s_path >= 0) && ('/' != path[s_path])) { /* No memrchr in OSX */
+              --s_path;
+            }
+
+            if (!memcmp(s_path > 0 ? path + s_path + 1 : path, purge->secret, purge->secret_len)) {
               should_purge = true;
             }
           }

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].