Skip to content

Commit

Permalink
Fix up yolog stuff..
Browse files Browse the repository at this point in the history
  • Loading branch information
mnunberg committed Aug 9, 2012
1 parent f06e202 commit 1d4ce58
Show file tree
Hide file tree
Showing 3 changed files with 193 additions and 170 deletions.
6 changes: 6 additions & 0 deletions plugin-libuv.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "lcb_luv_internal.h"

static int _yolog_initialized = 0;

static void __attribute__((unused))
lcb_luv_noop(struct libcouchbase_io_opt_st *iops)
{
Expand Down Expand Up @@ -75,6 +77,10 @@ lcb_luv_create_io_opts(uv_loop_t *loop, uint16_t sock_max)
struct libcouchbase_io_opt_st *ret = calloc(1, sizeof(*ret));
struct lcb_luv_cookie_st *cookie = calloc(1, sizeof(*cookie));

if (!_yolog_initialized) {
lcb_luv_yolog_init(NULL);
}

assert(loop);
cookie->loop = loop;
assert(loop);
Expand Down
21 changes: 19 additions & 2 deletions util/lcb_luv_yolog.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,30 @@ lcb_luv_yolog_vlogger(lcb_luv_yolog_context *ctx,

lcb_luv_yolog_dest_lock(out);

#ifndef va_copy
#define LCB_LUV_YOLOG_VACOPY_OVERRIDE
#ifdef __GNUC__
#define va_copy __va_copy
#else
#define va_copy(dst, src) (dst) = (src)
#endif /* __GNUC__ */
#endif

lcb_luv_yolog_fmt_write(fmtv, fp, &msginfo);
vfprintf(fp, fmt, ap);
{
va_list vacp;
va_copy(vacp, ap);
vfprintf(fp, fmt, vacp);
va_end(vacp);
}
fprintf(fp, "%s\n", msginfo.co_reset);
fflush(fp);

lcb_luv_yolog_dest_unlock(out);
}
#ifdef LCB_LUV_YOLOG_VACOPY_OVERRIDE
#undef va_copy
#undef LCB_LUV_YOLOG_VACOPY_OVERRIDE
#endif
}

void
Expand Down
Loading

0 comments on commit 1d4ce58

Please sign in to comment.