Navigation Menu

Skip to content

Commit

Permalink
[dbus_service] Housekeeping
Browse files Browse the repository at this point in the history
Pass GDBusMethodInvocation as a parameter to dbus_service_tag_sequence,
that's the only place where sender's name is coming from.
  • Loading branch information
monich committed Sep 2, 2020
1 parent 0b3ef32 commit f62670a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
6 changes: 3 additions & 3 deletions plugins/dbus_service/dbus_service.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2018-2019 Jolla Ltd.
* Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2018-2020 Jolla Ltd.
* Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
Expand Down Expand Up @@ -112,7 +112,7 @@ dbus_service_tag_path(
NfcTargetSequence*
dbus_service_tag_sequence(
DBusServiceTag* tag,
const char* sender);
GDBusMethodInvocation* call);

void
dbus_service_tag_free(
Expand Down
3 changes: 1 addition & 2 deletions plugins/dbus_service/dbus_service_isodep.c
Expand Up @@ -69,8 +69,7 @@ dbus_service_isodep_sequence(
DBusServiceIsoDep* self,
GDBusMethodInvocation* call)
{
return dbus_service_tag_sequence(self->owner,
g_dbus_method_invocation_get_sender(call));
return dbus_service_tag_sequence(self->owner, call);
}

/*==========================================================================*
Expand Down
6 changes: 4 additions & 2 deletions plugins/dbus_service/dbus_service_tag.c
Expand Up @@ -148,9 +148,11 @@ dbus_service_tag_find_waiter(
NfcTargetSequence*
dbus_service_tag_sequence(
DBusServiceTag* self,
const char* sender)
GDBusMethodInvocation* call)
{
if (G_LIKELY(self) && G_LIKELY(sender)) {
const char* sender = g_dbus_method_invocation_get_sender(call);

if (G_LIKELY(sender)) {
if (self->lock && !g_strcmp0(self->lock->name, sender)) {
return self->lock->seq;
} else {
Expand Down
7 changes: 3 additions & 4 deletions plugins/dbus_service/dbus_service_tag_t2.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2018-2019 Jolla Ltd.
* Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2018-2020 Jolla Ltd.
* Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
Expand Down Expand Up @@ -126,8 +126,7 @@ dbus_service_tag_t2_sequence(
DBusServiceTagType2* self,
GDBusMethodInvocation* call)
{
return dbus_service_tag_sequence(self->owner,
g_dbus_method_invocation_get_sender(call));
return dbus_service_tag_sequence(self->owner, call);
}

/*==========================================================================*
Expand Down
Expand Up @@ -332,7 +332,6 @@ test_null(
void)
{
dbus_service_tag_free(NULL);
g_assert(!dbus_service_tag_sequence(NULL, NULL));
}

/*==========================================================================*
Expand Down

0 comments on commit f62670a

Please sign in to comment.