Browse Source

Simplify code to a single vprintf path for curses-less printing

nfactor-troky
Luke Dashjr 13 years ago
parent
commit
d98e561a0a
  1. 9
      cgminer.c
  2. 8
      logging.c
  3. 2
      miner.h

9
cgminer.c

@ -164,9 +164,7 @@ static int total_threads; @@ -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, ...) @@ -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) @@ -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)

8
logging.c

@ -25,8 +25,8 @@ static void my_log_curses(__maybe_unused int prio, char *f, va_list ap) @@ -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) @@ -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

@ -797,7 +797,7 @@ extern void switch_pools(struct pool *selected); @@ -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…
Cancel
Save