[1710] in BarnOwl Developers
[PATCH 2/2] Cleanup owl_function_debugmsg.
daemon@ATHENA.MIT.EDU (Karl Ramm)
Thu Oct 29 18:20:36 2009
Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
X-Original-To: nelhage@lunatique.mit.edu
From: Karl Ramm <kcr@1ts.org>
To: barnowl-dev@mit.edu
Cc: Karl Ramm <kcr@1ts.org>
Date: Mon, 21 Sep 2009 15:55:59 -0400
In-Reply-To: <1253562959-5650-1-git-send-email-kcr@1ts.org>
Nuke two buff[LINE]s in owl_function_debugmsg.
Remove now-unused owl_global_get_runtime_string.
---
functions.c | 20 +++++++++-----------
global.c | 9 ---------
2 files changed, 9 insertions(+), 20 deletions(-)
diff --git a/functions.c b/functions.c
index 7fb7882..992abba 100644
--- a/functions.c
+++ b/functions.c
@@ -1240,24 +1240,22 @@ void owl_function_debugmsg(const char *fmt, ...)
{
FILE *file;
time_t now;
- char buff1[LINE], buff2[LINE];
va_list ap;
va_start(ap, fmt);
- if (!owl_global_is_debug_fast(&g)) return;
-
- file=fopen(owl_global_get_debug_file(&g), "a");
- if (!file) return;
+ if (!owl_global_is_debug_fast(&g))
+ return;
- now=time(NULL);
- strcpy(buff1, ctime(&now));
- buff1[strlen(buff1)-1]='\0';
+ file = fopen(owl_global_get_debug_file(&g), "a");
+ if (!file) /* XXX should report this */
+ return;
- owl_global_get_runtime_string(&g, buff2);
+ now = time(NULL);
- fprintf(file, "[%i - %s - %s]: ", (int) getpid(), buff1, buff2);
+ fprintf(file, "[%d - %.24s - %lds]: ",
+ (int) getpid(), ctime(&now), now - owl_global_get_starttime(&g));
vfprintf(file, fmt, ap);
- fprintf(file, "\n");
+ putc('\n', file);
fclose(file);
va_end(ap);
diff --git a/global.c b/global.c
index 6430491..0cea998 100644
--- a/global.c
+++ b/global.c
@@ -524,15 +524,6 @@ time_t owl_global_get_idletime(const owl_global *g) {
return(time(NULL)-g->lastinputtime);
}
-void owl_global_get_runtime_string(const owl_global *g, char *buff) {
- time_t diff;
-
- diff=time(NULL)-owl_global_get_starttime(g);
-
- /* print something nicer later */
- sprintf(buff, "%i seconds", (int) diff);
-}
-
const char *owl_global_get_hostname(const owl_global *g) {
if (g->thishost) return(g->thishost);
return("");
--
1.6.3.3