[libc-commits] [PATCH] D153572: [libc][NFC] Simplify return value logic in set_thread_ptr()

Jun Zhang via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Jun 22 09:42:00 PDT 2023


junaire created this revision.
Herald added projects: libc-project, All.
Herald added a subscriber: libc-commits.
junaire requested review of this revision.

Signed-off-by: Jun Zhang <jun at junz.org>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153572

Files:
  libc/startup/linux/x86_64/start.cpp


Index: libc/startup/linux/x86_64/start.cpp
===================================================================
--- libc/startup/linux/x86_64/start.cpp
+++ libc/startup/linux/x86_64/start.cpp
@@ -89,9 +89,7 @@
 
 // Sets the thread pointer to |val|. Returns true on success, false on failure.
 static bool set_thread_ptr(uintptr_t val) {
-  return __llvm_libc::syscall_impl(SYS_arch_prctl, ARCH_SET_FS, val) == -1
-             ? false
-             : true;
+  return __llvm_libc::syscall_impl(SYS_arch_prctl, ARCH_SET_FS, val) != -1;
 }
 
 using InitCallback = void(int, char **, char **);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153572.533664.patch
Type: text/x-patch
Size: 590 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230622/0d577198/attachment.bin>


More information about the libc-commits mailing list