Skip to content

Commit d7ab949

Browse files
Change c files to cpp
Reviewed By: gkassabli Differential Revision: D6271299 fbshipit-source-id: 66c0e54ccf019d72d1fd0b4d117826e4e84fdc89
1 parent 3c9092a commit d7ab949

File tree

10 files changed

+297
-234
lines changed

10 files changed

+297
-234
lines changed

React.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Pod::Spec.new do |s|
4343

4444
s.subspec "Core" do |ss|
4545
ss.dependency "yoga", "#{package["version"]}.React"
46-
ss.source_files = "React/**/*.{c,h,m,mm,S}"
46+
ss.source_files = "React/**/*.{c,h,m,mm,S,cpp}"
4747
ss.exclude_files = "**/__tests__/*",
4848
"IntegrationTests/*",
4949
"React/DevSupport/*",

React/React.xcodeproj/project.pbxproj

+50-32
Large diffs are not rendered by default.

React/ReactLegacy.xcodeproj/project.pbxproj

+16-18
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,11 @@
2727
137327E81AA5CF210034F82E /* RCTTabBarItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 137327E21AA5CF210034F82E /* RCTTabBarItem.m */; };
2828
137327E91AA5CF210034F82E /* RCTTabBarItemManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 137327E41AA5CF210034F82E /* RCTTabBarItemManager.m */; };
2929
137327EA1AA5CF210034F82E /* RCTTabBarManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 137327E61AA5CF210034F82E /* RCTTabBarManager.m */; };
30-
138FDE6B1E92EA4F005FEEDD /* YGEnums.c in Sources */ = {isa = PBXBuildFile; fileRef = 138FDE6A1E92EA4F005FEEDD /* YGEnums.c */; };
3130
139324FE1E70B069009FD7E0 /* RCTJSCErrorHandling.h in Headers */ = {isa = PBXBuildFile; fileRef = 139324FC1E70B069009FD7E0 /* RCTJSCErrorHandling.h */; };
3231
139324FF1E70B069009FD7E0 /* RCTJSCErrorHandling.mm in Sources */ = {isa = PBXBuildFile; fileRef = 139324FD1E70B069009FD7E0 /* RCTJSCErrorHandling.mm */; };
3332
13A0C2891B74F71200B29F6F /* RCTDevLoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 13A0C2861B74F71200B29F6F /* RCTDevLoadingView.m */; };
3433
13A1F71E1A75392D00D3D453 /* RCTKeyCommands.m in Sources */ = {isa = PBXBuildFile; fileRef = 13A1F71D1A75392D00D3D453 /* RCTKeyCommands.m */; };
3534
13A6E20E1C19AA0C00845B82 /* RCTParserUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 13A6E20D1C19AA0C00845B82 /* RCTParserUtils.m */; };
36-
13AB5E011DF777F2001A8C30 /* YGNodeList.c in Sources */ = {isa = PBXBuildFile; fileRef = 130A77051DF767AF001F9587 /* YGNodeList.c */; };
37-
13AB5E021DF777F2001A8C30 /* Yoga.c in Sources */ = {isa = PBXBuildFile; fileRef = 130A77071DF767AF001F9587 /* Yoga.c */; };
3835
13AB90C11B6FA36700713B4F /* RCTComponentData.m in Sources */ = {isa = PBXBuildFile; fileRef = 13AB90C01B6FA36700713B4F /* RCTComponentData.m */; };
3936
13AF20451AE707F9005F5298 /* RCTSlider.m in Sources */ = {isa = PBXBuildFile; fileRef = 13AF20441AE707F9005F5298 /* RCTSlider.m */; };
4037
13B07FEF1A69327A00A75B9A /* RCTAlertManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FE81A69327A00A75B9A /* RCTAlertManager.m */; };
@@ -157,7 +154,6 @@
157154
2D7FEB891E734B5700D3238C /* systemJSCWrapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65F3E41D1E73031C009375BD /* systemJSCWrapper.cpp */; };
158155
2D8C2E331DA40441000EE098 /* RCTMultipartStreamReader.m in Sources */ = {isa = PBXBuildFile; fileRef = 001BFCCF1D8381DE008E587E /* RCTMultipartStreamReader.m */; };
159156
2DD0EFE11DA84F2800B0C975 /* RCTStatusBarManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13723B4F1A82FD3C00F88898 /* RCTStatusBarManager.m */; };
160-
2DDD72161E931C25007C55D1 /* YGEnums.c in Sources */ = {isa = PBXBuildFile; fileRef = 138FDE6A1E92EA4F005FEEDD /* YGEnums.c */; };
161157
352DCFF01D19F4C20056D623 /* RCTI18nUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 352DCFEF1D19F4C20056D623 /* RCTI18nUtil.m */; };
162158
369123E11DDC75850095B341 /* RCTJSCSamplingProfiler.m in Sources */ = {isa = PBXBuildFile; fileRef = 369123E01DDC75850095B341 /* RCTJSCSamplingProfiler.m */; };
163159
391E86A41C623EC800009732 /* RCTTouchEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 391E86A21C623EC800009732 /* RCTTouchEvent.m */; };
@@ -682,9 +678,11 @@
682678
3DFE0D1A1DF8575800459392 /* YGEnums.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 130A77031DF767AF001F9587 /* YGEnums.h */; };
683679
3DFE0D1B1DF8575800459392 /* YGMacros.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 130A77041DF767AF001F9587 /* YGMacros.h */; };
684680
3DFE0D1C1DF8575800459392 /* Yoga.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 130A77081DF767AF001F9587 /* Yoga.h */; };
685-
3DFE0D1D1DF857FF00459392 /* YGNodeList.c in Sources */ = {isa = PBXBuildFile; fileRef = 130A77051DF767AF001F9587 /* YGNodeList.c */; };
686-
3DFE0D1E1DF857FF00459392 /* Yoga.c in Sources */ = {isa = PBXBuildFile; fileRef = 130A77071DF767AF001F9587 /* Yoga.c */; };
687681
3EDCA8A51D3591E700450C31 /* RCTErrorInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 3EDCA8A41D3591E700450C31 /* RCTErrorInfo.m */; };
682+
53CBF1BF1FB50263002CBB31 /* Yoga-internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 53CBF1BB1FB50262002CBB31 /* Yoga-internal.h */; };
683+
53CBF1C01FB50263002CBB31 /* YGEnums.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53CBF1BC1FB50263002CBB31 /* YGEnums.cpp */; };
684+
53CBF1C11FB50263002CBB31 /* Yoga.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53CBF1BD1FB50263002CBB31 /* Yoga.cpp */; };
685+
53CBF1C21FB50263002CBB31 /* YGNodeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53CBF1BE1FB50263002CBB31 /* YGNodeList.cpp */; };
688686
58114A161AAE854800E7D092 /* RCTPicker.m in Sources */ = {isa = PBXBuildFile; fileRef = 58114A131AAE854800E7D092 /* RCTPicker.m */; };
689687
58114A171AAE854800E7D092 /* RCTPickerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 58114A151AAE854800E7D092 /* RCTPickerManager.m */; };
690688
58114A501AAE93D500E7D092 /* RCTAsyncLocalStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 58114A4E1AAE93D500E7D092 /* RCTAsyncLocalStorage.m */; };
@@ -1168,9 +1166,7 @@
11681166
008341F51D1DB34400876D9A /* RCTJSStackFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTJSStackFrame.h; sourceTree = "<group>"; };
11691167
130A77031DF767AF001F9587 /* YGEnums.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YGEnums.h; sourceTree = "<group>"; };
11701168
130A77041DF767AF001F9587 /* YGMacros.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YGMacros.h; sourceTree = "<group>"; };
1171-
130A77051DF767AF001F9587 /* YGNodeList.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = YGNodeList.c; sourceTree = "<group>"; };
11721169
130A77061DF767AF001F9587 /* YGNodeList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YGNodeList.h; sourceTree = "<group>"; };
1173-
130A77071DF767AF001F9587 /* Yoga.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = Yoga.c; sourceTree = "<group>"; };
11741170
130A77081DF767AF001F9587 /* Yoga.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Yoga.h; sourceTree = "<group>"; };
11751171
131B6AF01AF1093D00FFC3E0 /* RCTSegmentedControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSegmentedControl.h; sourceTree = "<group>"; };
11761172
131B6AF11AF1093D00FFC3E0 /* RCTSegmentedControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSegmentedControl.m; sourceTree = "<group>"; };
@@ -1201,7 +1197,6 @@
12011197
137327E41AA5CF210034F82E /* RCTTabBarItemManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTabBarItemManager.m; sourceTree = "<group>"; };
12021198
137327E51AA5CF210034F82E /* RCTTabBarManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTTabBarManager.h; sourceTree = "<group>"; };
12031199
137327E61AA5CF210034F82E /* RCTTabBarManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTabBarManager.m; sourceTree = "<group>"; };
1204-
138FDE6A1E92EA4F005FEEDD /* YGEnums.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = YGEnums.c; sourceTree = "<group>"; };
12051200
139324FC1E70B069009FD7E0 /* RCTJSCErrorHandling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTJSCErrorHandling.h; sourceTree = "<group>"; };
12061201
139324FD1E70B069009FD7E0 /* RCTJSCErrorHandling.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTJSCErrorHandling.mm; sourceTree = "<group>"; };
12071202
13A0C2851B74F71200B29F6F /* RCTDevLoadingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCTDevLoadingView.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
@@ -1352,6 +1347,10 @@
13521347
3EDCA8A21D3591E700450C31 /* RCTErrorCustomizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTErrorCustomizer.h; sourceTree = "<group>"; };
13531348
3EDCA8A31D3591E700450C31 /* RCTErrorInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTErrorInfo.h; sourceTree = "<group>"; };
13541349
3EDCA8A41D3591E700450C31 /* RCTErrorInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTErrorInfo.m; sourceTree = "<group>"; };
1350+
53CBF1BB1FB50262002CBB31 /* Yoga-internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Yoga-internal.h"; sourceTree = "<group>"; };
1351+
53CBF1BC1FB50263002CBB31 /* YGEnums.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGEnums.cpp; sourceTree = "<group>"; };
1352+
53CBF1BD1FB50263002CBB31 /* Yoga.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Yoga.cpp; sourceTree = "<group>"; };
1353+
53CBF1BE1FB50263002CBB31 /* YGNodeList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGNodeList.cpp; sourceTree = "<group>"; };
13551354
58114A121AAE854800E7D092 /* RCTPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPicker.h; sourceTree = "<group>"; };
13561355
58114A131AAE854800E7D092 /* RCTPicker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPicker.m; sourceTree = "<group>"; };
13571356
58114A141AAE854800E7D092 /* RCTPickerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTPickerManager.h; sourceTree = "<group>"; };
@@ -1465,12 +1464,13 @@
14651464
130A77021DF767AF001F9587 /* yoga */ = {
14661465
isa = PBXGroup;
14671466
children = (
1468-
138FDE6A1E92EA4F005FEEDD /* YGEnums.c */,
1467+
53CBF1BC1FB50263002CBB31 /* YGEnums.cpp */,
1468+
53CBF1BE1FB50263002CBB31 /* YGNodeList.cpp */,
1469+
53CBF1BB1FB50262002CBB31 /* Yoga-internal.h */,
1470+
53CBF1BD1FB50263002CBB31 /* Yoga.cpp */,
14691471
130A77031DF767AF001F9587 /* YGEnums.h */,
14701472
130A77041DF767AF001F9587 /* YGMacros.h */,
1471-
130A77051DF767AF001F9587 /* YGNodeList.c */,
14721473
130A77061DF767AF001F9587 /* YGNodeList.h */,
1473-
130A77071DF767AF001F9587 /* Yoga.c */,
14741474
130A77081DF767AF001F9587 /* Yoga.h */,
14751475
);
14761476
name = yoga;
@@ -2185,6 +2185,7 @@
21852185
3D80DA611DF820620028D040 /* RCTAnimationType.h in Headers */,
21862186
3D80DA621DF820620028D040 /* RCTAutoInsetsProtocol.h in Headers */,
21872187
3D4153711F277092005B8EFE /* RCTConvert+Transform.h in Headers */,
2188+
53CBF1BF1FB50263002CBB31 /* Yoga-internal.h in Headers */,
21882189
3D80DA631DF820620028D040 /* RCTBorderDrawing.h in Headers */,
21892190
3D80DA641DF820620028D040 /* RCTBorderStyle.h in Headers */,
21902191
3D80DA651DF820620028D040 /* RCTComponent.h in Headers */,
@@ -2614,19 +2615,13 @@
26142615
isa = PBXSourcesBuildPhase;
26152616
buildActionMask = 2147483647;
26162617
files = (
2617-
13AB5E011DF777F2001A8C30 /* YGNodeList.c in Sources */,
2618-
13AB5E021DF777F2001A8C30 /* Yoga.c in Sources */,
2619-
138FDE6B1E92EA4F005FEEDD /* YGEnums.c in Sources */,
26202618
);
26212619
runOnlyForDeploymentPostprocessing = 0;
26222620
};
26232621
3D3C06181DE3340C00C268FA /* Sources */ = {
26242622
isa = PBXSourcesBuildPhase;
26252623
buildActionMask = 2147483647;
26262624
files = (
2627-
3DFE0D1D1DF857FF00459392 /* YGNodeList.c in Sources */,
2628-
3DFE0D1E1DF857FF00459392 /* Yoga.c in Sources */,
2629-
2DDD72161E931C25007C55D1 /* YGEnums.c in Sources */,
26302625
);
26312626
runOnlyForDeploymentPostprocessing = 0;
26322627
};
@@ -2711,6 +2706,7 @@
27112706
AC70D2E91DE489E4002E6351 /* RCTJavaScriptLoader.mm in Sources */,
27122707
14F7A0EC1BDA3B3C003C6C10 /* RCTPerfMonitor.m in Sources */,
27132708
1450FF881BCFF28A00208362 /* RCTProfileTrampoline-arm64.S in Sources */,
2709+
53CBF1C11FB50263002CBB31 /* Yoga.cpp in Sources */,
27142710
13E41EEB1C05CA0B00CD8DAC /* RCTProfileTrampoline-i386.S in Sources */,
27152711
3D37B5821D522B190042D5B5 /* RCTFont.mm in Sources */,
27162712
13B080061A6947C200A75B9A /* RCTScrollViewManager.m in Sources */,
@@ -2752,12 +2748,14 @@
27522748
191E3EC11C29DC3800C180A6 /* RCTRefreshControl.m in Sources */,
27532749
13C156051AB1A2840079392D /* RCTWebView.m in Sources */,
27542750
83CBBA601A601EAA00E9B192 /* RCTBridge.m in Sources */,
2751+
53CBF1C21FB50263002CBB31 /* YGNodeList.cpp in Sources */,
27552752
13C156061AB1A2840079392D /* RCTWebViewManager.m in Sources */,
27562753
58114A161AAE854800E7D092 /* RCTPicker.m in Sources */,
27572754
137327E81AA5CF210034F82E /* RCTTabBarItem.m in Sources */,
27582755
83A1FE8C1B62640A00BE0E65 /* RCTModalHostView.m in Sources */,
27592756
C60669311F3CC7BD00E67165 /* RCTModuleMethod.mm in Sources */,
27602757
13E067551A70F44B002CDEE1 /* RCTShadowView.m in Sources */,
2758+
53CBF1C01FB50263002CBB31 /* YGEnums.cpp in Sources */,
27612759
1450FF871BCFF28A00208362 /* RCTProfileTrampoline-arm.S in Sources */,
27622760
131B6AF51AF1093D00FFC3E0 /* RCTSegmentedControlManager.m in Sources */,
27632761
58114A171AAE854800E7D092 /* RCTPickerManager.m in Sources */,

ReactCommon/yoga/Android.mk

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ include $(CLEAR_VARS)
55
LOCAL_MODULE := yogacore
66

77
LOCAL_SRC_FILES := \
8-
yoga/Yoga.c \
9-
yoga/YGEnums.c \
10-
yoga/YGNodeList.c
8+
yoga/Yoga.cpp \
9+
yoga/YGEnums.cpp \
10+
yoga/YGNodeList.cpp
1111

1212
LOCAL_C_INCLUDES := $(LOCAL_PATH)
1313
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
1414

15-
LOCAL_CFLAGS := -Wall -Werror -fexceptions -frtti -std=c99 -O3
15+
LOCAL_CFLAGS := -Wall -Werror -fexceptions -frtti -std=c++1y -O3
1616

1717
include $(BUILD_STATIC_LIBRARY)

ReactCommon/yoga/BUCK

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
cxx_library(
22
name = "yoga",
3-
srcs = glob(["yoga/*.c"]),
3+
srcs = glob(["yoga/*.cpp"]),
4+
header_namespace = "",
5+
exported_headers = glob(["yoga/*.h"]),
46
compiler_flags = [
57
"-fno-omit-frame-pointer",
68
"-fexceptions",
79
"-Wall",
810
"-Werror",
9-
"-std=c99",
11+
"-std=c++1y",
1012
"-O3",
1113
],
12-
exported_headers = glob(["yoga/*.h"]),
1314
force_static = True,
14-
header_namespace = "",
1515
visibility = ["PUBLIC"],
1616
deps = [
1717
],

ReactCommon/yoga/yoga.podspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Pod::Spec.new do |spec|
2929
'-fexceptions',
3030
'-Wall',
3131
'-Werror',
32-
'-std=c11',
32+
'-std=c++1y',
3333
'-fPIC'
3434
]
3535

@@ -38,7 +38,7 @@ Pod::Spec.new do |spec|
3838

3939
# Set this environment variable when not using the `:path` option to install the pod.
4040
# E.g. when publishing this spec to a spec repo.
41-
source_files = 'yoga/**/*.{c,h}'
41+
source_files = 'yoga/**/*.{cpp,h}'
4242
source_files = File.join('ReactCommon/yoga', source_files) if ENV['INSTALL_YOGA_WITHOUT_PATH_OPTION']
4343
spec.source_files = source_files
4444
end

ReactCommon/yoga/yoga/YGEnums.c ReactCommon/yoga/yoga/YGEnums.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -224,4 +224,3 @@ const char *YGWrapToString(const YGWrap value){
224224
}
225225
return "unknown";
226226
}
227-

ReactCommon/yoga/yoga/YGNodeList.c ReactCommon/yoga/yoga/YGNodeList.cpp

+17-19
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,29 @@
1111

1212
#include "YGNodeList.h"
1313

14-
extern YGMalloc gYGMalloc;
15-
extern YGRealloc gYGRealloc;
16-
extern YGFree gYGFree;
17-
1814
struct YGNodeList {
1915
uint32_t capacity;
2016
uint32_t count;
2117
YGNodeRef *items;
2218
};
2319

2420
YGNodeListRef YGNodeListNew(const uint32_t initialCapacity) {
25-
const YGNodeListRef list = gYGMalloc(sizeof(struct YGNodeList));
26-
YGAssert(list != NULL, "Could not allocate memory for list");
21+
const YGNodeListRef list =
22+
(const YGNodeListRef)malloc(sizeof(struct YGNodeList));
23+
YGAssert(list != nullptr, "Could not allocate memory for list");
2724

2825
list->capacity = initialCapacity;
2926
list->count = 0;
30-
list->items = gYGMalloc(sizeof(YGNodeRef) * list->capacity);
31-
YGAssert(list->items != NULL, "Could not allocate memory for items");
27+
list->items = (YGNodeRef*)malloc(sizeof(YGNodeRef) * list->capacity);
28+
YGAssert(list->items != nullptr, "Could not allocate memory for items");
3229

3330
return list;
3431
}
3532

3633
void YGNodeListFree(const YGNodeListRef list) {
3734
if (list) {
38-
gYGFree(list->items);
39-
gYGFree(list);
35+
free(list->items);
36+
free(list);
4037
}
4138
}
4239

@@ -62,8 +59,9 @@ void YGNodeListInsert(YGNodeListRef *listp, const YGNodeRef node, const uint32_t
6259

6360
if (list->count == list->capacity) {
6461
list->capacity *= 2;
65-
list->items = gYGRealloc(list->items, sizeof(YGNodeRef) * list->capacity);
66-
YGAssert(list->items != NULL, "Could not extend allocation for items");
62+
list->items =
63+
(YGNodeRef*)realloc(list->items, sizeof(YGNodeRef) * list->capacity);
64+
YGAssert(list->items != nullptr, "Could not extend allocation for items");
6765
}
6866

6967
for (uint32_t i = list->count; i > index; i--) {
@@ -80,18 +78,18 @@ void YGNodeListReplace(YGNodeListRef list, const uint32_t index, const YGNodeRef
8078

8179
void YGNodeListRemoveAll(const YGNodeListRef list) {
8280
for (uint32_t i = 0; i < list->count; i++) {
83-
list->items[i] = NULL;
81+
list->items[i] = nullptr;
8482
}
8583
list->count = 0;
8684
}
8785

8886
YGNodeRef YGNodeListRemove(const YGNodeListRef list, const uint32_t index) {
8987
const YGNodeRef removed = list->items[index];
90-
list->items[index] = NULL;
88+
list->items[index] = nullptr;
9189

9290
for (uint32_t i = index; i < list->count - 1; i++) {
9391
list->items[i] = list->items[i + 1];
94-
list->items[i + 1] = NULL;
92+
list->items[i + 1] = nullptr;
9593
}
9694

9795
list->count--;
@@ -105,24 +103,24 @@ YGNodeRef YGNodeListDelete(const YGNodeListRef list, const YGNodeRef node) {
105103
}
106104
}
107105

108-
return NULL;
106+
return nullptr;
109107
}
110108

111109
YGNodeRef YGNodeListGet(const YGNodeListRef list, const uint32_t index) {
112110
if (YGNodeListCount(list) > 0) {
113111
return list->items[index];
114112
}
115113

116-
return NULL;
114+
return nullptr;
117115
}
118116

119117
YGNodeListRef YGNodeListClone(const YGNodeListRef oldList) {
120118
if (!oldList) {
121-
return NULL;
119+
return nullptr;
122120
}
123121
const uint32_t count = oldList->count;
124122
if (count == 0) {
125-
return NULL;
123+
return nullptr;
126124
}
127125
const YGNodeListRef newList = YGNodeListNew(count);
128126
memcpy(newList->items, oldList->items, sizeof(YGNodeRef) * count);

0 commit comments

Comments
 (0)