Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
Swatinem committed Jul 23, 2020
1 parent 85b8186 commit c375f0b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions include/sentry.h
Original file line number Diff line number Diff line change
Expand Up @@ -626,12 +626,12 @@ SENTRY_API void sentry_options_set_transport(
/**
* Type of the `before_send` callback.
*
* The callback taken ownership of the `event`, and will usually return that
* same event. In the case the event should be discarded, the callback needs to
* The callback takes ownership of the `event`, and should usually return that
* same event. In case the event should be discarded, the callback needs to
* call `sentry_value_decref` on the provided event, and return a
* `sentry_value_new_null` instead.
* `sentry_value_new_null()` instead.
* This function may be invoked inside of a signal handler and must be safe for
* that purpose.
* that purpose, see https://man7.org/linux/man-pages/man7/signal-safety.7.html.
*/
typedef sentry_value_t (*sentry_event_function_t)(
sentry_value_t event, void *hint, void *closure);
Expand Down
7 changes: 5 additions & 2 deletions src/sentry_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ sentry__should_skip_upload(void)
SENTRY_WITH_OPTIONS (options) {
skip = options->require_user_consent
&& sentry__atomic_fetch((long *)&options->user_consent)

!= SENTRY_USER_CONSENT_GIVEN;
}
return skip;
Expand Down Expand Up @@ -212,7 +211,11 @@ static void
set_user_consent(sentry_user_consent_t new_val)
{
SENTRY_WITH_OPTIONS (options) {
sentry__atomic_store((long *)&options->user_consent, new_val);
if (sentry__atomic_store((long *)&options->user_consent, new_val)
== new_val) {
// nothing was changed
break; // SENTRY_WITH_OPTIONS
}

if (options->backend && options->backend->user_consent_changed_func) {
options->backend->user_consent_changed_func(options->backend);
Expand Down
4 changes: 1 addition & 3 deletions src/sentry_database.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,7 @@ sentry__process_old_runs(const sentry_options_t *options)
if (!session_envelope) {
session_envelope = sentry__envelope_new();
}
if (session_envelope) {
sentry__envelope_add_session(session_envelope, session);
}
sentry__envelope_add_session(session_envelope, session);
sentry__session_free(session);
if ((++session_num) >= SENTRY_MAX_ENVELOPE_ITEMS) {
sentry__capture_envelope(
Expand Down
5 changes: 2 additions & 3 deletions src/sentry_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,9 @@ sentry_options_new(void)
sentry_options_t *
sentry__options_incref(sentry_options_t *options)
{
if (!options) {
return NULL;
if (options) {
sentry__atomic_fetch_and_add(&options->refcount, 1);
}
sentry__atomic_fetch_and_add(&options->refcount, 1);
return options;
}

Expand Down

0 comments on commit c375f0b

Please sign in to comment.