public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [gentoo-commits] proj/portage-utils:master commit in: /
@ 2016-03-28  4:53 99% Mike Frysinger
  0 siblings, 0 replies; 1+ results
From: Mike Frysinger @ 2016-03-28  4:53 UTC (permalink / raw
  To: gentoo-commits

commit:     faaf0b2f02f3403cc727cd360e4dbf5509812735
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 27 18:22:58 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> 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;
 }
 


^ permalink raw reply related	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-03-28  4:53 99% [gentoo-commits] proj/portage-utils:master commit in: / Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox