Convert NULL and 0 to nullptr in base using clang-tidy.
Steps to replicate:
1. Build clang-tidy and clang-apply-replacements as described here: https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tidy.md
2. Build targets necessary for the change in out/gn.
3. Generate the compilation database:
tools/clang/scripts/generate_compdb.py -p out/gn > compile_commands.json
4. Run clang-tidy and apply replacements:
cd out/gn && PATH_TO_RUN_CLANG_TIDY/run-clang-tidy.py -p ../../ -clang-tidy-binary PATH_TO_CLANG_TIDY_BINARY -clang-apply-replacements-binary PATH_TO_CLANG_APPLY_REPLACEMENTS_BINARY -checks=-*,modernize-use-nullptr -fix -j 8 DIR_TO_CONVERT
Bug: 403854, 776257
Change-Id: I920f43d09b9fab758a3b8663fcf0c405d8519ad4
Reviewed-on: https://chromium-review.googlesource.com/732105
Commit-Queue: Ivan Kotenkov <[email protected]>
Reviewed-by: danakj <[email protected]>
Cr-Commit-Position: refs/heads/master@{#514808}
diff --git a/base/strings/sys_string_conversions_posix.cc b/base/strings/sys_string_conversions_posix.cc
index 35acaa0..cc039db 100644
--- a/base/strings/sys_string_conversions_posix.cc
+++ b/base/strings/sys_string_conversions_posix.cc
@@ -109,7 +109,7 @@
memset(&ps, 0, sizeof(ps));
for (size_t i = 0; i < native_mb.size(); ) {
const char* src = native_mb.data() + i;
- size_t res = mbrtowc(NULL, src, native_mb.size() - i, &ps);
+ size_t res = mbrtowc(nullptr, src, native_mb.size() - i, &ps);
switch (res) {
// Handle any errors and return an empty string.
case static_cast<size_t>(-2):