From 16a8f181ba61ac5d53ebdd13c0bcc1d185f0e90c Mon Sep 17 00:00:00 2001 From: Rose <83477269+AtariDreams@users.noreply.github.com> Date: Fri, 3 Feb 2023 10:55:17 -0500 Subject: [PATCH] Remove redundant checks These checks just do extra work and have no effect My justification: https://godbolt.org/z/bP6GzzMza --- backend/usb-darwin.c | 3 +-- cups/tls-darwin.c | 2 +- cups/tls-sspi.c | 2 +- filter/rastertoepson.c | 5 ++--- scheduler/type.c | 2 +- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/backend/usb-darwin.c b/backend/usb-darwin.c index a414050828..a4cd25dcb7 100644 --- a/backend/usb-darwin.c +++ b/backend/usb-darwin.c @@ -1809,8 +1809,7 @@ static CFStringRef copy_printer_interface_indexed_description(printer_interface_ if (description[1] != kUSBStringDesc) return NULL; - if ((description[0] & 1) != 0) - description[0] &= ~1; + description[0] &= ~1; if (description[0] < 2) return CFSTR(""); diff --git a/cups/tls-darwin.c b/cups/tls-darwin.c index 869e94db9d..002236a3b1 100644 --- a/cups/tls-darwin.c +++ b/cups/tls-darwin.c @@ -793,7 +793,7 @@ httpCredentialsString( if (!buffer) return (0); - if (buffer && bufsize > 0) + if (bufsize > 0) *buffer = '\0'; if ((first = (http_credential_t *)cupsArrayFirst(credentials)) != NULL && diff --git a/cups/tls-sspi.c b/cups/tls-sspi.c index 14f1a084a1..f925122f27 100644 --- a/cups/tls-sspi.c +++ b/cups/tls-sspi.c @@ -324,7 +324,7 @@ httpCredentialsString( if (!buffer) return (0); - if (buffer && bufsize > 0) + if (bufsize > 0) *buffer = '\0'; cert = http_sspi_create_credential(first); diff --git a/filter/rastertoepson.c b/filter/rastertoepson.c index c815691dc7..b9cfa548e9 100644 --- a/filter/rastertoepson.c +++ b/filter/rastertoepson.c @@ -462,11 +462,10 @@ CompressData(const unsigned char *line, /* I - Data to compress */ *comp_ptr++ = temp; /* - * Check the last bit in the current byte and the first bit in the - * next byte... + * Check the last bit in the current byte... */ - if ((temp & 0x01) && comp_ptr < line_end && *comp_ptr & 0x80) + if ((temp & 0x01) && comp_ptr < line_end) *comp_ptr &= 0x7f; } } diff --git a/scheduler/type.c b/scheduler/type.c index 731514c07f..c6c531022b 100644 --- a/scheduler/type.c +++ b/scheduler/type.c @@ -221,7 +221,7 @@ mimeAddTypeRule(mime_type_t *mt, /* I - Type to add to */ else if (*rule == '+' && current != NULL) { if (logic != MIME_MAGIC_AND && - current != NULL && current->prev != NULL) + current->prev != NULL) { /* * OK, we have more than 1 rule in the current tree level... Make a