Skip to content

Commit f7c96c0

Browse files
sammy-SCfacebook-github-bot
authored andcommitted
Enable modernize-avoid-c-arrays in clang tidy
Summary: changelog: [internal] In an effort to make our codebase more approachable, I'm enabling more clang-tidy rules. Read more about modernize-avoid-c-arrays in https://clang.llvm.org/extra/clang-tidy/checks/modernize-avoid-c-arrays.html Reviewed By: ShikaSD Differential Revision: D33187162 fbshipit-source-id: c6b3888f67d095274bb492a01132985ae506c0d5
1 parent a97e0a8 commit f7c96c0

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

ReactCommon/react/renderer/.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ InheritParentConfig: true
33
Checks: '>
44
clang-diagnostic-*,
55
modernize-avoid-bind,
6+
modernize-avoid-c-arrays,
67
'
78
...

ReactCommon/react/renderer/core/RawProps.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "RawProps.h"
99

1010
#include <react/debug/react_native_assert.h>
11+
#include <react/renderer/core/RawPropsKey.h>
1112
#include <react/renderer/core/RawPropsParser.h>
1213

1314
namespace facebook {

ReactCommon/react/renderer/core/RawProps.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <jsi/JSIDynamic.h>
1818
#include <jsi/jsi.h>
1919
#include <react/renderer/core/PropsParserContext.h>
20-
#include <react/renderer/core/RawPropsKey.h>
2120
#include <react/renderer/core/RawPropsPrimitives.h>
2221
#include <react/renderer/core/RawValue.h>
2322
#include <vector>

ReactCommon/react/renderer/core/RawPropsKey.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include "RawPropsKey.h"
99

10+
#include <array>
1011
#include <cassert>
1112
#include <cstring>
1213

@@ -44,11 +45,11 @@ void RawPropsKey::render(char *buffer, RawPropsPropNameLength *length)
4445
}
4546

4647
RawPropsKey::operator std::string() const noexcept {
47-
char buffer[kPropNameLengthHardCap];
48+
auto buffer = std::array<char, kPropNameLengthHardCap>();
4849
RawPropsPropNameLength length = 0;
49-
render(buffer, &length);
50+
render(buffer.data(), &length);
5051
react_native_assert(length < kPropNameLengthHardCap);
51-
return std::string{buffer, length};
52+
return std::string{buffer.data(), length};
5253
}
5354

5455
static bool areFieldsEqual(char const *lhs, char const *rhs) {

0 commit comments

Comments
 (0)