@@ -353,7 +353,7 @@ swift_reflection_interop_libraryOwnsAddress(
353
353
// Search the images list to see if the address is in one of them.
354
354
struct SwiftReflectionInteropContextLegacyImageRangeList *Node =
355
355
ContextRef->LegacyImageRangeList ;
356
- while (Node != NULL ) {
356
+ while (Node != nullptr ) {
357
357
if (Node->Start <= Address && Address < Node->End )
358
358
return 1 ;
359
359
Node = Node->Next ;
@@ -380,7 +380,7 @@ swift_reflection_interop_libraryForAddress(
380
380
return Library;
381
381
}
382
382
}
383
- return NULL ;
383
+ return nullptr ;
384
384
}
385
385
386
386
static inline uintptr_t
@@ -408,7 +408,7 @@ swift_reflection_interop_libraryForObject(
408
408
if (Library->IsLegacy )
409
409
return Library;
410
410
}
411
- return NULL ;
411
+ return nullptr ;
412
412
}
413
413
414
414
return swift_reflection_interop_libraryForAddress (ContextRef, Metadata);
@@ -417,7 +417,7 @@ swift_reflection_interop_libraryForObject(
417
417
static inline int
418
418
swift_reflection_interop_loadFunctions (struct SwiftReflectionInteropContext *Context,
419
419
void *Handle) {
420
- if (Handle == NULL )
420
+ if (Handle == nullptr )
421
421
return 0 ;
422
422
423
423
struct SwiftReflectionInteropContextLibrary *Library = &Context
@@ -429,7 +429,7 @@ swift_reflection_interop_loadFunctions(struct SwiftReflectionInteropContext *Con
429
429
#endif
430
430
#define LOAD_NAMED (field, symbol, required ) do { \
431
431
Functions->field = (decltype (Functions->field ))dlsym (Handle, symbol); \
432
- if (required && Functions->field == NULL ) return 0 ; \
432
+ if (required && Functions->field == nullptr ) return 0 ; \
433
433
} while (0 )
434
434
#define LOAD (name ) LOAD_NAMED(name, " swift_reflection_" #name, 1 )
435
435
#define LOAD_OPT (name ) LOAD_NAMED(name, " swift_reflection_" #name, 0 )
@@ -441,7 +441,7 @@ swift_reflection_interop_loadFunctions(struct SwiftReflectionInteropContext *Con
441
441
if (version < SWIFT_LEGACY_METADATA_MIN_VERSION)
442
442
return 0 ;
443
443
444
- int IsLegacy = dlsym (Handle, " swift_reflection_addImage" ) == NULL ;
444
+ int IsLegacy = dlsym (Handle, " swift_reflection_addImage" ) == nullptr ;
445
445
446
446
if (IsLegacy) {
447
447
LOAD_NAMED (createReflectionContextLegacy, " swift_reflection_createReflectionContext" , 1 );
@@ -498,11 +498,11 @@ swift_reflection_interop_readBytesAdapter(void *reader_context,
498
498
void *FreeContext;
499
499
const void *ptr = Context->ReadBytes (Context->ReaderContext , address, size,
500
500
&FreeContext);
501
- if (ptr == NULL )
501
+ if (ptr == nullptr )
502
502
return 0 ;
503
503
504
504
memcpy (dest, ptr, size);
505
- if (Context->FreeBytes != NULL )
505
+ if (Context->FreeBytes != nullptr )
506
506
Context->FreeBytes (Context->ReaderContext , ptr, FreeContext);
507
507
return 1 ;
508
508
}
@@ -574,7 +574,7 @@ swift_reflection_interop_createReflectionContext(
574
574
575
575
return swift_reflection_interop_createReflectionContextWithDataLayout (
576
576
ReaderContext,
577
- NULL ,
577
+ nullptr ,
578
578
FreeBytes,
579
579
ReadBytes,
580
580
GetStringLength,
@@ -600,7 +600,7 @@ swift_reflection_interop_createReflectionContextWithDataLayout(
600
600
ContextRef->GetStringLength = GetStringLength;
601
601
ContextRef->GetSymbolAddress = GetSymbolAddress;
602
602
603
- ContextRef->AddressToLibraryCache = CFDictionaryCreateMutable (NULL , 0 , NULL , NULL );
603
+ ContextRef->AddressToLibraryCache = CFDictionaryCreateMutable (nullptr , 0 , nullptr , nullptr );
604
604
605
605
return ContextRef;
606
606
}
@@ -633,7 +633,7 @@ swift_reflection_interop_addLibrary(
633
633
} else {
634
634
uint8_t PointerSize;
635
635
int result = ContextRef->DataLayout (
636
- ContextRef->ReaderContext , DLQ_GetPointerSize, NULL , &PointerSize);
636
+ ContextRef->ReaderContext , DLQ_GetPointerSize, nullptr , &PointerSize);
637
637
if (!result)
638
638
abort (); // We need the pointer size, can't proceed without it.
639
639
@@ -658,14 +658,14 @@ swift_reflection_interop_destroyReflectionContext(
658
658
free (ContextRef->Libraries );
659
659
struct SwiftReflectionInteropContextLegacyImageRangeList *LegacyImageRangeList
660
660
= ContextRef->LegacyImageRangeList ;
661
- while (LegacyImageRangeList != NULL ) {
661
+ while (LegacyImageRangeList != nullptr ) {
662
662
struct SwiftReflectionInteropContextLegacyImageRangeList *Next
663
663
= LegacyImageRangeList->Next ;
664
664
free (LegacyImageRangeList);
665
665
LegacyImageRangeList = Next;
666
666
}
667
667
struct SwiftReflectionInteropContextFreeList *FreeList = ContextRef->FreeList ;
668
- while (FreeList != NULL ) {
668
+ while (FreeList != nullptr ) {
669
669
ContextRef->FreeBytes (ContextRef->ReaderContext ,
670
670
FreeList->Pointer , FreeList->Context );
671
671
struct SwiftReflectionInteropContextFreeList *Next = FreeList->Next ;
@@ -717,37 +717,37 @@ swift_reflection_interop_addImageLegacy(
717
717
ImageStart,
718
718
sizeof (MachHeader),
719
719
&FreeContext);
720
- if (Buf == NULL )
720
+ if (Buf == nullptr )
721
721
return 0 ;
722
722
723
723
MachHeader *Header = (MachHeader *)Buf;
724
724
725
725
if (Header->magic != MH_MAGIC && Header->magic != MH_MAGIC_64) {
726
- if (ContextRef->FreeBytes != NULL )
726
+ if (ContextRef->FreeBytes != nullptr )
727
727
ContextRef->FreeBytes (ContextRef->ReaderContext , Buf, FreeContext);
728
728
return 0 ;
729
729
}
730
730
731
731
// Read the commands.
732
732
uint32_t Length = Header->sizeofcmds ;
733
- if (ContextRef->FreeBytes != NULL )
733
+ if (ContextRef->FreeBytes != nullptr )
734
734
ContextRef->FreeBytes (ContextRef->ReaderContext , Buf, FreeContext);
735
735
736
736
Buf = ContextRef->ReadBytes (ContextRef->ReaderContext ,
737
737
ImageStart,
738
738
Length,
739
739
&FreeContext);
740
- if (Buf == NULL )
740
+ if (Buf == nullptr )
741
741
return 0 ;
742
742
Header = (MachHeader *)Buf;
743
743
744
744
// Find the TEXT segment and figure out where the end is.
745
745
unsigned long TextSize;
746
746
uint8_t *TextSegment = getsegmentdata (Header, " __TEXT" , &TextSize);
747
- if (ContextRef->FreeBytes != NULL )
747
+ if (ContextRef->FreeBytes != nullptr )
748
748
ContextRef->FreeBytes (ContextRef->ReaderContext , Buf, FreeContext);
749
749
750
- if (TextSegment == NULL ) {
750
+ if (TextSegment == nullptr ) {
751
751
return 0 ;
752
752
}
753
753
unsigned long TextEnd = TextSegment - (uint8_t *)Buf + TextSize;
@@ -757,7 +757,7 @@ swift_reflection_interop_addImageLegacy(
757
757
ImageStart,
758
758
TextEnd,
759
759
&FreeContext);
760
- if (Buf == NULL )
760
+ if (Buf == nullptr )
761
761
return 0 ;
762
762
Header = (MachHeader *)Buf;
763
763
@@ -785,7 +785,7 @@ swift_reflection_interop_addImageLegacy(
785
785
&info.reflstr ) || success;
786
786
787
787
if (!success) {
788
- if (ContextRef->FreeBytes != NULL )
788
+ if (ContextRef->FreeBytes != nullptr )
789
789
ContextRef->FreeBytes (ContextRef->ReaderContext , Buf, FreeContext);
790
790
return 0 ;
791
791
}
@@ -809,7 +809,7 @@ swift_reflection_interop_addImageLegacy(
809
809
810
810
// If the buffer needs to be freed, save buffer and free context to free it when the
811
811
// reflection context is destroyed.
812
- if (ContextRef->FreeBytes != NULL ) {
812
+ if (ContextRef->FreeBytes != nullptr ) {
813
813
struct SwiftReflectionInteropContextFreeList *FreeListNode =
814
814
(struct SwiftReflectionInteropContextFreeList *)malloc (sizeof (*FreeListNode));
815
815
FreeListNode->Next = ContextRef->FreeList ;
@@ -857,7 +857,7 @@ swift_reflection_interop_lookupMetadata(SwiftReflectionInteropContextRef Context
857
857
swift_metadata_interop_t Result = {};
858
858
struct SwiftReflectionInteropContextLibrary *Library =
859
859
swift_reflection_interop_libraryForAddress (ContextRef, Metadata);
860
- if (Library != NULL ) {
860
+ if (Library != nullptr ) {
861
861
Result.Metadata = Metadata;
862
862
Result.Library = (int )LIBRARY_INDEX;
863
863
}
@@ -881,7 +881,7 @@ swift_reflection_interop_typeRefForInstance(SwiftReflectionInteropContextRef Con
881
881
swift_typeref_interop_t Result = {};
882
882
struct SwiftReflectionInteropContextLibrary *Library
883
883
= swift_reflection_interop_libraryForObject (ContextRef, Object);
884
- if (Library != NULL ) {
884
+ if (Library != nullptr ) {
885
885
swift_typeref_t Typeref = Library->Functions .typeRefForInstance (Library->Context ,
886
886
Object);
887
887
Result.Typeref = Typeref;
@@ -967,7 +967,7 @@ swift_reflection_interop_infoForInstance(SwiftReflectionInteropContextRef Contex
967
967
struct SwiftReflectionInteropContextLibrary *Library
968
968
= swift_reflection_interop_libraryForObject (ContextRef, Object);
969
969
970
- if (Library != NULL ) {
970
+ if (Library != nullptr ) {
971
971
Result = Library->Functions .infoForInstance (Library->Context , Object);
972
972
} else {
973
973
Result.Kind = SWIFT_UNKNOWN;
@@ -983,7 +983,7 @@ swift_reflection_interop_childOfInstance(SwiftReflectionInteropContextRef Contex
983
983
swift_childinfo_interop_t Result = {};
984
984
struct SwiftReflectionInteropContextLibrary *Library
985
985
= swift_reflection_interop_libraryForObject (ContextRef, Object);
986
- if (Library != NULL ) {
986
+ if (Library != nullptr ) {
987
987
swift_childinfo_t LibResult = Library->Functions .childOfInstance (Library->Context ,
988
988
Object, Index);
989
989
Result.Name = LibResult.Name ;
@@ -1061,7 +1061,7 @@ swift_reflection_interop_dumpInfoForInstance(SwiftReflectionInteropContextRef Co
1061
1061
uintptr_t Object) {
1062
1062
struct SwiftReflectionInteropContextLibrary *Library
1063
1063
= swift_reflection_interop_libraryForObject (ContextRef, Object);
1064
- if (Library != NULL ) {
1064
+ if (Library != nullptr ) {
1065
1065
Library->Functions .dumpInfoForInstance (Library->Context , Object);
1066
1066
}
1067
1067
}
0 commit comments