From baa764fab09e72e667dc31c9397094627eda1913 Mon Sep 17 00:00:00 2001 From: Alfonso Gregory <83477269+AtariDreams@users.noreply.github.com> Date: Mon, 30 Aug 2021 12:23:00 -0400 Subject: Remove redundant code --- systemv/cancel.c | 6 ++---- systemv/cupstestppd.c | 1 - systemv/lpstat.c | 26 ++++++++++++++------------ 3 files changed, 16 insertions(+), 17 deletions(-) (limited to 'systemv') diff --git a/systemv/cancel.c b/systemv/cancel.c index bcd638cc4..0f303886d 100644 --- a/systemv/cancel.c +++ b/systemv/cancel.c @@ -311,8 +311,7 @@ main(int argc, /* I - Number of command-line arguments */ op == IPP_PURGE_JOBS ? "purge-jobs" : "cancel-job", cupsLastErrorString()); - if (response) - ippDelete(response); + ippDelete(response); return (1); } @@ -375,8 +374,7 @@ main(int argc, /* I - Number of command-line arguments */ op == IPP_PURGE_JOBS ? "purge-jobs" : "cancel-job", cupsLastErrorString()); - if (response) - ippDelete(response); + ippDelete(response); return (1); } diff --git a/systemv/cupstestppd.c b/systemv/cupstestppd.c index b94cae944..c3a2d19dc 100644 --- a/systemv/cupstestppd.c +++ b/systemv/cupstestppd.c @@ -261,7 +261,6 @@ main(int argc, /* I - Number of command-line args */ default : usage(); - break; } } else diff --git a/systemv/lpstat.c b/systemv/lpstat.c index 1d14cb8e0..86e7a7ca3 100644 --- a/systemv/lpstat.c +++ b/systemv/lpstat.c @@ -634,7 +634,7 @@ match_list(const char *list, /* I - List of names */ if (!name) return (0); - while (*list) + do { /* * Skip leading whitespace and commas... @@ -660,6 +660,7 @@ match_list(const char *list, /* I - List of names */ while (*list && !isspace(*list & 255) && *list != ',') list ++; } + while (*list); return (0); } @@ -810,8 +811,8 @@ show_accepting(const char *printers, /* I - Destinations */ _cupsLangPrintf(stdout, _("%s not accepting requests since %s -"), printer, printer_state_time); _cupsLangPrintf(stdout, _("\t%s"), - (message == NULL || !*message) ? - "reason unknown" : message); + (message && *message) ? + message : "reason unknown"); } for (i = 0; i < num_dests; i ++) @@ -826,8 +827,8 @@ show_accepting(const char *printers, /* I - Destinations */ _("%s/%s not accepting requests since %s -"), printer, dests[i].instance, printer_state_time); _cupsLangPrintf(stdout, _("\t%s"), - (message == NULL || !*message) ? - "reason unknown" : message); + (message && *message) ? + message : "reason unknown"); } } } @@ -950,7 +951,7 @@ show_classes(const char *dests) /* I - Destinations */ printer_uri = NULL; members = NULL; - while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER) + do { if (!strcmp(attr->name, "printer-name") && attr->value_tag == IPP_TAG_NAME) @@ -966,6 +967,7 @@ show_classes(const char *dests) /* I - Destinations */ attr = attr->next; } + while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER); /* * If this is a remote class, grab the class info from the @@ -1789,10 +1791,10 @@ show_printers(const char *printers, /* I - Destinations */ if ((message && *message) || pstate == IPP_PRINTER_STOPPED) { - if (!message || !*message) - _cupsLangPuts(stdout, _("\treason unknown")); + if (message && *message) + _cupsLangPrintf(stdout, "\t%s", message); else - _cupsLangPrintf(stdout, "\t%s", message); + _cupsLangPuts(stdout, _("\treason unknown")); } if (long_status > 1) @@ -1909,10 +1911,10 @@ show_printers(const char *printers, /* I - Destinations */ if ((message && *message) || pstate == IPP_PRINTER_STOPPED) { - if (!message || !*message) - _cupsLangPuts(stdout, _("\treason unknown")); - else + if (message && *message) _cupsLangPrintf(stdout, "\t%s", message); + else + _cupsLangPuts(stdout, _("\treason unknown")); } if (long_status > 1) -- cgit v1.2.1