Skip to content

[libc] s/NULL/nullptr #86867

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions libc/src/__support/char_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

#include "src/__support/common.h" // LIBC_INLINE

#include <stddef.h>
#include <stdlib.h> // For allocation.
#include <stddef.h> // size_t
#include <stdlib.h> // malloc, realloc, free

namespace LIBC_NAMESPACE {

Expand Down Expand Up @@ -46,7 +46,7 @@ class CharVector {
if (cur_str == local_buffer) {
char *new_str;
new_str = reinterpret_cast<char *>(malloc(cur_buff_size));
if (new_str == NULL) {
if (new_str == nullptr) {
return false;
}
// TODO: replace with inline memcpy
Expand All @@ -55,7 +55,7 @@ class CharVector {
cur_str = new_str;
} else {
cur_str = reinterpret_cast<char *>(realloc(cur_str, cur_buff_size));
if (cur_str == NULL) {
if (cur_str == nullptr) {
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdlib/str_from_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// %{a,A,e,E,f,F,g,G}, are not allowed and any code that does otherwise results
// in undefined behaviour(including use of a '%%' conversion specifier); which
// in this case is that the buffer string is simply populated with the format
// string. The case of the input being NULL should be handled in the calling
// string. The case of the input being nullptr should be handled in the calling
// function (strfromf, strfromd, strfroml) itself.

#ifndef LLVM_LIBC_SRC_STDLIB_STRFROM_UTIL_H
Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdlib/strtod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ LLVM_LIBC_FUNCTION(double, strtod,
if (result.has_error())
libc_errno = result.error;

if (str_end != NULL)
if (str_end != nullptr)
*str_end = const_cast<char *>(str + result.parsed_len);

return result.value;
Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdlib/strtof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ LLVM_LIBC_FUNCTION(float, strtof,
if (result.has_error())
libc_errno = result.error;

if (str_end != NULL)
if (str_end != nullptr)
*str_end = const_cast<char *>(str + result.parsed_len);

return result.value;
Expand Down
2 changes: 1 addition & 1 deletion libc/src/stdlib/strtold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ LLVM_LIBC_FUNCTION(long double, strtold,
if (result.has_error())
libc_errno = result.error;

if (str_end != NULL)
if (str_end != nullptr)
*str_end = const_cast<char *>(str + result.parsed_len);

return result.value;
Expand Down