about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-03-24 20:50:12 +0000
committerUlrich Drepper <drepper@redhat.com>2004-03-24 20:50:12 +0000
commitcf2ac50f084efaae242a477cc2af8d164e813872 (patch)
tree5a70a5ff44a34e7c8d991946f975d141653ac616
parent63f78a3a9bea4a88f95792b00ef6363f0349f9ac (diff)
downloadglibc-cf2ac50f084efaae242a477cc2af8d164e813872.tar.gz
glibc-cf2ac50f084efaae242a477cc2af8d164e813872.tar.xz
glibc-cf2ac50f084efaae242a477cc2af8d164e813872.zip
(really_getpid): Reorganize code to avoid warning.
-rw-r--r--nptl/sysdeps/unix/sysv/linux/getpid.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/getpid.c b/nptl/sysdeps/unix/sysv/linux/getpid.c
index 1c3532b7e1..476981e975 100644
--- a/nptl/sysdeps/unix/sysv/linux/getpid.c
+++ b/nptl/sysdeps/unix/sysv/linux/getpid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
 
@@ -28,11 +28,12 @@ static inline __attribute__((always_inline)) pid_t really_getpid (pid_t oldval);
 static inline __attribute__((always_inline)) pid_t
 really_getpid (pid_t oldval)
 {
-  pid_t selftid;
-  if (__builtin_expect (oldval == 0
-			&& ((selftid = THREAD_GETMEM (THREAD_SELF, tid))
-			    != 0), 1))
-    return selftid;
+  if (__builtin_expect (oldval == 0, 1))
+    {
+      pid_t selftid = THREAD_GETMEM (THREAD_SELF, tid);
+      if (__builtin_expect (selftid != 0), 1)
+	return selftid;
+    }
 
   INTERNAL_SYSCALL_DECL (err);
   pid_t result = INTERNAL_SYSCALL (getpid, err, 0);