From 27cba7814828dee0c7154a8317141ffef1205283 Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Wed, 29 Dec 2010 17:58:21 -0800 Subject: [PATCH] common: str_list: const cleanup Signed-off-by: Colin McCabe --- src/common/str_list.cc | 27 +++++++++++++++++++-------- src/include/str_list.h | 6 ++++-- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/common/str_list.cc b/src/common/str_list.cc index 0e2cafbf95b25..a8bf0429601c8 100644 --- a/src/common/str_list.cc +++ b/src/common/str_list.cc @@ -1,16 +1,30 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2009-2010 Dreamhost + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software + * Foundation. See file COPYING. + * + */ + #include #include #include -using namespace std; +using std::string; -static bool get_next_token(string s, size_t& pos, string& token) +static bool get_next_token(const std::string &s, size_t& pos, string& token) { int start = s.find_first_not_of(" \t", pos); int end; if (start < 0) - return false; + return false; if (s[start]== ',') end = start + 1; @@ -25,7 +39,7 @@ static bool get_next_token(string s, size_t& pos, string& token) return true; } -bool get_str_list(string& str, list& str_list) +bool get_str_list(const std::string& str, std::list& str_list) { size_t pos = 0; string token; @@ -43,8 +57,7 @@ bool get_str_list(string& str, list& str_list) return true; } - -bool get_str_set(string& str, set& str_set) +bool get_str_set(const std::string& str, std::set& str_set) { size_t pos = 0; string token; @@ -61,5 +74,3 @@ bool get_str_set(string& str, set& str_set) return true; } - - diff --git a/src/include/str_list.h b/src/include/str_list.h index f96485ebafc68..ba87df2989359 100644 --- a/src/include/str_list.h +++ b/src/include/str_list.h @@ -5,8 +5,10 @@ #include #include -extern bool get_str_list(std::string& str, std::list& str_list); -extern bool get_str_set(std::string& str, std::set& str_list); +extern bool get_str_list(const std::string& str, + std::list& str_list); +extern bool get_str_set(const std::string& str, + std::set& str_list); #endif -- 2.39.5