[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] util: remove dead casts



The sequence:
  long long val;
  if ((long long) val != val)
is dead code.

* src/util/util.c (virStrToLong_ll, virStrToLong_ull): Remove
useless cast.
---

Pushing under the trivial rule.

 src/util/util.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/util.c b/src/util/util.c
index 6e041d6..1b39227 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -1571,13 +1571,13 @@ virStrToLong_ll(char const *s, char **end_ptr, int base, long long *result)
     long long val;
     char *p;
     int err;

     errno = 0;
     val = strtoll(s, &p, base);
-    err = (errno || (!end_ptr && *p) || p == s || (long long) val != val);
+    err = (errno || (!end_ptr && *p) || p == s);
     if (end_ptr)
         *end_ptr = p;
     if (err)
         return -1;
     *result = val;
     return 0;
@@ -1590,13 +1590,13 @@ virStrToLong_ull(char const *s, char **end_ptr, int base, unsigned long long *re
     unsigned long long val;
     char *p;
     int err;

     errno = 0;
     val = strtoull(s, &p, base);
-    err = (errno || (!end_ptr && *p) || p == s || (unsigned long long) val != val);
+    err = (errno || (!end_ptr && *p) || p == s);
     if (end_ptr)
         *end_ptr = p;
     if (err)
         return -1;
     *result = val;
     return 0;
-- 
1.7.7.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]