From owner-cvs-src@FreeBSD.ORG Thu Feb 28 04:09:08 2008 Return-Path: Delivered-To: cvs-src@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 921CD1065670; Thu, 28 Feb 2008 04:09:08 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 6865F8FC1F; Thu, 28 Feb 2008 04:09:08 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m1S498SA062562; Thu, 28 Feb 2008 04:09:08 GMT (envelope-from scf@repoman.freebsd.org) Received: (from scf@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m1S498YJ062561; Thu, 28 Feb 2008 04:09:08 GMT (envelope-from scf) Message-Id: <200802280409.m1S498YJ062561@repoman.freebsd.org> From: Sean Farley Date: Thu, 28 Feb 2008 04:09:08 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/lib/libc/stdlib getenv.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Feb 2008 04:09:08 -0000 scf 2008-02-28 04:09:08 UTC FreeBSD src repository Modified files: lib/libc/stdlib getenv.c Log: Replace the use of warnx() with direct output to stderr using _write(). This reduces the size of a statically-linked binary by approximately 100KB in a trivial "return (0)" test application. readelf -S was used to verify that the .text section was reduced and that using strlen() saved a few more bytes over using sizeof(). Since the section of code is only called when environ is corrupt (program bug), I went with fewer bytes over fewer cycles. I made minor edits to the submitted patch to make the output resemble warnx(). Submitted by: kib bz Approved by: wes (mentor) MFC after: 5 days Revision Changes Path 1.13 +36 -12 src/lib/libc/stdlib/getenv.c