Rename the term 'unix_pid' to 'pid' in variables and functions.
authorRalf Habacker <ralf.habacker@freenet.de>
Fri, 8 Mar 2013 12:15:36 +0000 (13:15 +0100)
committerRalf Habacker <ralf.habacker@freenet.de>
Fri, 8 Mar 2013 22:29:22 +0000 (23:29 +0100)
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
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
dbus/dbus-auth-script.c
dbus/dbus-credentials-util.c
dbus/dbus-credentials.c
dbus/dbus-credentials.h
dbus/dbus-sysdeps-unix.c
dbus/dbus-sysdeps-win.c
dbus/dbus-transport.c

index 6285e3b..cbdd748 100644 (file)
@@ -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);
 
index 0277196..59cdcb8 100644 (file)
@@ -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));
index ff69f3b..7325125 100644 (file)
@@ -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;
     }
index ef6124f..abcc4bb 100644 (file)
@@ -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);
index a031059..30606ff 100644 (file)
@@ -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;
index f8189af..ce60d29 100644 (file)
@@ -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))
index 6b58fda..c483d76 100644 (file)
@@ -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