Date: Thu, 22 Nov 2001 16:37:57 -0800 (PST) From: mikem <mike_makonnen@yahoo.com> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/32204: [PATCH] Remove code redundancy in usr.sbin/lpr/common_source/printcap.c Message-ID: <200111230037.fAN0bv704598@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 32204
>Category: bin
>Synopsis: [PATCH] Remove code redundancy in usr.sbin/lpr/common_source/printcap.c
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Thu Nov 22 16:40:04 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: mikem
>Release: 4-stable
>Organization:
>Environment:
FreeBSD blackbox.pacbell.net 4.4-STABLE FreeBSD 4.4-STABLE #3: Fri Nov 16 01:35:39 PST 2001 mikem@blackbox.pacbell.net:/usr/obj/src/stable/src/sys/BLACKBOX i386
>Description:
The functions firstprinter and nextprinter are nearly identical. It would be simpler to have firstprinter initialize the printer structure and then call nextprinter.
>How-To-Repeat:
>Fix:
--- printcap.c.original Thu Nov 22 01:30:54 2001
+++ printcap.c Thu Nov 22 01:31:53 2001
@@ -141,28 +141,13 @@
/*
* Scan through the database of printers using cgetfirst/cgetnext.
- * Return false of error or end-of-database; else true.
+ * Return false if error or end-of-database; else true.
*/
int
firstprinter(struct printer *pp, int *error)
{
- int status;
- char *bp;
-
init_printer(pp);
- status = cgetfirst(&bp, printcapdb);
- if (firstnextmap(&status) == 0) {
- if (error)
- *error = status;
- return 0;
- }
- if (error)
- *error = status;
- status = getprintcap_int(bp, pp);
- free(bp);
- if (error && status)
- *error = status;
- return 1;
+ return ( nextprinter(pp, error) );
}
int
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200111230037.fAN0bv704598>
