Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8261af7
)
A minor optimization to timestring.
author
Wayne Davison
<wayned@samba.org>
Fri, 3 Feb 2006 19:40:16 +0000
(19:40 +0000)
committer
Wayne Davison
<wayned@samba.org>
Fri, 3 Feb 2006 19:40:16 +0000
(19:40 +0000)
util.c
patch
|
blob
|
blame
|
history
diff --git
a/util.c
b/util.c
index
d37ab61
..
e33c7e8
100644
(file)
--- a/
util.c
+++ b/
util.c
@@
-1138,6
+1138,7
@@
char *timestring(time_t t)
{
static char TimeBuf[200];
struct tm *tm = localtime(&t);
+ char *p;
#ifdef HAVE_STRFTIME
strftime(TimeBuf, sizeof TimeBuf - 1, "%Y/%m/%d %H:%M:%S", tm);
@@
-1145,11
+1146,10
@@
char *timestring(time_t t)
strlcpy(TimeBuf, asctime(tm), sizeof TimeBuf);
#endif
- if (TimeBuf[strlen(TimeBuf)-1] == '\n') {
- TimeBuf[strlen(TimeBuf)-1] = 0;
- }
+ if ((p = strchr(TimeBuf, '\n')) != NULL)
+ *p = '\0';
- return
(TimeBuf)
;
+ return
TimeBuf
;
}