summaryrefslogtreecommitdiff
path: root/absl/strings/internal
Commit message (Collapse)AuthorAge
* Undefine internal `ABSL_FORMAT_PARSER_INTERNAL_GET_CHAR` macro after usageGravatar Abseil Team2023-07-26
| | | | | PiperOrigin-RevId: 551287955 Change-Id: Ic77831cec71f6ffe0a4e091baabe932b245269ea
* Cleanup `//absl/strings/internal/memutil.h`Gravatar Derek Mauro2023-07-11
| | | | | | | | | | | | | `memmatch()` is only used in `string_view.cc`, so move it there. The moving of `memmatch()` to `string_view.cc` decouples `string_view` from `memutil`, which will allow us to move `string_view` into its own target in a followup. The only other function that is used is `memcasecmp()`, so delete all other functions. PiperOrigin-RevId: 547238386 Change-Id: Id6fad47dd24191c8e8f26dd923fffa1007c8db4a
* Remove two_ASCII_digits and replace with a scalar algorithmGravatar Abseil Team2023-06-13
| | | | | PiperOrigin-RevId: 539900072 Change-Id: I675386e3184f6f5ab70b851add970c91d1dde9c5
* Fix behaviors of StrCat() and StrFormat() regarding char types and enum types.Gravatar Greg Falcon2023-06-12
| | | | | | | | | | | | | | | | | | | This is a conservative change, in that it only contains bugfixes and allows new patterns that used to be compile errors. There are other changes we would like to make (as reflected in the comments in char_formatting_test.cc), but we are being careful about the implications of such behavior changes. The two implementation changes are: * Apply integral promotions to enums before printing them, so they are always treated as integers (and not chars) by StrCat and StrFormat. * Classify `unsigned char` and `signed char` as integer-like rather than char-like, so that `StrFormat("%v", v)` accepts those types as integers (consistent with `StrCat()`.) The behavior changes are: * StrCat() now accepts char-backed enums (rather than failing to compile). * StrFormat("%v") now accepts `signed char` and `unsigned char` as integral (rather than failing to compile). * StrFormat("%v") now correctly formats 8-bit enums as integers (rather than failing internally and emitting nothing). Tested: Modified the char_formatting_test.cc case to reflect changes. Re-ran all other tests. PiperOrigin-RevId: 539659674 Change-Id: Ief56335f5a57e4582af396d00eaa9e7b6be4ddc6
* Optimize Cord Refcount decrement.Gravatar Connal de Souza2023-06-09
| | | | | | | Introduce kHighRefcountMask which masks off flags and the LSb of the refcount value. In the cases where this mask is used, we don't need to check the LSb because we can assume the refcount is 1 when the rest of the masked RefcountAndFlags is empty, and the LSb doesn't matter if the masked value is not empty (either it's immortal or refcount > 1). This saves an instruction and a cycle (and + cmp -> tst) https://godbolt.org/z/Kz69eqfhq PiperOrigin-RevId: 539151659 Change-Id: I2ec7d72918f052c4b0938edd746af9d5b3052c7e
* Merge pull request #1472 from pateldeev:ivGravatar Copybara-Service2023-06-09
|\ | | | | | | | | PiperOrigin-RevId: 539145188 Change-Id: Ic8dc8112f77ca720a8871de57ee389f15693ab00
* | StrFormat() simplification: Treat %v unconditionally as %d when formatting ↵Gravatar Greg Falcon2023-06-09
| | | | | | | | | | | | | | | | | | integers. This is a simplification but not a behavior change; we used to choose %u for unsigned ints, but %u and %d generate the same output for these types. PiperOrigin-RevId: 539104599 Change-Id: I9d7ff561b969a6287889f95063636d6b77a4a78b
| * Use InlinedVectorGravatar pateldeev2023-06-08
|/
* Lifetime checks for `absl::StrSplit()`Gravatar Abseil Team2023-06-02
| | | | | PiperOrigin-RevId: 537400816 Change-Id: I06794a6b8b6a441e34121047024380190d42869a
* Migrate most RAW_LOGs and RAW_CHECKs in tests to regular LOG and CHECK.Gravatar Andy Getzendanner2023-05-23
| | | | | | | | | | | The non-RAW_ versions provide better output but weren't available when most of these tests were written. There are just a couple spots where RAW_ is actually needed, e.g. signal handlers and malloc hooks. Also fix a couple warnings in layout_test.cc newly surfaced because the optimizer understands CHECK_XX differently than INTERNAL_CHECK. PiperOrigin-RevId: 534584435 Change-Id: I8d36fa809ffdaae5a3813064bd602cb8611c1613
* CI: Move the GCC-latest testing to GCC 13.1 on LinuxGravatar Derek Mauro2023-05-22
| | | | | | | | | | This includes an upgrade to CMake 3.26.3 and Bazel 6.2.0 This change includes support for both GCC 12 and 13 since we were only testing GCC 11 before this change. PiperOrigin-RevId: 534235753 Change-Id: I4183a02469b1c3425c52a31b71fcefe403315a42
* Merge pull request #1115 from h-vetinari:dll_targetsGravatar Copybara-Service2023-05-15
| | | | | PiperOrigin-RevId: 532174747 Change-Id: I39dc6d5c369e8bfbdde5c826836e42f5baa69dc5
* Fixed Windows DLL builds of test targetsGravatar Derek Mauro2023-05-12
| | | | | | | | | | | | | | | | | | | | | | | | | | This is a heavily modified version of https://github.com/abseil/abseil-cpp/pull/1445, which adds some missing test libraries to the test DLL. Unlike #1445, this change moves several global variables out of headers that did not need to be in headers. For instance, cord_btree_exhaustive_validation was a global defined/declared in cord_internal, but only used in cord_rep_btree and its test. cordz_handle defined a queue in its header even though it wasn't needed, which also led to ODR problems. The Spinlock used in CordzHandle is replaced with a Mutex. This was originally a Mutex, but Chromium asked us to change it to a Spinlock to avoid a static initializer. After this change, the static initializer is no longer an issue. #1407 PiperOrigin-RevId: 531516991 Change-Id: I0e431a193698b20ba03fac6e414c26f153f330a7
* Stop moving an absl::FunctionRef, since the class isn't movable, itGravatar Derek Mauro2023-05-09
| | | | | | | | | | will just be a copy anyway. Also remove the typedef so that it is clear from the type at the callsite that moving it isn't necessary. Fixes #1443 PiperOrigin-RevId: 530596294 Change-Id: I58ffc370bbccc0816bca4c4f85c3bb12c7ee2eb2
* Fix spelling mistakesGravatar Vertexwahn2023-05-02
|
* Merge pull request #1438 from Vertexwahn:fix-spellingGravatar Copybara-Service2023-05-01
|\ | | | | | | | | PiperOrigin-RevId: 528547013 Change-Id: I9b57ee062ef666d6a34696778ff16a46c5ccb17d
| * Fix spelling mistakesGravatar Vertexwahn2023-04-27
|/
* Merge pull request #1434 from Vertexwahn:fix-spellingGravatar Copybara-Service2023-04-25
|\ | | | | | | | | PiperOrigin-RevId: 527066823 Change-Id: Ifa1e9a43c7490b34f9f4dbfa12d3acbed6b49777
| * Fix some spelling mistakesGravatar Vertexwahn2023-04-24
|/
* Merge pull request #1416 from AtariDreams:fillGravatar Copybara-Service2023-04-24
|\ | | | | | | | | PiperOrigin-RevId: 526675031 Change-Id: Ib84423ccea2d0183166194a0916a97a7ed32915c
| * Prefer copy_n and fill_n over copy and fill where appropriate.Gravatar Rose2023-04-19
|/ | | | This lets us avoid having to do the addition manually.
* Be more consistent in the documentation and variable declarations for base64 ↵Gravatar Abseil Team2023-03-16
| | | | | | | | | | | escaping vs unescaping: * Move table documenting escaping conversions to be next to the internal escaping code that implements it. Mention it from the internal _un_escaping code (which reverses it) too. * Centralize the two arrays which map from normal chars to escaped chars (k(WebSafe)Base64Chars), and make bidirectional documentation links between them and their reverse (unescaping) maps (kUn(WebSafe)Base64). * Remove redundant list of escaping/unescaping methods in the public escaping.cc. PiperOrigin-RevId: 517142667 Change-Id: I627e59a196ef855e5bf61ef7f4b509920e8d7acd
* Use const and static for member functionsGravatar Rose2023-03-07
| | | | This shows that these are member functions that do not modify a class's data.
* Remove Workarounds for Old Clang BugGravatar Rose2023-02-14
| | | | | | https://bugs.llvm.org/show_bug.cgi?id=38289 has been addressed since 2019. We just have to check to see if the clang being used to compile with is any version before major version 9.
* Fix missing includes/dependenciesGravatar Derek Mauro2023-02-02
| | | | | PiperOrigin-RevId: 506622658 Change-Id: I17ae2d97a6cadb7bdd8ebd0ec0dd3976568cb7e1
* Make `SanitizerSafeCopy()` constexpr, and check for constant evaluationGravatar Martijn Vels2023-01-25
| | | | | PiperOrigin-RevId: 504728034 Change-Id: Ifb338247b7484426e25a58580783a1d70d27e6fd
* Add memory sanitizer to absl::CordGravatar Martijn Vels2023-01-25
| | | | | PiperOrigin-RevId: 504555535 Change-Id: Id40484e9f52c87e9d67def2735ee60481ca50526
* Add missing include and remove unused includesGravatar Derek Mauro2023-01-19
| | | | | PiperOrigin-RevId: 503229681 Change-Id: I72817b43c547bd142144d0887866c4e26ec09fb2
* Only enable cordz on Linux with thread_local supportGravatar Derek Mauro2023-01-19
| | | | | | | Fixes #1365 PiperOrigin-RevId: 503160321 Change-Id: I210f194373c3e08a75d68298a8482be5f1f2227c
* Refactor InlineData to allow for memory sanitizer changes step 2Gravatar Martijn Vels2023-01-10
| | | | | PiperOrigin-RevId: 501074382 Change-Id: I26a59ee6452855685ffe89469c352e6384060f59
* Replace generic 'base64 encoding' terminology with the specific RFCs they match.Gravatar Abseil Team2023-01-09
| | | | | | | | | Remove duplicate documentation for two variants of Base64EscapeInternal(). Clarify role of base64 char array input (controls web-safe or not). PiperOrigin-RevId: 500867221 Change-Id: Ie316a7ddd60794e041c5b9b39e9ab5b66ed565a6
* Refactor InlineData to allow for memory sanitizer changes step 1Gravatar Martijn Vels2023-01-09
| | | | | PiperOrigin-RevId: 500765473 Change-Id: Iaa3f9fdee6c9f4322bc8995b0d381cf1c8cb1349
* Move description of escaping to code that does the escaping rather than the ↵Gravatar Abseil Team2023-01-05
| | | | | | | | | CalculateBase64EscapedLenInternal helper method. Note that output padding is conditional on do_padding. PiperOrigin-RevId: 499901986 Change-Id: I8c1d28fe372b3e0e2216654db83f949caa297892
* Replace ABSL_INTERNAL_UNREACHABLE with ABSL_UNREACHABLE()Gravatar Derek Mauro2022-12-22
| | | | | PiperOrigin-RevId: 497197704 Change-Id: I3865a874e04f6f55a1ab374b03451535a86bc5a3
* Allow Cord to store chunked checksumsGravatar Derek Mauro2022-12-11
| | | | | PiperOrigin-RevId: 494587777 Change-Id: I41504edca6fcf750d52602fa84a33bc7fe5fbb48
* Fixes issue where AbslStringify() breaks formatting with %d for enumsGravatar Phoebe Liang2022-12-07
| | | | | PiperOrigin-RevId: 493682437 Change-Id: I30f2ac36b998b86c24fe7513cd952b860560a66e
* Remove possible UB from CopyRaw()Gravatar Martijn Vels2022-12-07
| | | | | | | This change removes the 'create by single memcpy' CopyRaw() logic to avoid potential UB from the atomic refcount data being included in the memcpy. While we know this works on all supported platforms, it is officially UB, and we should change it to something else. This change changes the CopyRaw() method to explicitly create a (default initialized) instance, initialize `length` and `refcount`, and then memcpy the remaining contents which are trivial uint8_t and CordRep* values. PiperOrigin-RevId: 493596072 Change-Id: I46618883eb1c7c9ed9eb083f4d3e7fc501f23df5
* Use a c++14-style constexpr initialization if c++14 constexpr is available.Gravatar Jorg Brown2022-12-02
| | | | | PiperOrigin-RevId: 492463896 Change-Id: I063759ca5ceb3597a7c8ab25af23aa688dee26c2
* Convert the full parser into constexpr now that Abseil requires C++14, and useGravatar Samuel Benzaquen2022-11-29
| | | | | | | | | | | | | this parser for the static checker. This fixes some outstanding bugs where the static checker differed from the dynamic one. Also, fix `%v` to be accepted with POSIX syntax. Tested: Presubmit TGP OCL:487237262:BASE:490275393:1669141454896:92dd62e3 PiperOrigin-RevId: 491650577 Change-Id: Id138c108187428b3aea46f8887495f1da12c91b2
* Add support for enum types with AbslStringifyGravatar Abseil Team2022-11-09
| | | | | PiperOrigin-RevId: 487394692 Change-Id: I55e9b57055483dc921e9773c3643ea9be4f9bdf6
* Support logging of user-defined types that implement `AbslStringify()`Gravatar Phoebe Liang2022-11-02
| | | | | | | | | If a user-defined type has `AbslStringify()` defined, it will always be used for logging over `operator<<`. `HasAbslStringify` now uses the empty class `UnimplementedSink` for its checks instead of `StringifySink` in order to make it work in cases involving other sinks. PiperOrigin-RevId: 485710377 Change-Id: Ibdd916151c7abc3269c35fbe79b772867f3d25e1
* Fix -Wimplicit-int-conversion.Gravatar Abseil Team2022-11-02
| | | | | PiperOrigin-RevId: 485575914 Change-Id: If1752252e3cc2f91dc3c171382c9fb3a4def0377
* Support empty Cords with an expected checksumGravatar Derek Mauro2022-10-28
| | | | | PiperOrigin-RevId: 484578104 Change-Id: Ie4be3e4de27dc28d88395e16fd075fb10ab7a302
* Move internal details from one source file to another more appropriate sourceGravatar Andy Soffer2022-10-27
| | | | | | | file. PiperOrigin-RevId: 484419458 Change-Id: Ic2c1afa1a3434ac071c01ae2e6c75dee41b1f069
* Removes `PutPaddedString()` functionGravatar Phoebe Liang2022-10-27
| | | | | | | This function is unnecessary as it was originally used to support modifiers with `absl::StrFormat()`. This functionality is irrelevant to `absl::StrCat()`. PiperOrigin-RevId: 484339246 Change-Id: I8c4a0ee01b30aee7a83f6ab54e5465465cc9cc56
* Return uint8_t from CappedDamerauLevenshteinDistance.Gravatar Abseil Team2022-10-27
| | | | | PiperOrigin-RevId: 484181180 Change-Id: I00206c1506a25dca5555261d6500c1e54368a368
* Fix a sign conversion warning.Gravatar Abseil Team2022-10-19
| | | | | | Bug: chromium:1292951 PiperOrigin-RevId: 482287305 Change-Id: I896033c7c8b2645eacab974c4364c6ba66d38cb6
* Implement function to calculate Damerau-Levenshtein distance between two ↵Gravatar Abseil Team2022-10-17
| | | | | | | strings. PiperOrigin-RevId: 481568970 Change-Id: Icb132348f62fed4c0168aac4963b3313a060890b
* Support stringification of user-defined types in AbslStringify in ↵Gravatar Andy Soffer2022-10-14
| | | | | | | | | | | | | | absl::Substitute. We are also moving some internals into an internal header. `HasAbslStringify` was not previously in an internal namespace but was intended to be and has now been moved to an internal namespace. This is in adherence to our compatibility guidelines which wave requirements for APIs within their first 30 days of public release (See https://abseil.io/about/compatibility for details). PiperOrigin-RevId: 481190705 Change-Id: I4c0c348f269ea8d76ea3d4bd5a2c41cce475dc04
* Fix "unsafe narrowing" warnings in absl, 12/12.Gravatar Abseil Team2022-10-13
| | | | | | | | | | | | | | | Addresses failures with the following, in some files: -Wshorten-64-to-32 -Wimplicit-int-conversion -Wsign-compare -Wsign-conversion -Wtautological-unsigned-zero-compare (This specific CL enables these warnings and fixes the remaining known issues.) Bug: chromium:1292951 PiperOrigin-RevId: 480981210 Change-Id: I92d5023c6833e24d6aa29b10d433116329972f41