Skip to content

Commit 7789ec0

Browse files
[libc] s/NULL/nullptr (#86867)
Otherwise we need to pull in stddef.h for the declaration of NULL.
1 parent 152fcf6 commit 7789ec0

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

libc/src/__support/char_vector.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

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

14-
#include <stddef.h>
15-
#include <stdlib.h> // For allocation.
14+
#include <stddef.h> // size_t
15+
#include <stdlib.h> // malloc, realloc, free
1616

1717
namespace LIBC_NAMESPACE {
1818

@@ -46,7 +46,7 @@ class CharVector {
4646
if (cur_str == local_buffer) {
4747
char *new_str;
4848
new_str = reinterpret_cast<char *>(malloc(cur_buff_size));
49-
if (new_str == NULL) {
49+
if (new_str == nullptr) {
5050
return false;
5151
}
5252
// TODO: replace with inline memcpy
@@ -55,7 +55,7 @@ class CharVector {
5555
cur_str = new_str;
5656
} else {
5757
cur_str = reinterpret_cast<char *>(realloc(cur_str, cur_buff_size));
58-
if (cur_str == NULL) {
58+
if (cur_str == nullptr) {
5959
return false;
6060
}
6161
}

libc/src/stdlib/str_from_util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// %{a,A,e,E,f,F,g,G}, are not allowed and any code that does otherwise results
1212
// in undefined behaviour(including use of a '%%' conversion specifier); which
1313
// in this case is that the buffer string is simply populated with the format
14-
// string. The case of the input being NULL should be handled in the calling
14+
// string. The case of the input being nullptr should be handled in the calling
1515
// function (strfromf, strfromd, strfroml) itself.
1616

1717
#ifndef LLVM_LIBC_SRC_STDLIB_STRFROM_UTIL_H

libc/src/stdlib/strtod.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ LLVM_LIBC_FUNCTION(double, strtod,
1919
if (result.has_error())
2020
libc_errno = result.error;
2121

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

2525
return result.value;

libc/src/stdlib/strtof.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ LLVM_LIBC_FUNCTION(float, strtof,
1919
if (result.has_error())
2020
libc_errno = result.error;
2121

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

2525
return result.value;

libc/src/stdlib/strtold.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ LLVM_LIBC_FUNCTION(long double, strtold,
1919
if (result.has_error())
2020
libc_errno = result.error;
2121

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

2525
return result.value;

0 commit comments

Comments
 (0)