]> granicus.if.org Git - sysstat/commitdiff
Don't check if unsigned expressions are less than zero
authorSebastien GODARD <sysstat@users.noreply.github.com>
Wed, 15 Feb 2023 16:45:36 +0000 (17:45 +0100)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Wed, 15 Feb 2023 16:45:36 +0000 (17:45 +0100)
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
common.c
sa_common.c

index 0fc81bb6eb2ce16b78897b7bdc6ce590d73636e3..f3a88b4d2253b434a01041d26fdc356e6208561f 100644 (file)
--- a/common.c
+++ b/common.c
@@ -999,7 +999,7 @@ char *get_persistent_name_from_pretty(char *pretty)
        }
        free (persist_names);
 
-       if (strlen(persist_name) <= 0)
+       if (!strlen(persist_name))
                return (NULL);
 
        return persist_name;
index 4a4d140658d84336154c591aad9d3ab519e6b8e9..d7fadd25b821d8c57a9a6969fad9894490de41bc 100644 (file)
@@ -671,7 +671,7 @@ int decode_epoch(char timestamp[], struct tstamp_ext *tse, uint64_t flags)
 {
        tse->epoch_time = atol(timestamp);
 
-       if (tse->epoch_time <= 0) {
+       if (!tse->epoch_time) {
                tse->use = NO_TIME;
                return 1;
        }
@@ -1583,7 +1583,7 @@ int read_record_hdr(int ifd, void *buffer, struct record_header *record_hdr,
                }
 
                /* Sanity checks */
-               if ((record_hdr->record_type <= 0) || (record_hdr->record_type > R_EXTRA_MAX) ||
+               if (!record_hdr->record_type || (record_hdr->record_type > R_EXTRA_MAX) ||
                    (record_hdr->hour > 23) || (record_hdr->minute > 59) || (record_hdr->second > 60) || (record_hdr->ust_time < 1000000000)) {
 #ifdef DEBUG
                        fprintf(stderr, "%s: record_type=%d HH:MM:SS=%02d:%02d:%02d (%llu)\n",