[compiler-rt] r358145 - [NFC] Use clearer naming for local variables

JF Bastien via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 10 16:23:17 PDT 2019


Author: jfb
Date: Wed Apr 10 16:23:17 2019
New Revision: 358145

URL: http://llvm.org/viewvc/llvm-project?rev=358145&view=rev
Log:
[NFC] Use clearer naming for local variables

Modified:
    compiler-rt/trunk/lib/msan/msan_interceptors.cc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
    compiler-rt/trunk/test/msan/Linux/forkpty.cc

Modified: compiler-rt/trunk/lib/msan/msan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_interceptors.cc?rev=358145&r1=358144&r2=358145&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/msan/msan_interceptors.cc Wed Apr 10 16:23:17 2019
@@ -1187,14 +1187,14 @@ INTERCEPTOR(int, fork, void) {
 // NetBSD ships with openpty(3) in -lutil, that needs to be prebuilt explicitly
 // with MSan.
 #if SANITIZER_LINUX
-INTERCEPTOR(int, openpty, int *amaster, int *aslave, char *name,
+INTERCEPTOR(int, openpty, int *aparent, int *aworker, char *name,
             const void *termp, const void *winp) {
   ENSURE_MSAN_INITED();
   InterceptorScope interceptor_scope;
-  int res = REAL(openpty)(amaster, aslave, name, termp, winp);
+  int res = REAL(openpty)(aparent, aworker, name, termp, winp);
   if (!res) {
-    __msan_unpoison(amaster, sizeof(*amaster));
-    __msan_unpoison(aslave, sizeof(*aslave));
+    __msan_unpoison(aparent, sizeof(*aparent));
+    __msan_unpoison(aworker, sizeof(*aworker));
   }
   return res;
 }
@@ -1206,13 +1206,13 @@ INTERCEPTOR(int, openpty, int *amaster,
 // NetBSD ships with forkpty(3) in -lutil, that needs to be prebuilt explicitly
 // with MSan.
 #if SANITIZER_LINUX
-INTERCEPTOR(int, forkpty, int *amaster, char *name, const void *termp,
+INTERCEPTOR(int, forkpty, int *aparent, char *name, const void *termp,
             const void *winp) {
   ENSURE_MSAN_INITED();
   InterceptorScope interceptor_scope;
-  int res = REAL(forkpty)(amaster, name, termp, winp);
+  int res = REAL(forkpty)(aparent, name, termp, winp);
   if (res != -1)
-    __msan_unpoison(amaster, sizeof(*amaster));
+    __msan_unpoison(aparent, sizeof(*aparent));
   return res;
 }
 #define MSAN_MAYBE_INTERCEPT_FORKPTY INTERCEPT_FUNCTION(forkpty)

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc?rev=358145&r1=358144&r2=358145&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc Wed Apr 10 16:23:17 2019
@@ -239,25 +239,25 @@ int internal_sysctlbyname(const char *sn
                       (size_t)newlen);
 }
 
-int internal_forkpty(int *amaster) {
-  int master, slave;
-  if (openpty(&master, &slave, nullptr, nullptr, nullptr) == -1) return -1;
+int internal_forkpty(int *aparent) {
+  int parent, worker;
+  if (openpty(&parent, &worker, nullptr, nullptr, nullptr) == -1) return -1;
   int pid = internal_fork();
   if (pid == -1) {
-    close(master);
-    close(slave);
+    close(parent);
+    close(worker);
     return -1;
   }
   if (pid == 0) {
-    close(master);
-    if (login_tty(slave) != 0) {
+    close(parent);
+    if (login_tty(worker) != 0) {
       // We already forked, there's not much we can do.  Let's quit.
       Report("login_tty failed (errno %d)\n", errno);
       internal__exit(1);
     }
   } else {
-    *amaster = master;
-    close(slave);
+    *aparent = parent;
+    close(worker);
   }
   return pid;
 }

Modified: compiler-rt/trunk/test/msan/Linux/forkpty.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/msan/Linux/forkpty.cc?rev=358145&r1=358144&r2=358145&view=diff
==============================================================================
--- compiler-rt/trunk/test/msan/Linux/forkpty.cc (original)
+++ compiler-rt/trunk/test/msan/Linux/forkpty.cc Wed Apr 10 16:23:17 2019
@@ -10,19 +10,19 @@
 int
 main (int argc, char** argv)
 {
-  int master, slave;
-  openpty(&master, &slave, NULL, NULL, NULL);
-  assert(__msan_test_shadow(&master, sizeof(master)) == -1);
-  assert(__msan_test_shadow(&slave, sizeof(slave)) == -1);
+  int parent, worker;
+  openpty(&parent, &worker, NULL, NULL, NULL);
+  assert(__msan_test_shadow(&parent, sizeof(parent)) == -1);
+  assert(__msan_test_shadow(&worker, sizeof(worker)) == -1);
 
   char name[255];
-  ttyname_r(master, name, sizeof(name));
+  ttyname_r(parent, name, sizeof(name));
   assert(__msan_test_shadow(name, strlen(name) + 1) == -1);
 
-  char *name_p = ttyname(master);
+  char *name_p = ttyname(parent);
   assert(__msan_test_shadow(name_p, strlen(name_p) + 1) == -1);
 
-  int master2;
-  forkpty(&master2, NULL, NULL, NULL);
-  assert(__msan_test_shadow(&master2, sizeof(master2)) == -1);
+  int parent2;
+  forkpty(&parent2, NULL, NULL, NULL);
+  assert(__msan_test_shadow(&parent2, sizeof(parent2)) == -1);
 }




More information about the llvm-commits mailing list