diff options
author | Tad Marshall <tad@10gen.com> | 2012-03-12 06:04:30 -0400 |
---|---|---|
committer | Tad Marshall <tad@10gen.com> | 2012-03-12 06:04:30 -0400 |
commit | cd54317107d9acf63dc5de6c466990ca9d234462 (patch) | |
tree | de1a542b62dcdf391779a804c0c1abd52fc66a75 | |
parent | 3a59385162569f7d2dbf0aec0bfb03c52ace706c (diff) | |
download | mongo-cd54317107d9acf63dc5de6c466990ca9d234462.tar.gz |
SERVER-4312 Simplify previous "kill buffer" fix
Just skip the join code when no previous kill buffer exists,
simpler code with less duplication.
-rw-r--r-- | src/third_party/linenoise/linenoise.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/third_party/linenoise/linenoise.cpp b/src/third_party/linenoise/linenoise.cpp index 11c230a8b51..dd4d7dbbd39 100644 --- a/src/third_party/linenoise/linenoise.cpp +++ b/src/third_party/linenoise/linenoise.cpp @@ -296,18 +296,11 @@ public: memcpy( textCopy, text, textLen ); textCopy[ textLen ] = 0; string textCopyString( textCopy ); - if ( lastAction == actionKill ) { - if ( size == 0 ) { - indexToSlot[0] = 0; - size++; - theRing.push_back( textCopyString ); - } - else { - int slot = indexToSlot[0]; - theRing[slot] = forward ? - theRing[slot] + textCopyString : - textCopyString + theRing[slot]; - } + if ( lastAction == actionKill && size > 0 ) { + int slot = indexToSlot[0]; + theRing[slot] = forward ? + theRing[slot] + textCopyString : + textCopyString + theRing[slot]; } else { if ( size < capacity ) { |