forked from enlightenment/efl
ecore_drm_dbus: Do not use the same name for global and local variables
We use conn here for a global Dbus connection variable as well as sometimes in a local scope. Better rename the global one to avoid confusion and potential failures when the code would fallback to the global one even if the local scope should be used and the var was simply forgotten.
This commit is contained in:
parent
72f1a2600b
commit
37d20553bd
|
@ -5,7 +5,7 @@
|
|||
#include "ecore_drm_private.h"
|
||||
#include <sys/eventfd.h>
|
||||
|
||||
static DBusConnection *conn;
|
||||
static DBusConnection *dconn;
|
||||
static DBusPendingCall *dpending;
|
||||
static Ecore_Fd_Handler *_dbus_hdlr;
|
||||
static Ecore_Fd_Handler *_watch_hdlr;
|
||||
|
@ -85,7 +85,7 @@ _dbus_active_get(void)
|
|||
DBUS_TYPE_STRING, &n, DBUS_TYPE_INVALID);
|
||||
if (!ret) goto err;
|
||||
|
||||
ret = dbus_connection_send_with_reply(conn, msg, &pend, -1);
|
||||
ret = dbus_connection_send_with_reply(dconn, msg, &pend, -1);
|
||||
if (!ret) goto err;
|
||||
|
||||
ret = dbus_pending_call_set_notify(pend, _dbus_cb_notify, NULL, NULL);
|
||||
|
@ -186,7 +186,7 @@ _dbus_device_pause_done(uint32_t major, uint32_t minor)
|
|||
DBUS_TYPE_UINT32, &minor,
|
||||
DBUS_TYPE_INVALID);
|
||||
if (ret)
|
||||
dbus_connection_send(conn, msg, NULL);
|
||||
dbus_connection_send(dconn, msg, NULL);
|
||||
|
||||
dbus_message_unref(msg);
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ _dbus_device_release(uint32_t major, uint32_t minor)
|
|||
ret = dbus_message_append_args(msg, DBUS_TYPE_UINT32, &major,
|
||||
DBUS_TYPE_UINT32, &minor,
|
||||
DBUS_TYPE_INVALID);
|
||||
if (ret) dbus_connection_send(conn, msg, NULL);
|
||||
if (ret) dbus_connection_send(dconn, msg, NULL);
|
||||
dbus_message_unref(msg);
|
||||
}
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ _dbus_device_take(uint32_t major, uint32_t minor)
|
|||
dbus_error_init(&err);
|
||||
|
||||
rep =
|
||||
dbus_connection_send_with_reply_and_block(conn, msg, -1, &err);
|
||||
dbus_connection_send_with_reply_and_block(dconn, msg, -1, &err);
|
||||
if (!rep)
|
||||
{
|
||||
if (dbus_error_has_name(&err, DBUS_ERROR_UNKNOWN_METHOD))
|
||||
|
@ -605,29 +605,29 @@ _dbus_setup(void)
|
|||
ret = asprintf(&dpath, "/org/freedesktop/login1/session/%s", sid);
|
||||
if (ret < 0) return EINA_FALSE;
|
||||
|
||||
res = dbus_connection_add_filter(conn, _dbus_cb_filter, NULL, NULL);
|
||||
res = dbus_connection_add_filter(dconn, _dbus_cb_filter, NULL, NULL);
|
||||
if (!res)
|
||||
{
|
||||
ERR("Could not setup dbus filter: %m\n");
|
||||
goto err;
|
||||
}
|
||||
|
||||
res = _dbus_signal_add(conn, "org.freedesktop.login1",
|
||||
res = _dbus_signal_add(dconn, "org.freedesktop.login1",
|
||||
"org.freedesktop.login1.Manager",
|
||||
"SessionRemoved", "/org/freedesktop/login1");
|
||||
if (!res) goto err;
|
||||
|
||||
res = _dbus_signal_add(conn, "org.freedesktop.login1",
|
||||
res = _dbus_signal_add(dconn, "org.freedesktop.login1",
|
||||
"org.freedesktop.login1.Session",
|
||||
"PauseDevice", dpath);
|
||||
if (!res) goto err;
|
||||
|
||||
res = _dbus_signal_add(conn, "org.freedesktop.login1",
|
||||
res = _dbus_signal_add(dconn, "org.freedesktop.login1",
|
||||
"org.freedesktop.login1.Session",
|
||||
"ResumeDevice", dpath);
|
||||
if (!res) goto err;
|
||||
|
||||
res = _dbus_signal_add(conn, "org.freedesktop.login1",
|
||||
res = _dbus_signal_add(dconn, "org.freedesktop.login1",
|
||||
"org.freedesktop.DBus.Properties",
|
||||
"PropertiesChanged", dpath);
|
||||
if (!res) goto err;
|
||||
|
@ -657,7 +657,7 @@ _dbus_control_take(void)
|
|||
if (!dbus_message_append_args(msg, DBUS_TYPE_BOOLEAN, &f, DBUS_TYPE_INVALID))
|
||||
goto msg_err;
|
||||
|
||||
rep = dbus_connection_send_with_reply_and_block(conn, msg, -1, &err);
|
||||
rep = dbus_connection_send_with_reply_and_block(dconn, msg, -1, &err);
|
||||
if (!rep)
|
||||
{
|
||||
if (dbus_error_has_name(&err, DBUS_ERROR_UNKNOWN_METHOD))
|
||||
|
@ -691,7 +691,7 @@ _dbus_control_release(void)
|
|||
"ReleaseControl");
|
||||
if (msg)
|
||||
{
|
||||
dbus_connection_send(conn, msg, NULL);
|
||||
dbus_connection_send(dconn, msg, NULL);
|
||||
dbus_message_unref(msg);
|
||||
}
|
||||
}
|
||||
|
@ -781,23 +781,23 @@ conn_err:
|
|||
static void
|
||||
_dbus_close(void)
|
||||
{
|
||||
dbus_connection_set_timeout_functions(conn, NULL, NULL, NULL, NULL, NULL);
|
||||
dbus_connection_set_watch_functions(conn, NULL, NULL, NULL, NULL, NULL);
|
||||
dbus_connection_set_timeout_functions(dconn, NULL, NULL, NULL, NULL, NULL);
|
||||
dbus_connection_set_watch_functions(dconn, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
if (_dbus_hdlr) ecore_main_fd_handler_del(_dbus_hdlr);
|
||||
_dbus_hdlr = NULL;
|
||||
|
||||
dbus_connection_close(conn);
|
||||
dbus_connection_unref(conn);
|
||||
dbus_connection_close(dconn);
|
||||
dbus_connection_unref(dconn);
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
_ecore_drm_dbus_init(const char *session)
|
||||
{
|
||||
if (conn) return EINA_TRUE;
|
||||
if (dconn) return EINA_TRUE;
|
||||
|
||||
/* try to init dbus */
|
||||
if (!(conn = _dbus_open())) return EINA_FALSE;
|
||||
if (!(dconn = _dbus_open())) return EINA_FALSE;
|
||||
|
||||
sid = eina_stringshare_add(session);
|
||||
|
||||
|
|
Loading…
Reference in New Issue