]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
cleanup: remove unnecessary function 136/head
authorSami Kerola <kerolasa@iki.fi>
Tue, 16 Aug 2016 12:40:19 +0000 (13:40 +0100)
committerSami Kerola <kerolasa@iki.fi>
Tue, 16 Aug 2016 12:40:19 +0000 (13:40 +0100)
report.c

index 2f03019d64129de42ecf410082f5d83da99df762..67bf27c670a2411d999d5115116f84a3b9408289 100644 (file)
--- a/report.c
+++ b/report.c
@@ -48,19 +48,15 @@ extern int af;
 extern int reportwide;
 
 
-char *get_time_string (void) 
-{
-  time_t now; 
-  char *t;
-  now = time (NULL);
-  t = ctime (&now);
-  t [ strlen (t) -1] = 0; // remove the trailing newline
-  return t;
-}
-
 void report_open(void)
 {
-  printf ("Start: %s\n", get_time_string ());
+  const time_t now = time(NULL);
+  char *t = ctime (&now);
+  const size_t len = strlen(t);
+
+  if (t[len - 1] == '\n')
+    t[len - 1] = '\0';
+  printf ("Start: %s\n", t);
 }
 
 static size_t snprint_addr(char *dst, size_t dst_len, ip_t *addr)