Changeset 132ab5d1 in mainline for uspace/lib/c/include/io/klog.h


Ignore:
Timestamp:
2018-01-30T03:20:45Z (8 years ago)
Author:
Jenda <jenda.jzqk73@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5a6cc679
Parents:
8bfb163 (diff), 6a5d05b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge commit '6a5d05bd2551e64111bea4f9332dd7448c26ce84' into forwardport

Separate return value from error code in gen_irq_code*().

File:
1 edited

Legend:

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

    r8bfb163 r132ab5d1  
    4444#include <abi/log.h>
    4545
    46 extern size_t klog_write(log_level_t, const void *, size_t);
    47 extern int klog_read(void *, size_t);
     46extern int klog_write(log_level_t, const void *, size_t);
     47extern int klog_read(void *, size_t, size_t *);
    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); \
    57         if (_c >= 0) { \
    58                 _c = klog_write((lvl), _s, str_size(_s)); \
     51        int _rc = ENOMEM; \
     52        if (asprintf(&_s, fmt, ##__VA_ARGS__) >= 0) { \
     53                _rc = klog_write((lvl), _s, str_size(_s)); \
    5954                free(_s); \
    6055        }; \
    61         (_c >= 0); \
     56        (_rc != EOK); \
    6257})
    6358
Note: See TracChangeset for help on using the changeset viewer.