#
0b86520c |
|
06-Sep-2021 |
Niels Sascha Reedijk <niels.reedijk@gmail.com> |
BString: add support for move semantics with C++11 and up. This implements the "rule of 5" for this type. While the copy operation for BString was already using shallow copies of the underlying data, this change further optimizes moving the data from one object to another. While it is not the intention to implement move semantics to all types in the legacy Haiku/Be kits, data types like BString are good candidates, because move operations are often useful when working with data within an application. In this implementation, the internal data of the string object will be set to NULL, thus leaving an empty string. Change-Id: I16bf9424f9b17f622b0b57659b80628e18760288 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4428 Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
|
#
fbc30e91 |
|
31-Dec-2019 |
Kyle Ambroff-Kao <kyle@ambroffkao.com> |
support/String: Revert 6c67c7d63 to fix double-free 6c67c7d63 was attempting to fix a leak caught by a static analysis tool, but it actually just introduced a double-free bug. Running `UnitTester BString` will result in a crash. The original code was correct because, in the event that realloc() fails in BString::_Resize(), the value of fPrivateData is still retained. It will be freed by the destructor of BString only if fPrivateData is not shared by another BString instance, since BStrings are copy-on-write. Note that while the change in 6c67c7d63 caused tests to fail, that doesn't mean those tests are ideal. They only trigger BString::_Resize() to fail because they depend on implementation details of hoard2 which limits allocations via malloc() to 1GB. Most malloc() implementations will allow allocations of arbitrary sizes using anonymous mappings (mmap on Linux, or create_area() in Haiku). This is a much bigger change, so for now I'm just adding some comments so that we can revisit these tests if we make a change to the allocator. Change-Id: I208c1c7a76b6b4409d237b911c62bb3198e49dab Reviewed-on: https://review.haiku-os.org/c/haiku/+/2060 Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
|
#
f960e7e9 |
|
28-Mar-2018 |
krish_iyer <krishnaniyer97@gmail.com> |
Support kit: Fixed issues in BString unit tests 1: Changed CPPUNIT_ASSERT -> CPPUNIT_ASSERT_EQUAL 2: Fixed coding style: Added two lines after including libraries, maintained 80 characters(MAX) in each line and space at comment start 3: Fixed the failure for "BString::Search" test "i != 0 by chaning the testing method(StartsWith->IStartsWith) and changed the string to be searched(sT->st) Change-Id: I1237d1f2d0e3af7757963cc940bae929f487f088
|
#
742d83e3 |
|
25-Nov-2010 |
Axel Dörfler <axeld@pinc-software.de> |
* Fixed warning. * Automatic whitespace cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39632 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4f841cf2 |
|
24-Feb-2008 |
Karsten Heimrich <host.haiku@gmx.de> |
* fixed Adopt(BString, len) test, as after adopt the source string should be empty, thus the pointer into that string should point to empty data... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24104 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ea4ba5bf |
|
21-Nov-2004 |
shatty <shatty@nowhere.fake> |
address compiler warnings git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10125 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
5480b459 |
|
13-Nov-2003 |
Stefano Ceccherini <stefano.ceccherini@gmail.com> |
Another patch from Oliver Tappe: BString behaves better when the user supplies out-of bounds values in Insert(), Remove(), etc. Code is refactored, and it fully complies with our guidelines. Tests have been updated too (hint: try the replace tests with R5 and our implementation...) git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5348 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1b0ea0ad |
|
14-Oct-2002 |
Stefano Ceccherini <stefano.ceccherini@gmail.com> |
Added some comments to the tests git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1521 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
eee13b4d |
|
03-Oct-2002 |
Stefano Ceccherini <stefano.ceccherini@gmail.com> |
More tests for BString git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1352 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
742d83e3d29b4afff0e064918856da00814aa01d |
|
25-Nov-2010 |
Axel Dörfler <axeld@pinc-software.de> |
* Fixed warning. * Automatic whitespace cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39632 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
4f841cf2fae5b2b089a9ab4410728f1c7ca98d4b |
|
24-Feb-2008 |
Karsten Heimrich <host.haiku@gmx.de> |
* fixed Adopt(BString, len) test, as after adopt the source string should be empty, thus the pointer into that string should point to empty data... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24104 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
ea4ba5bf44692aa73e8cbfba402ef96076e25909 |
|
21-Nov-2004 |
shatty <shatty@nowhere.fake> |
address compiler warnings git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10125 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
5480b4590e267957b90b79736b3990ddd39459a3 |
|
13-Nov-2003 |
Stefano Ceccherini <stefano.ceccherini@gmail.com> |
Another patch from Oliver Tappe: BString behaves better when the user supplies out-of bounds values in Insert(), Remove(), etc. Code is refactored, and it fully complies with our guidelines. Tests have been updated too (hint: try the replace tests with R5 and our implementation...) git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5348 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
1b0ea0ad6dd4b4a5f08e1d3ec72514976cdf7a60 |
|
14-Oct-2002 |
Stefano Ceccherini <stefano.ceccherini@gmail.com> |
Added some comments to the tests git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1521 a95241bf-73f2-0310-859d-f6bbb57e9c96
|
#
eee13b4d9a4bda5ddd1b627845c43a7c905bef19 |
|
03-Oct-2002 |
Stefano Ceccherini <stefano.ceccherini@gmail.com> |
More tests for BString git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1352 a95241bf-73f2-0310-859d-f6bbb57e9c96
|