trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject trafficserver git commit: TS-3505 Fix build errors with various older gcc compilers
Date Fri, 24 Apr 2015 18:54:25 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 86a3a1464 -> 10c0e9561


TS-3505 Fix build errors with various older gcc compilers


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/10c0e956
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/10c0e956
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/10c0e956

Branch: refs/heads/master
Commit: 10c0e95615be079f44713ab7d55c16a44cbd83c7
Parents: 86a3a14
Author: Leif Hedstrom <zwoop@apache.org>
Authored: Fri Apr 24 12:52:09 2015 -0600
Committer: Leif Hedstrom <zwoop@apache.org>
Committed: Fri Apr 24 12:52:12 2015 -0600

----------------------------------------------------------------------
 .../experimental/cache_promote/cache_promote.cc | 12 ++++---
 plugins/experimental/cache_promote/lulu.h       | 35 --------------------
 2 files changed, 7 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/10c0e956/plugins/experimental/cache_promote/cache_promote.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/cache_promote/cache_promote.cc b/plugins/experimental/cache_promote/cache_promote.cc
index 1e594cf..e470cc4 100644
--- a/plugins/experimental/cache_promote/cache_promote.cc
+++ b/plugins/experimental/cache_promote/cache_promote.cc
@@ -34,7 +34,7 @@
 #include <map>
 #endif
 
-#include "lulu.h"
+static const char *PLUGIN_NAME = "cache_promote";
 
 //////////////////////////////////////////////////////////////////////////////////////////////
 // Note that all options for all policies has to go here. Not particularly pretty...
@@ -173,7 +173,7 @@ private:
 };
 
 struct LRUHashHasher {
-  bool operator()(const LRUHash *s1, const LRUHash *s2) const { return 0 == memcmp(s1->_hash,
s2->_hash, sizeof(LRUHash::_hash)); }
+  bool operator()(const LRUHash *s1, const LRUHash *s2) const { return 0 == memcmp(s1->_hash,
s2->_hash, sizeof(s2->_hash)); }
 
   size_t operator()(const LRUHash *s) const { return *((size_t *)s->_hash) ^ *((size_t
*)(s->_hash + 9)); }
 };
@@ -181,7 +181,7 @@ struct LRUHashHasher {
 typedef std::pair<LRUHash, unsigned> LRUEntry;
 typedef std::list<LRUEntry> LRUList;
 
-static LRUEntry NULL_LRU_ENTRY = {}; // Used to create an "empty" new LRUEntry
+static LRUEntry NULL_LRU_ENTRY; // Used to create an "empty" new LRUEntry
 
 // TODO: We should eliminate this when we have unordered_map on all supported platforms.
 #if HAVE_UNORDERED_MAP
@@ -195,12 +195,14 @@ typedef std::map<LRUHash *, LRUList::iterator> LRUMap;
 class LRUPolicy : public PromotionPolicy
 {
 public:
-  LRUPolicy() : PromotionPolicy(), _buckets(0), _hits(0)
+  LRUPolicy() : PromotionPolicy(), _buckets(1000), _hits(10)
   {
     // This doesn't have to be perfect, since this is just chance sampling.
     // coverity[dont_call]
     srand48((long)time(NULL) ^ (long)getpid() ^ (long)getppid());
+#if HAVE_UNORDERED_MAP
     _map.reserve(_buckets);
+#endif
     _lock = TSMutexCreate();
   }
 
@@ -330,6 +332,7 @@ public:
   bool
   factory(int argc, char *argv[])
   {
+    optind = 0;
     while (true) {
       int opt = getopt_long(argc, (char *const *)argv, "psbh", longopt, NULL);
 
@@ -459,7 +462,6 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, char * /* errbuf
*/, int /
 
   --argc;
   ++argv;
-  optind = 0;
   if (config->factory(argc, argv)) {
     TSContDataSet(contp, static_cast<void *>(config));
     *ih = static_cast<void *>(contp);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/10c0e956/plugins/experimental/cache_promote/lulu.h
----------------------------------------------------------------------
diff --git a/plugins/experimental/cache_promote/lulu.h b/plugins/experimental/cache_promote/lulu.h
deleted file mode 100644
index 7ef866f..0000000
--- a/plugins/experimental/cache_promote/lulu.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-*/
-
-
-//////////////////////////////////////////////////////////////////////////////////////////////
-//
-// Implement the classes for the various types of hash keys we support.
-//
-#ifndef __LULU_H__
-#define __LULU_H__ 1
-
-#include <sys/types.h>
-
-#include "ink_defs.h"
-#include "ink_atomic.h"
-
-// Used for Debug etc.
-static const char *PLUGIN_NAME = "cache_promote";
-
-#endif // __LULU_H__


Mime
View raw message