1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-14 08:48:01 +00:00

vapplog: new helper function for reporting errors.

This commit is contained in:
Rusty Russell 2011-07-06 16:44:36 +09:30
parent 5969d65a04
commit e2d912eb4a
2 changed files with 10 additions and 6 deletions

View File

@ -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
View File

@ -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, ...)
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)