From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 09FA259CA9 for ; Mon, 28 Mar 2016 04:53:58 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 53CEC21C021; Mon, 28 Mar 2016 04:53:55 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 845CE21C01B for ; Mon, 28 Mar 2016 04:53:54 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 76DCF340A9C for ; Mon, 28 Mar 2016 04:53:52 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 39C0B86F for ; Mon, 28 Mar 2016 04:53:50 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1459102978.faaf0b2f02f3403cc727cd360e4dbf5509812735.vapier@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: qlop.c X-VCS-Directories: / X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: faaf0b2f02f3403cc727cd360e4dbf5509812735 X-VCS-Branch: master Date: Mon, 28 Mar 2016 04:53:50 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: f6661ab5-6895-46ee-a476-0fa497f6ae0a X-Archives-Hash: 74367c21c04203a699e03b1e28cad77c commit: faaf0b2f02f3403cc727cd360e4dbf5509812735 Author: Mike Frysinger gentoo org> AuthorDate: Sun Mar 27 18:22:58 2016 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Sun Mar 27 18:22:58 2016 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=faaf0b2f qlop: slight ctime speedup qlop.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/qlop.c b/qlop.c index dbbae06..ad62474 100644 --- a/qlop.c +++ b/qlop.c @@ -75,10 +75,9 @@ _q_static const char * chop_ctime(time_t t) { static char ctime_out[50]; - char *p; - snprintf(ctime_out, sizeof(ctime_out), "%s", ctime(&t)); - if ((p = strchr(ctime_out, '\n')) != NULL) - *p = '\0'; + int ret = snprintf(ctime_out, sizeof(ctime_out), "%s", ctime(&t)); + /* Assume no error! */ + ctime_out[ret - 1] = '\0'; return ctime_out; }