Frank LENORMAND
c57a86ce62
src: Fix undefined behaviour
...
Cppcheck produces the following warnings:
```
shared_string.hh:27:49: portability: Shifting signed 32-bit value by 31 bits is implementation-defined behaviour
shared_string.hh:27:49: error: Signed integer overflow for expression '1<<31'.
```
Fixes #4340
2021-10-23 10:36:37 +02:00
Maxime Coste
6373338c50
Replace uses of UnorderedMap with HashMap
2017-03-07 01:03:26 +00:00
Maxime Coste
d9abc2a156
Refactor StringData and StringRegistry to remove need for purging
...
Purging unused strings could get pretty expensive with a lot of
interned strings as it requiered iterating on all of them. Use
a flag on the refcount of the StringData to see if the string
is interned, and notify the StringRegistry in this case.
This should improve the speed of editing big files with many words,
such as the one described in #1195
2017-02-23 00:03:32 +00:00
Maxime Coste
f30e164232
Make SharedString::create take a list of StringViews
2017-01-30 13:38:38 +00:00
Maxime Coste
072064407a
Remove hash from StringData
...
Maintaining the hash value of strings is not worth it as we only
use it for buffer reload, but pay for it on any buffer modifications.
2017-01-28 13:04:55 +00:00
Maxime Coste
dcd8f6ef01
Apply clang-tidy modernize to the codebase
2017-01-08 22:39:01 +00:00
Maxime Coste
75986911f8
Refactor RefPtr handling to use a policy class
...
THe previous overload based system was pretty complex for no good
reason.
2016-12-03 12:32:16 +00:00
Maxime Coste
263ef0b149
Get rid of SharedString
2016-02-05 09:38:33 +00:00
Maxime Coste
ff6eacffa3
dont intern SharedStrings but StringDataPtr
2016-02-05 00:20:45 +00:00
Maxime Coste
65e67b0656
Remove unused _ss UDL
2015-11-06 13:37:51 +00:00
Maxime Coste
802d6e106c
Keep hash stored in StringData
2015-05-14 19:13:52 +01:00
Maxime Coste
78eb437b90
Formatting fix
2015-05-02 18:48:20 +01:00
Maxime Coste
2902fce437
Use an UnorderedSet for string registry
2015-04-16 12:38:59 +01:00
Maxime Coste
348e23dd8a
Remove unused StaticString
2015-03-12 09:52:33 +00:00
Maxime Coste
604e95f771
Tweak StringData::create implementation
2015-03-02 23:55:41 +00:00
Maxime Coste
0eca3b5526
Use StringDataPtr alias for RefPtr<StringData>
2015-03-01 12:06:19 +00:00
Maxime Coste
98972c18b7
rename StringStorage to StringData
2015-03-01 12:03:08 +00:00
Maxime Coste
092dcd174f
Add StaticStringStorage for storing string literals
2015-02-28 17:09:29 +00:00
Maxime Coste
0a6901899d
Use RefPtr as SafePtr backend
2015-02-23 20:39:56 +00:00
Maxime Coste
8df77121d7
Rename safe_ptr and ref_ptr to SafePtr and RefPtr
2015-02-19 13:58:25 +00:00
Maxime Coste
790e671f6c
Replace some <cstring> function usage with c++ algorithms
2015-02-10 23:09:30 +00:00
Maxime Coste
2c425bb436
Always inline StringStorage methods
2015-01-26 19:41:26 +00:00
Maxime Coste
42966317b8
Tweak SharedString
2015-01-25 22:36:05 +00:00
Maxime Coste
79954e89ab
Fix GCC 4.8 compilation
2015-01-24 14:36:03 +00:00
Maxime Coste
cb197f57ba
Avoid temporary strings on buffer load/reload
...
Pass directly a Vector<ref_ptr<StringStorage>> to the buffer
2015-01-22 13:39:29 +00:00
Maxime Coste
b1281d225d
rename SharedString::Storage to StringStorage and use directly in Buffer
2015-01-19 19:31:56 +00:00
Maxime Coste
3697548e35
Use a single allocation for SharedString::Storage
2015-01-19 13:25:04 +00:00
Maxime Coste
39689f0a18
Add helper for overloading operator new/delete
2015-01-18 18:49:32 +00:00
Maxime Coste
9b057896d4
Replace std::shared_ptr with homemade, intrusive, ref_ptr
...
That saves a lot of memory as sizeof(SharedString) is now one
pointer less.
2015-01-18 18:23:58 +00:00
Maxime Coste
4fd92127c3
Add a no copy shared string constructor, used for map lookup, and intern words
2015-01-15 19:58:08 +00:00
Maxime Coste
76d806e98d
Replace InternedStrings with SharedString, shared_ptr based
2015-01-15 19:26:38 +00:00