Skip to content

Commit b57ee62

Browse files
authored
fix: remove internal macro SENTRY_UNWRAP_NULLABLE from public header (#5759)
1 parent b5ef4c0 commit b57ee62

File tree

5 files changed

+20
-17
lines changed

5 files changed

+20
-17
lines changed

Sources/Sentry/Public/SentryDefines.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -203,20 +203,3 @@ typedef void (^SentryUserFeedbackConfigurationBlock)(
203203
SentryUserFeedbackConfiguration *_Nonnull configuration);
204204

205205
#endif // TARGET_OS_IOS && SENTRY_HAS_UIKIT
206-
207-
/**
208-
* `SENTRY_UNWRAP_NULLABLE` is used to unwrap a nullable pointer type to a non-nullable pointer type
209-
* It should be used after the pointer has been checked for nullability.
210-
*
211-
* For example:
212-
* ```objc
213-
* id _Nullable nullablePointer = ...;
214-
* if (nullablePointer != nil) {
215-
* MyClass *_Nonnull nonNullPointer = SENTRY_UNWRAP_NULLABLE(MyClass, nullablePointer);
216-
* }
217-
* ```
218-
*
219-
* We use this macro instead of directly casting to be able to find all usages of this
220-
* pattern in the codebase.
221-
*/
222-
#define SENTRY_UNWRAP_NULLABLE(type, nullable_var) (type *_Nonnull)(nullable_var)

Sources/Sentry/SentryArray.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#import "SentryArray.h"
22
#import "SentryDateUtils.h"
3+
#import "SentryInternalDefines.h"
34
#import "SentryNSDictionarySanitize.h"
45

56
@implementation SentryArray

Sources/Sentry/SentryNSDataUtils.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#endif
44

55
#import "SentryError.h"
6+
#import "SentryInternalDefines.h"
67
#import "SentryNSDataUtils.h"
78

89
NS_ASSUME_NONNULL_BEGIN

Sources/Sentry/SentyOptionsInternal.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#import "SentryCrashIntegration.h"
66
#import "SentryDsn.h"
77
#import "SentryFileIOTrackingIntegration.h"
8+
#import "SentryInternalDefines.h"
89
#import "SentryLevelMapper.h"
910
#import "SentryNetworkTrackingIntegration.h"
1011
#import "SentryOptions+Private.h"

Sources/Sentry/include/SentryInternalDefines.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,20 @@ static NSString *const SentryPlatformName = @"cocoa";
7878
#define SPAN_DATA_BLOCKED_MAIN_THREAD @"blocked_main_thread"
7979
#define SPAN_DATA_THREAD_ID @"thread.id"
8080
#define SPAN_DATA_THREAD_NAME @"thread.name"
81+
82+
/**
83+
* `SENTRY_UNWRAP_NULLABLE` is used to unwrap a nullable pointer type to a non-nullable pointer type
84+
* It should be used after the pointer has been checked for nullability.
85+
*
86+
* For example:
87+
* ```objc
88+
* id _Nullable nullablePointer = ...;
89+
* if (nullablePointer != nil) {
90+
* MyClass *_Nonnull nonNullPointer = SENTRY_UNWRAP_NULLABLE(MyClass, nullablePointer);
91+
* }
92+
* ```
93+
*
94+
* We use this macro instead of directly casting to be able to find all usages of this
95+
* pattern in the codebase.
96+
*/
97+
#define SENTRY_UNWRAP_NULLABLE(type, nullable_var) (type *_Nonnull)(nullable_var)

0 commit comments

Comments
 (0)