Skip to content

Conversation

@philnik777
Copy link
Contributor

We currently have __allocate_long_buffer as a static function inside basic_string. This functions basically just creates a __long string representation, so this patch makes it a constructor of that internal struct instead. This reduces the library-internal interface a bit, making it less likely to be misused.

@philnik777 philnik777 force-pushed the refactor_string branch 2 times, most recently from 0ca1bf2 to 4a9bb8e Compare November 10, 2025 10:28
@github-actions
Copy link

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff origin/main HEAD --extensions  -- libcxx/include/string --diff_from_common_commit

⚠️
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing origin/main to the base branch/commit you want to compare against.
⚠️

View the diff from clang-format here.
diff --git a/libcxx/include/string b/libcxx/include/string
index be3c52d8a..bff88dda3 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -867,11 +867,11 @@ private:
   // If the MSB is used for the short-flag, the max_size() is numeric_limits<size_type>::max() / 2.
   // This does not impact the short string representation, since we never need the MSB
   // for representing the size of a short string anyway.
-#if defined(_LIBCPP_BIG_ENDIAN) == defined(_LIBCPP_ABI_ALTERNATE_STRING_LAYOUT)
+#  if defined(_LIBCPP_BIG_ENDIAN) == defined(_LIBCPP_ABI_ALTERNATE_STRING_LAYOUT)
   static const size_type __endian_factor = 2;
-#else
+#  else
   static const size_type __endian_factor = 1;
-#endif
+#  endif
 
 #  ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant