From owner-freebsd-bugs Thu Nov 22 16:40:13 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 944BA37B417 for ; Thu, 22 Nov 2001 16:40:04 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id fAN0e4b04680; Thu, 22 Nov 2001 16:40:04 -0800 (PST) (envelope-from gnats) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id DDA4A37B405 for ; Thu, 22 Nov 2001 16:37:57 -0800 (PST) Received: (from nobody@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id fAN0bv704598; Thu, 22 Nov 2001 16:37:57 -0800 (PST) (envelope-from nobody) Message-Id: <200111230037.fAN0bv704598@freefall.freebsd.org> Date: Thu, 22 Nov 2001 16:37:57 -0800 (PST) From: mikem To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: bin/32204: [PATCH] Remove code redundancy in usr.sbin/lpr/common_source/printcap.c Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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