diff options
Diffstat (limited to 'src/out.c')
-rw-r--r-- | src/out.c | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -417,7 +417,7 @@ ly_vprint_(struct ly_out *out, const char *format, va_list ap) { LY_ERR ret; int written = 0; - char *msg = NULL, *aux; + char *msg = NULL; switch (out->type) { case LY_OUT_FD: @@ -433,15 +433,13 @@ ly_vprint_(struct ly_out *out, const char *format, va_list ap) break; } if (out->method.mem.len + written + 1 > out->method.mem.size) { - aux = ly_realloc(*out->method.mem.buf, out->method.mem.len + written + 1); - if (!aux) { - out->method.mem.buf = NULL; + *out->method.mem.buf = ly_realloc(*out->method.mem.buf, out->method.mem.len + written + 1); + if (!*out->method.mem.buf) { out->method.mem.len = 0; out->method.mem.size = 0; LOGMEM(NULL); return LY_EMEM; } - *out->method.mem.buf = aux; out->method.mem.size = out->method.mem.len + written + 1; } if (written) { @@ -630,9 +628,9 @@ repeat: } LOGERR(NULL, LY_ESYS, "%s: writing data failed (%s).", __func__, strerror(errno)); written = 0; - } else if ((size_t)written != len) { - LOGERR(NULL, LY_ESYS, "%s: writing data failed (unable to write %u from %u data).", __func__, - len - (size_t)written, len); + } else if (written != len) { + LOGERR(NULL, LY_ESYS, "%s: writing data failed (unable to write %" PRIu32 " from %" PRIu32 " data).", __func__, + (uint32_t)(len - written), (uint32_t)len); ret = LY_ESYS; } else { if (out->type == LY_OUT_FDSTREAM) { |