Skip to content

Commit

Permalink
chore: Use YES and NO for objc BOOL (#2717)
Browse files Browse the repository at this point in the history
hanging true to YES and false to NO in objc files.
  • Loading branch information
brustolin authored Feb 24, 2023
1 parent ce4cfaf commit eaa1002
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Sources/Sentry/SentryANRTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ - (void)detectANRs
NSTimeInterval sleepInterval = self.timeoutInterval / reportThreshold;

// Canceling the thread can take up to sleepInterval.
while (true) {
while (YES) {
@synchronized(threadLock) {
if (state != kSentryANRTrackerRunning) {
break;
Expand Down
2 changes: 1 addition & 1 deletion Sources/Sentry/SentryBreadcrumbTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ + (BOOL)avoidSender:(id)sender forTarget:(id)target action:(NSString *)action
forControlEvent:UIControlEventEditingChanged];
return [actions containsObject:action];
}
return false;
return NO;
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion Sources/Sentry/SentryCrashDefaultMachineContextWrapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ + (void)load

- (void)fillContextForCurrentThread:(struct SentryCrashMachineContext *)context
{
sentrycrashmc_getContextForThread(sentrycrashthread_self(), context, true);
sentrycrashmc_getContextForThread(sentrycrashthread_self(), context, YES);
}

- (int)getThreadCount:(struct SentryCrashMachineContext *)context
Expand Down
2 changes: 1 addition & 1 deletion Sources/Sentry/SentryCrashReportSink.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ - (void)sendReports:(NSArray *)reports onCompletion:(SentryCrashReportFilterComp
}
}
if (onCompletion) {
onCompletion(sentReports, TRUE, nil);
onCompletion(sentReports, YES, nil);
}
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/Sentry/SentryHub.m
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ - (void)startSession
}
_session = [[SentrySession alloc] initWithReleaseName:options.releaseName];

if (_errorsBeforeSession > 0 && options.enableAutoSessionTracking == true) {
if (_errorsBeforeSession > 0 && options.enableAutoSessionTracking == YES) {
_session.errors = _errorsBeforeSession;
_errorsBeforeSession = 0;
}
Expand Down Expand Up @@ -356,7 +356,7 @@ - (SentryId *)captureEvent:(SentryEvent *)event
customSamplingContext:(NSDictionary<NSString *, id> *)customSamplingContext
{
return [self startTransactionWithContext:transactionContext
bindToScope:false
bindToScope:NO
customSamplingContext:customSamplingContext];
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/Sentry/SentryPerformanceTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ - (SentrySpanId *)startSpanWithName:(NSString *)name
operation:operation];

[SentrySDK.currentHub.scope useSpan:^(id<SentrySpan> span) {
BOOL bindToScope = true;
BOOL bindToScope = YES;
if (span != nil) {
if ([SentryUIEventTracker isUIEventOperation:span.operation]) {
SENTRY_LOG_DEBUG(
Expand All @@ -74,7 +74,7 @@ - (SentrySpanId *)startSpanWithName:(NSString *)name
} else {
SENTRY_LOG_DEBUG(@"Current scope span %@ is not tracking a UI event",
span.spanId.sentrySpanIdString);
bindToScope = false;
bindToScope = NO;
}
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/Sentry/SentrySpanContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ @implementation SentrySpanContext

- (instancetype)initWithOperation:(NSString *)operation
{
return [self initWithOperation:operation sampled:false];
return [self initWithOperation:operation sampled:NO];
}

- (instancetype)initWithOperation:(NSString *)operation sampled:(SentrySampleDecision)sampled
Expand Down
2 changes: 1 addition & 1 deletion Sources/Sentry/SentryStacktraceBuilder.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ - (SentryStacktrace *)buildStackTraceFromStackEntries:(SentryCrashStackEntry *)e
- (SentryStacktrace *)buildStacktraceForThread:(SentryCrashThread)thread
context:(struct SentryCrashMachineContext *)context
{
sentrycrashmc_getContextForThread(thread, context, false);
sentrycrashmc_getContextForThread(thread, context, NO);
SentryCrashStackCursor stackCursor;
sentrycrashsc_initWithMachineContext(&stackCursor, MAX_STACKTRACE_LENGTH, context);

Expand Down
2 changes: 1 addition & 1 deletion Sources/Sentry/SentrySubClassFinder.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ - (void)actOnSubclassesOfViewControllerInImage:(NSString *)imageName block:(void
- (BOOL)isClass:(Class)childClass subClassOf:(Class)parentClass
{
if (!childClass || childClass == parentClass) {
return false;
return NO;
}

// Using a do while loop, like pointed out in Cocoa with Love
Expand Down
2 changes: 1 addition & 1 deletion Sources/Sentry/SentrySwizzle.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ - (SentrySwizzleOriginalIMP)getOriginalImplementation

#if TEST
@synchronized(self) {
self.originalCalled = true;
self.originalCalled = YES;
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion Sources/Sentry/SentryThreadInspector.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
getStackEntriesFromThread(SentryCrashThread thread, struct SentryCrashMachineContext *context,
SentryCrashStackEntry *buffer, unsigned int maxEntries)
{
sentrycrashmc_getContextForThread(thread, context, false);
sentrycrashmc_getContextForThread(thread, context, NO);
SentryCrashStackCursor stackCursor;

sentrycrashsc_initWithMachineContext(&stackCursor, MAX_STACKTRACE_LENGTH, context);
Expand Down
8 changes: 4 additions & 4 deletions Sources/Sentry/SentryViewHierarchy.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ - (BOOL)saveViewHierarchy:(NSString *)filePath
int fd = open(path, O_RDWR | O_CREAT | O_TRUNC, 0644);
if (fd < 0) {
SENTRY_LOG_DEBUG(@"Could not open file %s for writing: %s", path, strerror(errno));
return false;
return NO;
}

BOOL result = [self processViewHierarchy:windows addFunction:writeJSONDataToFile userData:&fd];
Expand Down Expand Up @@ -81,7 +81,7 @@ - (BOOL)processViewHierarchy:(NSArray<UIView *> *)windows
{

__block SentryCrashJSONEncodeContext JSONContext;
sentrycrashjson_beginEncode(&JSONContext, false, addJSONDataFunc, userData);
sentrycrashjson_beginEncode(&JSONContext, NO, addJSONDataFunc, userData);

int (^serializeJson)(void) = ^int() {
int result;
Expand All @@ -104,9 +104,9 @@ - (BOOL)processViewHierarchy:(NSArray<UIView *> *)windows
if (result != SentryCrashJSON_OK) {
SENTRY_LOG_DEBUG(
@"Could not create view hierarchy json: %s", sentrycrashjson_stringForError(result));
return false;
return NO;
}
return true;
return YES;
}

- (int)viewHierarchyFromView:(UIView *)view intoContext:(SentryCrashJSONEncodeContext *)context
Expand Down

0 comments on commit eaa1002

Please sign in to comment.