Browse Source

vapplog: new helper function for reporting errors.

nfactor-troky
Rusty Russell 14 years ago
parent
commit
e2d912eb4a
  1. 1
      miner.h
  2. 15
      util.c

1
miner.h

@ -253,6 +253,7 @@ struct work { @@ -253,6 +253,7 @@ struct work {
bool submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce);
extern void vapplog(int prio, const char *fmt, va_list ap);
extern void applog(int prio, const char *fmt, ...);
extern struct thread_q *tq_new(void);
extern void tq_free(struct thread_q *tq);

15
util.c

@ -57,12 +57,8 @@ struct thread_q { @@ -57,12 +57,8 @@ struct thread_q {
pthread_cond_t cond;
};
void applog(int prio, const char *fmt, ...)
void vapplog(int prio, const char *fmt, va_list ap)
{
va_list ap;
va_start(ap, fmt);
#ifdef HAVE_SYSLOG_H
if (use_syslog) {
vsyslog(prio, fmt, ap);
@ -96,8 +92,15 @@ void applog(int prio, const char *fmt, ...) @@ -96,8 +92,15 @@ void applog(int prio, const char *fmt, ...)
vfprintf(stderr, f, ap); /* atomic write to stderr */
fflush(stderr);
}
}
void applog(int prio, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vapplog(prio, fmt, ap);
va_end(ap);
fflush(stderr);
}
static void databuf_free(struct data_buffer *db)

Loading…
Cancel
Save