mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-05 11:34:16 +00:00
Simplify code to a single vprintf path for curses-less printing
This commit is contained in:
parent
80593c47fc
commit
d98e561a0a
@ -164,9 +164,7 @@ static int total_threads;
|
||||
static pthread_mutex_t hash_lock;
|
||||
static pthread_mutex_t qd_lock;
|
||||
static pthread_mutex_t *stgd_lock;
|
||||
#ifdef HAVE_CURSES
|
||||
static pthread_mutex_t curses_lock;
|
||||
#endif
|
||||
static pthread_mutex_t ch_lock;
|
||||
static pthread_rwlock_t blk_lock;
|
||||
|
||||
@ -1562,7 +1560,7 @@ void wlogprint(const char *f, ...)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CURSES
|
||||
void log_curses(int prio, const char *f, va_list ap)
|
||||
bool log_curses_only(int prio, const char *f, va_list ap)
|
||||
{
|
||||
bool high_prio;
|
||||
|
||||
@ -1577,8 +1575,9 @@ void log_curses(int prio, const char *f, va_list ap)
|
||||
}
|
||||
}
|
||||
unlock_curses();
|
||||
} else
|
||||
vprintf(f, ap);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void clear_logwin(void)
|
||||
|
@ -25,8 +25,8 @@ static void my_log_curses(__maybe_unused int prio, char *f, va_list ap)
|
||||
|
||||
#ifdef HAVE_CURSES
|
||||
extern bool use_curses;
|
||||
if (use_curses)
|
||||
log_curses(prio, f, ap);
|
||||
if (use_curses && log_curses_only(prio, f, ap))
|
||||
;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
@ -34,11 +34,7 @@ static void my_log_curses(__maybe_unused int prio, char *f, va_list ap)
|
||||
|
||||
strcpy(f + len - 1, " \n");
|
||||
|
||||
#ifdef HAVE_CURSES
|
||||
log_curses(prio, f, ap);
|
||||
#else
|
||||
vprintf(f, ap);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
2
miner.h
2
miner.h
@ -797,7 +797,7 @@ extern void switch_pools(struct pool *selected);
|
||||
extern void remove_pool(struct pool *pool);
|
||||
extern void write_config(FILE *fcfg);
|
||||
extern void default_save_file(char *filename);
|
||||
extern void log_curses(int prio, const char *f, va_list ap);
|
||||
extern bool log_curses_only(int prio, const char *f, va_list ap);
|
||||
extern void clear_logwin(void);
|
||||
extern bool pool_tclear(struct pool *pool, bool *var);
|
||||
extern struct thread_q *tq_new(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user