From 1c73a0f649835ec2a9e9a693df41cf0f5fe95f45 Mon Sep 17 00:00:00 2001 From: Edward Hennis Date: Thu, 7 Aug 2014 19:09:30 -0400 Subject: [PATCH] Remove unused code: * StringConcat was only being referenced by unit test. * `runall.sh` is no longer needed. Use `npm test` instead. --- Builds/VisualStudio2013/RippleD.vcxproj | 2 - .../VisualStudio2013/RippleD.vcxproj.filters | 3 - src/ripple/basics/utility/StringConcat.h | 77 ------------------- src/ripple/basics/utility/StringUtilities.cpp | 21 ----- test/runall.sh | 4 - 5 files changed, 107 deletions(-) delete mode 100644 src/ripple/basics/utility/StringConcat.h delete mode 100755 test/runall.sh diff --git a/Builds/VisualStudio2013/RippleD.vcxproj b/Builds/VisualStudio2013/RippleD.vcxproj index d8ea130b4..c6da84539 100644 --- a/Builds/VisualStudio2013/RippleD.vcxproj +++ b/Builds/VisualStudio2013/RippleD.vcxproj @@ -1845,8 +1845,6 @@ - - True diff --git a/Builds/VisualStudio2013/RippleD.vcxproj.filters b/Builds/VisualStudio2013/RippleD.vcxproj.filters index afafe9c38..50385570d 100644 --- a/Builds/VisualStudio2013/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2013/RippleD.vcxproj.filters @@ -2832,9 +2832,6 @@ ripple\basics\utility - - ripple\basics\utility - ripple\basics\utility diff --git a/src/ripple/basics/utility/StringConcat.h b/src/ripple/basics/utility/StringConcat.h deleted file mode 100644 index 6dededa0b..000000000 --- a/src/ripple/basics/utility/StringConcat.h +++ /dev/null @@ -1,77 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012, 2013 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#ifndef RIPPLE_STRINGCONCAT_H -#define RIPPLE_STRINGCONCAT_H - -#include - -namespace ripple { - -namespace detail { - -// ConcatArg is used to represent arguments to stringConcat. - -struct ConcatArg { - ConcatArg(std::string const& s) : data_(s.data()), size_(s.size()) - { - } - - ConcatArg(char const* s) : data_(s), size_(strlen(s)) - { - } - - template - ConcatArg(T t) : string_(to_string(t)), - data_(string_.data()), - size_(string_.size()) - { - } - - std::string string_; - char const* data_; - std::size_t size_; -}; - -} // namespace detail - -/** Concatenate strings, numbers, bools and chars into one string in O(n) time. - - Usage: - stringConcat({"hello ", 23, 'x', true}); - - Returns: - "hello 23xtrue" - */ -inline std::string stringConcat(std::vector args) -{ - int capacity = 0; - for (auto const& a: args) - capacity += a.size_; - - std::string result; - result.reserve(capacity); - for (auto const& a: args) - result.append(a.data_, a.data_ + a.size_); - return result; -} - -} // ripple - -#endif diff --git a/src/ripple/basics/utility/StringUtilities.cpp b/src/ripple/basics/utility/StringUtilities.cpp index 0ac4149f0..a696c9070 100644 --- a/src/ripple/basics/utility/StringUtilities.cpp +++ b/src/ripple/basics/utility/StringUtilities.cpp @@ -24,7 +24,6 @@ #include #include -#include namespace ripple { @@ -393,25 +392,6 @@ public: "parseUrl: Mixed://domain/path path failed"); } - void testStringConcat () - { - testcase ("stringConcat"); - auto result = stringConcat({}); - expect(result == "", result); - - result = stringConcat({"hello, ", std::string("world.")}); - expect(result == "hello, world.", result); - - result = stringConcat({"hello, ", 23}); - expect(result == "hello, 23", result); - - result = stringConcat({"hello, ", true}); - expect(result == "hello, true", result); - - result = stringConcat({"hello, ", 'x'}); - expect(result == "hello, x", result); - } - void testToString () { testcase ("toString"); @@ -423,7 +403,6 @@ public: { testParseUrl (); testUnHex (); - testStringConcat (); testToString (); } }; diff --git a/test/runall.sh b/test/runall.sh deleted file mode 100755 index e0a2a20cb..000000000 --- a/test/runall.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -# flags set in mocha.opts -mocha test/websocket-test.js test/server-test.js test/*-test.{js,coffee} \ No newline at end of file