From a4ff2eb1e9a050571d01814fdbe835db40b25b7b Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Fri, 8 Mar 2013 13:15:36 +0100 Subject: [PATCH 2/2] Rename the term 'unix_pid' to 'pid' in variables and functions. Windows also has numeric process IDs that fit in an unsigned long, so there's no reason this has to be Unix-specific. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61787 --- dbus/dbus-auth-script.c | 2 +- dbus/dbus-credentials-util.c | 12 ++++++------ dbus/dbus-credentials.c | 32 ++++++++++++++++---------------- dbus/dbus-credentials.h | 4 ++-- dbus/dbus-sysdeps-unix.c | 4 ++-- dbus/dbus-sysdeps-win.c | 2 +- dbus/dbus-transport.c | 2 +- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/dbus/dbus-auth-script.c b/dbus/dbus-auth-script.c index 6285e3b..cbdd748 100644 --- a/dbus/dbus-auth-script.c +++ b/dbus/dbus-auth-script.c @@ -223,7 +223,7 @@ auth_set_unix_credentials(DBusAuth *auth, if (uid != DBUS_UID_UNSET) _dbus_credentials_add_unix_uid (credentials, uid); if (pid != DBUS_PID_UNSET) - _dbus_credentials_add_unix_pid (credentials, pid); + _dbus_credentials_add_pid (credentials, pid); _dbus_auth_set_credentials (auth, credentials); diff --git a/dbus/dbus-credentials-util.c b/dbus/dbus-credentials-util.c index 0277196..59cdcb8 100644 --- a/dbus/dbus-credentials-util.c +++ b/dbus/dbus-credentials-util.c @@ -40,7 +40,7 @@ static DBusCredentials* make_credentials(dbus_uid_t unix_uid, - dbus_pid_t unix_pid, + dbus_pid_t pid, const char *windows_sid) { DBusCredentials *credentials; @@ -56,9 +56,9 @@ make_credentials(dbus_uid_t unix_uid, } } - if (unix_pid != DBUS_PID_UNSET) + if (pid != DBUS_PID_UNSET) { - if (!_dbus_credentials_add_unix_pid (credentials, unix_pid)) + if (!_dbus_credentials_add_pid (credentials, pid)) { _dbus_credentials_unref (credentials); return NULL; @@ -102,7 +102,7 @@ _dbus_credentials_test (const char *test_data_dir) _dbus_assert (_dbus_credentials_include (creds, DBUS_CREDENTIAL_WINDOWS_SID)); _dbus_assert (_dbus_credentials_get_unix_uid (creds) == 12); - _dbus_assert (_dbus_credentials_get_unix_pid (creds) == 511); + _dbus_assert (_dbus_credentials_get_pid (creds) == 511); _dbus_assert (strcmp (_dbus_credentials_get_windows_sid (creds), SAMPLE_SID) == 0); _dbus_assert (!_dbus_credentials_are_empty (creds)); @@ -118,7 +118,7 @@ _dbus_credentials_test (const char *test_data_dir) _dbus_assert (_dbus_credentials_include (creds2, DBUS_CREDENTIAL_WINDOWS_SID)); _dbus_assert (_dbus_credentials_get_unix_uid (creds2) == 12); - _dbus_assert (_dbus_credentials_get_unix_pid (creds2) == 511); + _dbus_assert (_dbus_credentials_get_pid (creds2) == 511); _dbus_assert (strcmp (_dbus_credentials_get_windows_sid (creds2), SAMPLE_SID) == 0); _dbus_assert (_dbus_credentials_are_superset (creds, creds2)); @@ -192,7 +192,7 @@ _dbus_credentials_test (const char *test_data_dir) _dbus_assert (!_dbus_credentials_include (creds, DBUS_CREDENTIAL_WINDOWS_SID)); _dbus_assert (_dbus_credentials_get_unix_uid (creds) == DBUS_UID_UNSET); - _dbus_assert (_dbus_credentials_get_unix_pid (creds) == DBUS_PID_UNSET); + _dbus_assert (_dbus_credentials_get_pid (creds) == DBUS_PID_UNSET); _dbus_assert (_dbus_credentials_get_windows_sid (creds) == NULL); _dbus_assert (_dbus_credentials_are_empty (creds)); diff --git a/dbus/dbus-credentials.c b/dbus/dbus-credentials.c index ff69f3b..7325125 100644 --- a/dbus/dbus-credentials.c +++ b/dbus/dbus-credentials.c @@ -48,7 +48,7 @@ struct DBusCredentials { int refcount; dbus_uid_t unix_uid; - dbus_pid_t unix_pid; + dbus_pid_t pid; char *windows_sid; void *adt_audit_data; dbus_int32_t adt_audit_data_size; @@ -77,7 +77,7 @@ _dbus_credentials_new (void) creds->refcount = 1; creds->unix_uid = DBUS_UID_UNSET; - creds->unix_pid = DBUS_PID_UNSET; + creds->pid = DBUS_PID_UNSET; creds->windows_sid = NULL; creds->adt_audit_data = NULL; creds->adt_audit_data_size = 0; @@ -146,10 +146,10 @@ _dbus_credentials_unref (DBusCredentials *credentials) * @returns #FALSE if no memory */ dbus_bool_t -_dbus_credentials_add_unix_pid (DBusCredentials *credentials, - dbus_pid_t pid) +_dbus_credentials_add_pid (DBusCredentials *credentials, + dbus_pid_t pid) { - credentials->unix_pid = pid; + credentials->pid = pid; return TRUE; } @@ -231,7 +231,7 @@ _dbus_credentials_include (DBusCredentials *credentials, switch (type) { case DBUS_CREDENTIAL_UNIX_PROCESS_ID: - return credentials->unix_pid != DBUS_PID_UNSET; + return credentials->pid != DBUS_PID_UNSET; case DBUS_CREDENTIAL_UNIX_USER_ID: return credentials->unix_uid != DBUS_UID_UNSET; case DBUS_CREDENTIAL_WINDOWS_SID: @@ -252,9 +252,9 @@ _dbus_credentials_include (DBusCredentials *credentials, * @returns UNIX process ID */ dbus_pid_t -_dbus_credentials_get_unix_pid (DBusCredentials *credentials) +_dbus_credentials_get_pid (DBusCredentials *credentials) { - return credentials->unix_pid; + return credentials->pid; } /** @@ -322,8 +322,8 @@ _dbus_credentials_are_superset (DBusCredentials *credentials, DBusCredentials *possible_subset) { return - (possible_subset->unix_pid == DBUS_PID_UNSET || - possible_subset->unix_pid == credentials->unix_pid) && + (possible_subset->pid == DBUS_PID_UNSET || + possible_subset->pid == credentials->pid) && (possible_subset->unix_uid == DBUS_UID_UNSET || possible_subset->unix_uid == credentials->unix_uid) && (possible_subset->windows_sid == NULL || @@ -345,7 +345,7 @@ dbus_bool_t _dbus_credentials_are_empty (DBusCredentials *credentials) { return - credentials->unix_pid == DBUS_PID_UNSET && + credentials->pid == DBUS_PID_UNSET && credentials->unix_uid == DBUS_UID_UNSET && credentials->windows_sid == NULL && credentials->adt_audit_data == NULL; @@ -410,9 +410,9 @@ _dbus_credentials_add_credential (DBusCredentials *credentials, DBusCredentials *other_credentials) { if (which == DBUS_CREDENTIAL_UNIX_PROCESS_ID && - other_credentials->unix_pid != DBUS_PID_UNSET) + other_credentials->pid != DBUS_PID_UNSET) { - if (!_dbus_credentials_add_unix_pid (credentials, other_credentials->unix_pid)) + if (!_dbus_credentials_add_pid (credentials, other_credentials->pid)) return FALSE; } else if (which == DBUS_CREDENTIAL_UNIX_USER_ID && @@ -445,7 +445,7 @@ _dbus_credentials_add_credential (DBusCredentials *credentials, void _dbus_credentials_clear (DBusCredentials *credentials) { - credentials->unix_pid = DBUS_PID_UNSET; + credentials->pid = DBUS_PID_UNSET; credentials->unix_uid = DBUS_UID_UNSET; dbus_free (credentials->windows_sid); credentials->windows_sid = NULL; @@ -523,9 +523,9 @@ _dbus_credentials_to_string_append (DBusCredentials *credentials, goto oom; join = TRUE; } - if (credentials->unix_pid != DBUS_PID_UNSET) + if (credentials->pid != DBUS_PID_UNSET) { - if (!_dbus_string_append_printf (string, "%spid=" DBUS_PID_FORMAT, join ? " " : "", credentials->unix_pid)) + if (!_dbus_string_append_printf (string, "%spid=" DBUS_PID_FORMAT, join ? " " : "", credentials->pid)) goto oom; join = TRUE; } diff --git a/dbus/dbus-credentials.h b/dbus/dbus-credentials.h index ef6124f..abcc4bb 100644 --- a/dbus/dbus-credentials.h +++ b/dbus/dbus-credentials.h @@ -41,7 +41,7 @@ DBusCredentials* _dbus_credentials_new_from_current_process (void); DBusCredentials* _dbus_credentials_new (void); void _dbus_credentials_ref (DBusCredentials *credentials); void _dbus_credentials_unref (DBusCredentials *credentials); -dbus_bool_t _dbus_credentials_add_unix_pid (DBusCredentials *credentials, +dbus_bool_t _dbus_credentials_add_pid (DBusCredentials *credentials, dbus_pid_t pid); dbus_bool_t _dbus_credentials_add_unix_uid (DBusCredentials *credentials, dbus_uid_t uid); @@ -52,7 +52,7 @@ dbus_bool_t _dbus_credentials_add_adt_audit_data (DBusCredentials dbus_int32_t size); dbus_bool_t _dbus_credentials_include (DBusCredentials *credentials, DBusCredentialType type); -dbus_pid_t _dbus_credentials_get_unix_pid (DBusCredentials *credentials); +dbus_pid_t _dbus_credentials_get_pid (DBusCredentials *credentials); dbus_uid_t _dbus_credentials_get_unix_uid (DBusCredentials *credentials); const char* _dbus_credentials_get_windows_sid (DBusCredentials *credentials); void * _dbus_credentials_get_adt_audit_data (DBusCredentials *credentials); diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c index a031059..30606ff 100644 --- a/dbus/dbus-sysdeps-unix.c +++ b/dbus/dbus-sysdeps-unix.c @@ -1863,7 +1863,7 @@ _dbus_read_credentials_socket (int client_fd, if (pid_read != DBUS_PID_UNSET) { - if (!_dbus_credentials_add_unix_pid (credentials, pid_read)) + if (!_dbus_credentials_add_pid (credentials, pid_read)) { _DBUS_SET_OOM (error); return FALSE; @@ -2318,7 +2318,7 @@ _dbus_credentials_add_from_current_process (DBusCredentials *credentials) _dbus_assert (sizeof (uid_t) <= sizeof (dbus_uid_t)); _dbus_assert (sizeof (gid_t) <= sizeof (dbus_gid_t)); - if (!_dbus_credentials_add_unix_pid(credentials, _dbus_getpid())) + if (!_dbus_credentials_add_pid(credentials, _dbus_getpid())) return FALSE; if (!_dbus_credentials_add_unix_uid(credentials, _dbus_geteuid())) return FALSE; diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c index 57e8c62..ef4a9ab 100644 --- a/dbus/dbus-sysdeps-win.c +++ b/dbus/dbus-sysdeps-win.c @@ -1794,7 +1794,7 @@ _dbus_credentials_add_from_current_process (DBusCredentials *credentials) if (!_dbus_getsid(&sid)) goto failed; - if (!_dbus_credentials_add_unix_pid(credentials, _dbus_getpid())) + if (!_dbus_credentials_add_pid (credentials, _dbus_getpid())) goto failed; if (!_dbus_credentials_add_windows_sid (credentials,sid)) diff --git a/dbus/dbus-transport.c b/dbus/dbus-transport.c index ed8690d..027f5ba 100644 --- a/dbus/dbus-transport.c +++ b/dbus/dbus-transport.c @@ -1337,7 +1337,7 @@ _dbus_transport_get_unix_process_id (DBusTransport *transport, if (_dbus_credentials_include (auth_identity, DBUS_CREDENTIAL_UNIX_PROCESS_ID)) { - *pid = _dbus_credentials_get_unix_pid (auth_identity); + *pid = _dbus_credentials_get_pid (auth_identity); return TRUE; } else -- 1.7.4.msysgit.0