diff mbox series

[uclibc-ng-devel] Remove unneeded comparisons.

Message ID 20240221180500.395007-1-dm.chestnykh@gmail.com
State Accepted
Headers show
Series [uclibc-ng-devel] Remove unneeded comparisons. | expand

Commit Message

Dmitry Chestnykh Feb. 21, 2024, 6:05 p.m. UTC
Inside `if` branches the conditions
`as->ino == bs->ino` and `as->dev == bs->dev`
are always false.

Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
---
 libpthread/nptl/sem_open.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Waldemar Brodkorb Feb. 26, 2024, 8:34 a.m. UTC | #1
Hi Dmitry,
Dmitry Chestnykh wrote,

> Inside `if` branches the conditions
> `as->ino == bs->ino` and `as->dev == bs->dev`
> are always false.
> 
> Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>

Thanks, applied and pushed,
 best regards
  Waldemar
diff mbox series

Patch

diff --git a/libpthread/nptl/sem_open.c b/libpthread/nptl/sem_open.c
index 2746da1b7..8c99d6dbe 100644
--- a/libpthread/nptl/sem_open.c
+++ b/libpthread/nptl/sem_open.c
@@ -147,11 +147,11 @@  __sem_search (const void *a, const void *b)
 
   if (as->ino != bs->ino)
     /* Cannot return the difference the type is larger than int.  */
-    return as->ino < bs->ino ? -1 : (as->ino == bs->ino ? 0 : 1);
+    return as->ino < bs->ino ? -1 : 1;
 
   if (as->dev != bs->dev)
     /* Cannot return the difference the type is larger than int.  */
-    return as->dev < bs->dev ? -1 : (as->dev == bs->dev ? 0 : 1);
+    return as->dev < bs->dev ? -1 : 1;
 
   return strcmp (as->name, bs->name);
 }