From b7644650dfd9795b3262c866924298b59299dd7b Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Wed, 30 Jul 2025 16:03:26 +0200 Subject: [PATCH] fix: remove internal macro SENTRY_UNWRAP_NULLABLE from public header --- Sources/Sentry/Public/SentryDefines.h | 17 ----------------- Sources/Sentry/SentryArray.m | 1 + Sources/Sentry/SentryNSDataUtils.m | 1 + Sources/Sentry/SentyOptionsInternal.m | 1 + Sources/Sentry/include/SentryInternalDefines.h | 17 +++++++++++++++++ 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/Sources/Sentry/Public/SentryDefines.h b/Sources/Sentry/Public/SentryDefines.h index a3a9e373387..e9ed26fd097 100644 --- a/Sources/Sentry/Public/SentryDefines.h +++ b/Sources/Sentry/Public/SentryDefines.h @@ -203,20 +203,3 @@ typedef void (^SentryUserFeedbackConfigurationBlock)( SentryUserFeedbackConfiguration *_Nonnull configuration); #endif // TARGET_OS_IOS && SENTRY_HAS_UIKIT - -/** - * `SENTRY_UNWRAP_NULLABLE` is used to unwrap a nullable pointer type to a non-nullable pointer type - * It should be used after the pointer has been checked for nullability. - * - * For example: - * ```objc - * id _Nullable nullablePointer = ...; - * if (nullablePointer != nil) { - * MyClass *_Nonnull nonNullPointer = SENTRY_UNWRAP_NULLABLE(MyClass, nullablePointer); - * } - * ``` - * - * We use this macro instead of directly casting to be able to find all usages of this - * pattern in the codebase. - */ -#define SENTRY_UNWRAP_NULLABLE(type, nullable_var) (type *_Nonnull)(nullable_var) diff --git a/Sources/Sentry/SentryArray.m b/Sources/Sentry/SentryArray.m index 030ef73aab6..300fd19cb0b 100644 --- a/Sources/Sentry/SentryArray.m +++ b/Sources/Sentry/SentryArray.m @@ -1,5 +1,6 @@ #import "SentryArray.h" #import "SentryDateUtils.h" +#import "SentryInternalDefines.h" #import "SentryNSDictionarySanitize.h" @implementation SentryArray diff --git a/Sources/Sentry/SentryNSDataUtils.m b/Sources/Sentry/SentryNSDataUtils.m index 9b9ae767b1e..7429900d524 100644 --- a/Sources/Sentry/SentryNSDataUtils.m +++ b/Sources/Sentry/SentryNSDataUtils.m @@ -3,6 +3,7 @@ #endif #import "SentryError.h" +#import "SentryInternalDefines.h" #import "SentryNSDataUtils.h" NS_ASSUME_NONNULL_BEGIN diff --git a/Sources/Sentry/SentyOptionsInternal.m b/Sources/Sentry/SentyOptionsInternal.m index 55c4b382629..b3797095c62 100644 --- a/Sources/Sentry/SentyOptionsInternal.m +++ b/Sources/Sentry/SentyOptionsInternal.m @@ -5,6 +5,7 @@ #import "SentryCrashIntegration.h" #import "SentryDsn.h" #import "SentryFileIOTrackingIntegration.h" +#import "SentryInternalDefines.h" #import "SentryLevelMapper.h" #import "SentryNetworkTrackingIntegration.h" #import "SentryOptions+Private.h" diff --git a/Sources/Sentry/include/SentryInternalDefines.h b/Sources/Sentry/include/SentryInternalDefines.h index b54acc56a85..cfedb7019e7 100644 --- a/Sources/Sentry/include/SentryInternalDefines.h +++ b/Sources/Sentry/include/SentryInternalDefines.h @@ -78,3 +78,20 @@ static NSString *const SentryPlatformName = @"cocoa"; #define SPAN_DATA_BLOCKED_MAIN_THREAD @"blocked_main_thread" #define SPAN_DATA_THREAD_ID @"thread.id" #define SPAN_DATA_THREAD_NAME @"thread.name" + +/** + * `SENTRY_UNWRAP_NULLABLE` is used to unwrap a nullable pointer type to a non-nullable pointer type + * It should be used after the pointer has been checked for nullability. + * + * For example: + * ```objc + * id _Nullable nullablePointer = ...; + * if (nullablePointer != nil) { + * MyClass *_Nonnull nonNullPointer = SENTRY_UNWRAP_NULLABLE(MyClass, nullablePointer); + * } + * ``` + * + * We use this macro instead of directly casting to be able to find all usages of this + * pattern in the codebase. + */ +#define SENTRY_UNWRAP_NULLABLE(type, nullable_var) (type *_Nonnull)(nullable_var)