From df8c4ce83554115234b5889446f189a04fd155c4 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Tue, 2 Feb 2016 18:13:40 -0800 Subject: [PATCH] Use vector instead of deque in input_function_push_args deque is a memory hog last I checked --- src/input.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/input.cpp b/src/input.cpp index c2499d1a2..c3e26815b 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -42,7 +42,6 @@ #include "output.h" #include #include -#include #define DEFAULT_TERM L"ansi" #define MAX_INPUT_FUNCTION_ARGS 20 @@ -539,23 +538,28 @@ wchar_t input_function_pop_arg() void input_function_push_args(int code) { int arity = input_function_arity(code); - std::deque skipped; + std::vector skipped; for (int i = 0; i < arity; i++) { wchar_t arg; // skip and queue up any function codes + // See #2357 while(((arg = input_common_readch(0)) >= R_MIN) && (arg <= R_MAX)) { - skipped.push_front(arg); + skipped.push_back(arg); } input_function_push_arg(arg); } // push the function codes back into the input stream - std::for_each(skipped.begin(), skipped.end(), input_common_next_ch); + size_t idx = skipped.size(); + while (idx--) + { + input_common_next_ch(skipped.at(idx)); + } } /**