diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-06-19 11:45:21 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-06-19 11:45:21 +0200 |
commit | 11cb1e008bfb932a159cc746c5d435ae9518ed19 (patch) | |
tree | f51332299cb1cf43a2b910f5ac09e60d891a184e /runtime | |
parent | 77c992e2155420702460e835ce2d561cf2d10fcb (diff) | |
download | rsyslog-11cb1e008bfb932a159cc746c5d435ae9518ed19.tar.gz rsyslog-11cb1e008bfb932a159cc746c5d435ae9518ed19.tar.xz rsyslog-11cb1e008bfb932a159cc746c5d435ae9518ed19.zip |
some cleanup
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/datetime.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/runtime/datetime.c b/runtime/datetime.c index 114bd27f..30f397ff 100644 --- a/runtime/datetime.c +++ b/runtime/datetime.c @@ -556,9 +556,7 @@ int formatTimestampToMySQL(struct syslogTime *ts, char* pBuf, size_t iLenDst) */ assert(ts != NULL); assert(pBuf != NULL); - - if (iLenDst < 15) /* we need at least 14 bytes */ - return(0); + assert(iLenDst < 15); pBuf[0] = (ts->year / 1000) % 10 + '0'; pBuf[1] = (ts->year / 100) % 10 + '0'; @@ -581,12 +579,10 @@ int formatTimestampToMySQL(struct syslogTime *ts, char* pBuf, size_t iLenDst) int formatTimestampToPgSQL(struct syslogTime *ts, char *pBuf, size_t iLenDst) { - /* see note in formatTimestampToMySQL, applies here as well */ - assert(ts != NULL); - assert(pBuf != NULL); - - if (iLenDst < 20) /* we need 20 bytes */ - return(0); + /* see note in formatTimestampToMySQL, applies here as well */ + assert(ts != NULL); + assert(pBuf != NULL); + assert(iLenDst < 20): pBuf[0] = (ts->year / 1000) % 10 + '0'; pBuf[1] = (ts->year / 100) % 10 + '0'; @@ -745,8 +741,7 @@ int formatTimestamp3164(struct syslogTime *ts, char* pBuf, size_t iLenBuf) assert(ts != NULL); assert(pBuf != NULL); - if(iLenBuf < 16) - return(0); /* we NEED 16 bytes */ + assert(iLenBuf < 16); pBuf[0] = monthNames[(ts->month - 1)% 12][0]; pBuf[1] = monthNames[(ts->month - 1) % 12][1]; |