diff options
| author | Tyge Løvset <[email protected]> | 2020-10-24 13:39:19 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2020-10-24 13:39:19 +0200 |
| commit | 5e2366ced5cf1a52bfe69955f705fa98a250f56d (patch) | |
| tree | 44ea916aabdb2209627d8a41bfd4bd113d045264 | |
| parent | a1c0c53479ba7d8ac605fc1fb22ddb996ddcf3df (diff) | |
| download | STC-modified-5e2366ced5cf1a52bfe69955f705fa98a250f56d.tar.gz STC-modified-5e2366ced5cf1a52bfe69955f705fa98a250f56d.zip | |
More robust way.
| -rw-r--r-- | stc/cfmt.h | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -35,8 +35,9 @@ _cfmt_conv(int nargs, const char *fmt, ...); enum {_cfmt_bn=4, _cfmt_sn=64};
STC_INLINE const char* _cfmt_strftime(char* n, char buf[][_cfmt_sn], size_t maxsize, const char *fmt, const struct tm *timeptr) {
if (*n >= _cfmt_bn) return fmt;
- strftime(buf[*n], maxsize, fmt, timeptr);
- return buf[(*n)++];
+ int k = (*n)++;
+ strftime(buf[k], maxsize, fmt, timeptr);
+ return buf[k];
}
#ifndef __cplusplus
|
