From 932481f94dcfb13d785d8afddaeec3cadd7b11bd Mon Sep 17 00:00:00 2001 From: Yizhi Liu Date: Mon, 16 Mar 2015 00:09:32 +0800 Subject: [PATCH 1/2] compile fixes for recent OS X/Xcode --- Makefile | 6 +++++- src/system/dashboard.cc | 4 ++-- src/system/dashboard.h | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 8db84a0..1bda9b7 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,11 @@ endif WARN = -Wall -Wno-unused-function -finline-functions -Wno-sign-compare #-Wconversion INCPATH = -I./src -I$(THIRD_PATH)/include CFLAGS = -std=c++0x $(WARN) $(OPT) $(INCPATH) -LDFLAGS += $(THIRD_LIB) -lpthread -lrt +LDFLAGS += $(THIRD_LIB) -lpthread +OS := $(shell uname -s) +ifeq ($(OS),Linux) + LFLAGS += -lrt +endif PS_LIB = build/libps.a PS_MAIN = build/libpsmain.a diff --git a/src/system/dashboard.cc b/src/system/dashboard.cc index 3e66962..a1348e5 100644 --- a/src/system/dashboard.cc +++ b/src/system/dashboard.cc @@ -3,7 +3,7 @@ namespace PS { -bool NodeIDCmp::operator()(const NodeID& a, const NodeID& b) { +bool NodeIDCmp::operator()(const NodeID& a, const NodeID& b) const { string a_primary, a_secondary; splitNodeID(a, a_primary, a_secondary); string b_primary, b_secondary; @@ -17,7 +17,7 @@ bool NodeIDCmp::operator()(const NodeID& a, const NodeID& b) { } } -void NodeIDCmp::splitNodeID(const NodeID& in, string& primary, string& secondary) { +void NodeIDCmp::splitNodeID(const NodeID& in, string& primary, string& secondary) const { size_t tailing_alpha_idx = in.find_last_not_of("0123456789"); if (std::string::npos == tailing_alpha_idx) { primary = in; diff --git a/src/system/dashboard.h b/src/system/dashboard.h index 1cff3b8..5054257 100644 --- a/src/system/dashboard.h +++ b/src/system/dashboard.h @@ -5,8 +5,8 @@ namespace PS { struct NodeIDCmp { - void splitNodeID(const NodeID& in, string& primary, string& secondary); - bool operator()(const NodeID& a, const NodeID& b); + void splitNodeID(const NodeID& in, string& primary, string& secondary) const; + bool operator()(const NodeID& a, const NodeID& b) const; }; class Dashboard { From ebd3040a0ae14368d9c4d9c5f6a08fe7862fbc8e Mon Sep 17 00:00:00 2001 From: Yizhi Liu Date: Sun, 29 Mar 2015 21:38:03 +0800 Subject: [PATCH 2/2] fix typo for 'childern' --- src/system/postoffice.cc | 2 +- src/system/yellow_pages.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/system/postoffice.cc b/src/system/postoffice.cc index db931df..984685d 100644 --- a/src/system/postoffice.cc +++ b/src/system/postoffice.cc @@ -336,7 +336,7 @@ void Postoffice::manageNode(Task& tk) { auto node = mng.node(i); yp().addNode(node); obj->exec().add(node); - for (auto c : yp().childern(obj->name())) { + for (auto c : yp().children(obj->name())) { auto child = yp().customer(c); if (child) child->exec().add(node); } diff --git a/src/system/yellow_pages.h b/src/system/yellow_pages.h index 28386a5..81c652e 100644 --- a/src/system/yellow_pages.h +++ b/src/system/yellow_pages.h @@ -27,7 +27,7 @@ class YellowPages { void addRelation(const string& child, const string& parent) { relations_[parent].push_back(child); } - const std::vector& childern(const string& parent) { + const std::vector& children(const string& parent) { return relations_[parent]; } @@ -49,7 +49,7 @@ class YellowPages { std::map nodes_; std::map> customers_; - // parent vs childern + // parent vs children std::unordered_map> relations_; Van van_; };