Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 4c6de4f in mainline


Ignore:
Timestamp:
2017-12-10T21:51:26Z (4 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master
Children:
9b07fba
Parents:
68e5406
Message:

Remove unnecessary format string duplication from KLOG_PRINTF() macro.

Location:
uspace
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/io/klog.h

    r68e5406 r4c6de4f  
    4848
    4949#define KLOG_PRINTF(lvl, fmt, ...) ({ \
    50         char *_fmt = str_dup(fmt); \
    51         size_t _fmtsize = str_size(_fmt); \
    52         if (_fmtsize > 0 && _fmt[_fmtsize - 1] == '\n') \
    53                 _fmt[_fmtsize - 1] = 0; \
    5450        char *_s; \
    55         int _c = asprintf(&_s, _fmt, ##__VA_ARGS__); \
    56         free(_fmt); \
     51        int _c = asprintf(&_s, fmt, ##__VA_ARGS__); \
    5752        if (_c >= 0) { \
    5853                _c = klog_write((lvl), _s, str_size(_s)); \
  • uspace/srv/logger/writer.c

    r68e5406 r4c6de4f  
    8080        }
    8181
    82         KLOG_PRINTF(level, "[%s] %s: %s\n",
     82        KLOG_PRINTF(level, "[%s] %s: %s",
    8383            log->full_name, log_level_str(level),
    8484            (const char *) message);
Note: See TracChangeset for help on using the changeset viewer.