Fix push_back() to shared fbstring bug.
authorJeremy Lilley <jeremyl@fb.com>
Thu, 20 Sep 2012 22:04:54 +0000 (15:04 -0700)
committerJordan DeLong <jdelong@fb.com>
Fri, 12 Oct 2012 04:33:06 +0000 (21:33 -0700)
commit3a5767e72de649744ede7f616e61864958ae715f
treeaa777d5887d54c714edb66078acf26ea3aff5458
parent0010b30e696ac1e68bb3eb7992c328fd3214437c
Fix push_back() to shared fbstring bug.

Summary:
The following asserts:
fbstring str(1337, 'f');
fbstring cp = str;
cp.push_back('f');

This is problematic since ml_.capacity() != capacity() inside fbstring_core
for shared strings, which causes us not to un-share prior to push_back.

Test Plan: Existing tests, add unittest case.

Reviewed By: tudorb@fb.com

FB internal diff: D580267
folly/FBString.h
folly/test/FBStringTest.cpp