summaryrefslogtreecommitdiff
path: root/absl/strings
Commit message (Collapse)AuthorAge
* Add a smaller library for string_view so that users canGravatar Derek Mauro2023-07-11
| | | | | | | | | | | depend on string_view without depending on all of //absl/strings:strings New code that uses string_view.h should depend on //absl/strings:string_view (Bazel) or absl::string_view (CMake) instead. PiperOrigin-RevId: 547283268 Change-Id: I6006b19605ce377d12c462129dda14251d16e1c1
* 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
* Introduce a kTotalMorePrecise accounting mode for ↵Gravatar Abseil Team2023-06-29
| | | | | | | | | Cord::EstimatedMemoryUsage(). This mode avoids double-counting blocks that a Cord references more than once; otherwise it is similar to the existing kTotal mode. There's no change to the existing kTotal or kFairShare accounting modes. PiperOrigin-RevId: 544378591 Change-Id: I7b4ae55cd93d631194e59a9cd0ff07f47611219e
* Remove two_ASCII_digits and replace with a scalar algorithmGravatar Abseil Team2023-06-13
| | | | | PiperOrigin-RevId: 539900072 Change-Id: I675386e3184f6f5ab70b851add970c91d1dde9c5
* Functions added: FindLongestCommonSuffix, FindLongestCommonPrefix.Gravatar Tsige Solomon2023-06-12
| | | | | PiperOrigin-RevId: 539784770 Change-Id: Ie224afa04af023bbddc89b967e8c8440f9e8a887
* 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
* | The previous code was using `memmove` under the hood (`string::append`).Gravatar Abseil Team2023-06-09
| | | | | | | | | | | | | | This patch makes it use `memcpy` for performance and consistency with other overloads. PiperOrigin-RevId: 539079130 Change-Id: I5aea9dd9b8a1ce708c787df7d6c9a75ae419c484
| * Use InlinedVectorGravatar pateldeev2023-06-08
|/
* Add a unit test that captures the current behavior of formatting of char ↵Gravatar Greg Falcon2023-06-05
| | | | | | | | | types and char-backed enum types through StrCat(), StrFormat("%v"), and Substitute(). This test allows us to modify the behavior in this space without introducing undesired changes elsewhere. PiperOrigin-RevId: 537981963 Change-Id: Icda91b66efcc0dc8c263011b137e130a3db2dc19
* 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
* Fix endianess in FastIntToBufferGravatar Abseil Team2023-05-22
| | | | | PiperOrigin-RevId: 534117706 Change-Id: Id48f1538e71d30286675eb32c9fb3e6f47774aa8
* Optimize absl::StrCat for integersGravatar Abseil Team2023-05-19
| | | | | | | Previous implementation used a lookup table of 200 bytes which, if not in L1 cache, could cause memory stalls and consumes 3-4 cache lines. This is suboptimal in real world scenarious. We are going to use a purely scalar version of merging 2/4/8 bytes together. PiperOrigin-RevId: 533576619 Change-Id: Icd730d18536f7eb35979b62582f6edf86b786019
* Merge pull request #1290 from jun-sheaf:patch-1Gravatar Copybara-Service2023-05-15
|\ | | | | | | | | PiperOrigin-RevId: 532199109 Change-Id: I5a2a96b9c8b52feb0107d912b0011911fc1f0f4c
* | 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.
* | Clarify code comment to avoid confusion.Gravatar Abseil Team2023-03-30
| | | | | | | | | | PiperOrigin-RevId: 520724148 Change-Id: Ia90c4a711649e89454bc2ca0a9d0d771d56e79c0
* | 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
* | Add StrContainsIgnoreCase() to strings/match.h; all the other case-sensitive ↵Gravatar Greg Falcon2023-03-15
| | | | | | | | | | | | | | methods in this file have corresponding case-insensitive ones. PiperOrigin-RevId: 516933773 Change-Id: Iaec41afd923b10bc493ad864c0ecfe85a1fe2db8
* | Performance improvement for absl::AsciiStrToUpper() and absl::AsciiStrToLower()Gravatar Abseil Team2023-03-13
| | | | | | | | | | PiperOrigin-RevId: 516275043 Change-Id: I906ef0d96dddf12e3738490bd26cb05753ec008c
* | Improve readability of ::testing::ElementsAre and ::testing::Le in unit ↵Gravatar Abseil Team2023-03-09
| | | | | | | | | | | | | | tests assertions. PiperOrigin-RevId: 515396682 Change-Id: I1b07d94611323569b199e1f4d03c7c49147c6bfb
* | 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.
* | Internal Code ChangeGravatar Abseil Team2023-03-06
| | | | | | | | | | PiperOrigin-RevId: 514567673 Change-Id: I02721d424f01965a7a5e08c06487af358c853627
* | Add CalculateBase64EscapeLen variations for the 3 base64 escaping methods ↵Gravatar Abseil Team2023-02-22
| | | | | | | | | | | | | | | | | | (Base64Escape, WebSafeBase64Escape, WebSafeBase64EscapeWithPadding). Also update CalculateBase64EscapedLen() documentation (it references outdated Base64Escape API), and reference it from WebSafeBase64Escape (to match Base64Escape). PiperOrigin-RevId: 511647760 Change-Id: I7dee18645c2a779c0762bc71da75a4684ec2493f
* | Merge pull request #1403 from AtariDreams:c++11Gravatar Copybara-Service2023-02-22
|\ \ | | | | | | | | | | | | PiperOrigin-RevId: 511539869 Change-Id: I32d5e91537b078691988e7e6d3244c682eb8d7d2
| * | Resolve TODO: remove C++11 workaroundsGravatar Rose2023-02-22
|/ / | | | | | | We no longer support C++11 as per the Google C++ support documentation: we support C++14 and up, so we can remove these workarounds.
* | 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
* | Adds `AbslStringify` support to `absl::Hex` and `absl::Dec`Gravatar Phoebe Liang2023-01-27
| | | | | | | | | | | | | | | | | | | | | | | | | | `absl::Hex` and `absl::Dec` are now stringifiable through `AbslStringify`. This means that they can be passed to logging, `absl::StrFormat`, `absl::StrCat` and `absl::Substitute`. Note that this change will break unsupported usages of `absl::AlphaNum`. `absl::AlphaNum` is not intended to be instantiated as a stack variable due to lifetime issues. Unsupported usages include: * constructing an `absl::AlphaNum` as a local variable. * For example, `absl::AlphaNum a = absl::Hex(...);` * declaring an `absl::AlphaNum` as a member variable Usage of `absl::AlphaNum` as a function parameter will continue to be supported. PiperOrigin-RevId: 505158534 Change-Id: Idecdf0b3d137482e86b393c7480229343d68eb36
* | Add lifetime annotations to AlphaNum.Gravatar Abseil Team2023-01-26
| | | | | | | | | | PiperOrigin-RevId: 504866618 Change-Id: I9519299946c693ae1bedd769a25a9cb5137f2f54
* | Cord does not need its str_format dependencyGravatar Derek Mauro2023-01-26
| | | | | | | | | | | | | | Fixes #1360 PiperOrigin-RevId: 504850733 Change-Id: Ifa1e83d0c703ed69c969a12076db474caec9d496
* | 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
* | Doc fix: state that Base64Escape does in fact produce padding. While at it, ↵Gravatar Abseil Team2023-01-19
| | | | | | | | | | | | | | harmonize Base64Unescape and WebSafeBase64Unescape's documentation of padding. PiperOrigin-RevId: 503178146 Change-Id: Id216044a9f6520653e2fa3a4505ff05eddf55659
* | Only enable cordz on Linux with thread_local supportGravatar Derek Mauro2023-01-19
| | | | | | | | | | | | | | Fixes #1365 PiperOrigin-RevId: 503160321 Change-Id: I210f194373c3e08a75d68298a8482be5f1f2227c
* | Use absl::string_view by value rather than by const reference while ↵Gravatar Abseil Team2023-01-19
| | | | | | | | | | | | | | iterating over collections. PiperOrigin-RevId: 503088193 Change-Id: Ic1f239f3b0427e0fea1643ec0ce7baff45ad647d
* | Clarify contract of AlphaNum as only a function parameter typeGravatar Tom Manshreck2023-01-18
| | | | | | | | | | PiperOrigin-RevId: 502901875 Change-Id: I1c8c097e5c81a9e413692109ebfe0d0b24f50f2e