From owner-svn-src-all@FreeBSD.ORG Wed Nov 25 04:35:55 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39E8D106566C; Wed, 25 Nov 2009 04:35:55 +0000 (UTC) (envelope-from wollman@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 29BA38FC13; Wed, 25 Nov 2009 04:35:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAP4ZsTn039244; Wed, 25 Nov 2009 04:35:54 GMT (envelope-from wollman@svn.freebsd.org) Received: (from wollman@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAP4Zsx5039242; Wed, 25 Nov 2009 04:35:54 GMT (envelope-from wollman@svn.freebsd.org) Message-Id: <200911250435.nAP4Zsx5039242@svn.freebsd.org> From: Garrett Wollman Date: Wed, 25 Nov 2009 04:35:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199783 - head/lib/libc/stdio X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Nov 2009 04:35:55 -0000 Author: wollman Date: Wed Nov 25 04:35:54 2009 New Revision: 199783 URL: http://svn.freebsd.org/changeset/base/199783 Log: Make all three if conditions look similar by always initializing nsec and moving the default initialization of prec into the else clause. The clang static analyzer erroneously thought that nsec can be used uninitialized here; it was not actually possible, but better to make the code clearer. (Clang can't know that sprintf() won't modify *pi behind the scenes.) Modified: head/lib/libc/stdio/xprintf_time.c Modified: head/lib/libc/stdio/xprintf_time.c ============================================================================== --- head/lib/libc/stdio/xprintf_time.c Wed Nov 25 04:27:55 2009 (r199782) +++ head/lib/libc/stdio/xprintf_time.c Wed Nov 25 04:35:54 2009 (r199783) @@ -64,7 +64,6 @@ __printf_render_time(struct __printf_io intmax_t t, tx; int i, prec, nsec; - prec = 0; if (pi->is_long) { tv = *((struct timeval **)arg[0]); t = tv->tv_sec; @@ -78,6 +77,8 @@ __printf_render_time(struct __printf_io } else { tp = *((time_t **)arg[0]); t = *tp; + nsec = 0; + prec = 0; } p = buf;