Fix cursor insert inconsistency
authorAjit Banerjee <ajitb@fb.com>
Fri, 3 Jan 2014 00:30:59 +0000 (16:30 -0800)
committerSara Golemon <sgolemon@fb.com>
Mon, 6 Jan 2014 19:39:00 +0000 (11:39 -0800)
commita4d8d01064780d2325554aa824f7e359af582f02
tree438bbd114e36f75562ccc9ca11318ff026bd7209
parent29a70da4bfa76c7403cd260f5709ee752b9eeab0
Fix cursor insert inconsistency

Summary:
The invariant after Cursor::insert is that the cursor points to the buffer
after the insert. That invariant was not followed in the branch where the
new buffer was just prepended. This change fixes the bug.

Test Plan:
Unit test modified, all tests run with
fbconfig -r folly && fbmake runtests_opt

Reviewed By: davejwatson@fb.com

FB internal diff: D1114749
folly/io/Cursor.h
folly/io/test/IOBufCursorTest.cpp