Browse Source

rename poorly named variable

djm34
Jan Berdajs 11 years ago
parent
commit
485ec9ac88
  1. 12
      api.c
  2. 2
      driver-opencl.c
  3. 12
      logging.c
  4. 4
      logging.h
  5. 20
      sgminer.c

12
api.c

@ -2750,13 +2750,13 @@ static void debugstate(struct io_data *io_data, __maybe_unused SOCKETTYPE c, cha
opt_quiet ^= true; opt_quiet ^= true;
break; break;
case 'v': case 'v':
opt_log_output ^= true; opt_verbose ^= true;
if (opt_log_output) if (opt_verbose)
opt_quiet = false; opt_quiet = false;
break; break;
case 'd': case 'd':
opt_debug ^= true; opt_debug ^= true;
opt_log_output = opt_debug; opt_verbose = opt_debug;
if (opt_debug) if (opt_debug)
opt_quiet = false; opt_quiet = false;
break; break;
@ -2767,10 +2767,10 @@ static void debugstate(struct io_data *io_data, __maybe_unused SOCKETTYPE c, cha
break; break;
case 'p': case 'p':
want_per_device_stats ^= true; want_per_device_stats ^= true;
opt_log_output = want_per_device_stats; opt_verbose = want_per_device_stats;
break; break;
case 'n': case 'n':
opt_log_output = false; opt_verbose = false;
opt_debug = false; opt_debug = false;
opt_quiet = false; opt_quiet = false;
opt_protocol = false; opt_protocol = false;
@ -2798,7 +2798,7 @@ static void debugstate(struct io_data *io_data, __maybe_unused SOCKETTYPE c, cha
root = api_add_bool(root, "Silent", &opt_realquiet, false); root = api_add_bool(root, "Silent", &opt_realquiet, false);
root = api_add_bool(root, "Quiet", &opt_quiet, false); root = api_add_bool(root, "Quiet", &opt_quiet, false);
root = api_add_bool(root, "Verbose", &opt_log_output, false); root = api_add_bool(root, "Verbose", &opt_verbose, false);
root = api_add_bool(root, "Debug", &opt_debug, false); root = api_add_bool(root, "Debug", &opt_debug, false);
root = api_add_bool(root, "RPCProto", &opt_protocol, false); root = api_add_bool(root, "RPCProto", &opt_protocol, false);
root = api_add_bool(root, "PerDevice", &want_per_device_stats, false); root = api_add_bool(root, "PerDevice", &want_per_device_stats, false);

2
driver-opencl.c

@ -667,7 +667,7 @@ char *set_rawintensity(const char *_arg)
void print_ndevs(int *ndevs) void print_ndevs(int *ndevs)
{ {
opt_log_output = true; opt_verbose = true;
opencl_drv.drv_detect(); opencl_drv.drv_detect();
clear_adl(*ndevs); clear_adl(*ndevs);
applog(LOG_INFO, "%i GPU devices max detected", *ndevs); applog(LOG_INFO, "%i GPU devices max detected", *ndevs);

12
logging.c

@ -16,7 +16,7 @@
#include "miner.h" #include "miner.h"
bool opt_debug = false; bool opt_debug = false;
bool opt_log_output = false; bool opt_verbose = false;
int last_date_output_day = 0; int last_date_output_day = 0;
int opt_log_show_date = false; int opt_log_show_date = false;
@ -47,7 +47,7 @@ static void my_log_curses(int prio, const char *datetime, const char *str, bool
} }
} }
void applog(int prio, const char* fmt, ...) void applog(int prio, const char* fmt, ...)
{ {
va_list args; va_list args;
@ -56,7 +56,7 @@ void applog(int prio, const char* fmt, ...)
va_end(args); va_end(args);
} }
void applogsiz(int prio, int size, const char* fmt, ...) void applogsiz(int prio, int size, const char* fmt, ...)
{ {
va_list args; va_list args;
@ -66,10 +66,10 @@ void applogsiz(int prio, int size, const char* fmt, ...)
} }
/* high-level logging function, based on global opt_log_level */ /* high-level logging function, based on global opt_log_level */
void vapplogsiz(int prio, int size, const char* fmt, va_list args) void vapplogsiz(int prio, int size, const char* fmt, va_list args)
{ {
if (opt_debug || prio != LOG_DEBUG) { if (opt_debug || prio != LOG_DEBUG) {
if (use_syslog || opt_log_output || prio <= opt_log_level) { if (use_syslog || opt_verbose || prio <= opt_log_level) {
char *tmp42 = (char *)calloc(size + 1, 1); char *tmp42 = (char *)calloc(size + 1, 1);
vsnprintf(tmp42, size, fmt, args); vsnprintf(tmp42, size, fmt, args);
_applog(prio, tmp42, false); _applog(prio, tmp42, false);
@ -132,7 +132,7 @@ void _applog(int prio, const char *str, bool force)
fprintf(stderr, "%s%s\n", datetime, str); /* atomic write to stderr */ fprintf(stderr, "%s%s\n", datetime, str); /* atomic write to stderr */
fflush(stderr); fflush(stderr);
} }
my_log_curses(prio, datetime, str, force); my_log_curses(prio, datetime, str, force);
} }
} }

4
logging.h

@ -19,7 +19,7 @@ enum {
/* debug flags */ /* debug flags */
extern bool opt_debug; extern bool opt_debug;
extern bool opt_log_output; extern bool opt_verbose;
extern bool opt_realquiet; extern bool opt_realquiet;
extern bool want_per_device_stats; extern bool want_per_device_stats;
@ -40,7 +40,7 @@ extern void _applog(int prio, const char *str, bool force);
#define forcelog(prio, fmt, ...) do { \ #define forcelog(prio, fmt, ...) do { \
if (opt_debug || prio != LOG_DEBUG) { \ if (opt_debug || prio != LOG_DEBUG) { \
if (use_syslog || opt_log_output || prio <= opt_log_level) { \ if (use_syslog || opt_verbose || prio <= opt_log_level) { \
char tmp42[LOGBUFSIZ]; \ char tmp42[LOGBUFSIZ]; \
snprintf(tmp42, sizeof(tmp42), fmt, ##__VA_ARGS__); \ snprintf(tmp42, sizeof(tmp42), fmt, ##__VA_ARGS__); \
_applog(prio, tmp42, true); \ _applog(prio, tmp42, true); \

20
sgminer.c

@ -1101,7 +1101,7 @@ static char *enable_debug(bool *flag)
{ {
*flag = true; *flag = true;
/* Turn on verbose output, too. */ /* Turn on verbose output, too. */
opt_log_output = true; opt_verbose = true;
return NULL; return NULL;
} }
@ -1688,7 +1688,7 @@ struct opt_table opt_config_table[] = {
/* All current kernels only support vectors=1 */ /* All current kernels only support vectors=1 */
/* "Override detected optimal vector (1, 2 or 4) - one value or comma separated list"), */ /* "Override detected optimal vector (1, 2 or 4) - one value or comma separated list"), */
OPT_WITHOUT_ARG("--verbose|-v", OPT_WITHOUT_ARG("--verbose|-v",
opt_set_bool, &opt_log_output, opt_set_bool, &opt_verbose,
"Log verbose output to stderr as well as status output"), "Log verbose output to stderr as well as status output"),
OPT_WITH_ARG("--worksize|-w", OPT_WITH_ARG("--worksize|-w",
set_default_worksize, NULL, NULL, set_default_worksize, NULL, NULL,
@ -4634,7 +4634,7 @@ retry:
opt_debug ? "on" : "off", opt_debug ? "on" : "off",
want_per_device_stats? "on" : "off", want_per_device_stats? "on" : "off",
opt_quiet ? "on" : "off", opt_quiet ? "on" : "off",
opt_log_output ? "on" : "off", opt_verbose ? "on" : "off",
opt_protocol ? "on" : "off", opt_protocol ? "on" : "off",
opt_worktime ? "on" : "off", opt_worktime ? "on" : "off",
opt_incognito ? "on" : "off", opt_incognito ? "on" : "off",
@ -4648,13 +4648,13 @@ retry:
wlogprint("Quiet mode %s\n", opt_quiet ? "enabled" : "disabled"); wlogprint("Quiet mode %s\n", opt_quiet ? "enabled" : "disabled");
goto retry; goto retry;
} else if (!strncasecmp(&input, "v", 1)) { } else if (!strncasecmp(&input, "v", 1)) {
opt_log_output ^= true; opt_verbose ^= true;
if (opt_log_output) if (opt_verbose)
opt_quiet = false; opt_quiet = false;
wlogprint("Verbose mode %s\n", opt_log_output ? "enabled" : "disabled"); wlogprint("Verbose mode %s\n", opt_verbose ? "enabled" : "disabled");
goto retry; goto retry;
} else if (!strncasecmp(&input, "n", 1)) { } else if (!strncasecmp(&input, "n", 1)) {
opt_log_output = false; opt_verbose = false;
opt_debug = false; opt_debug = false;
opt_quiet = false; opt_quiet = false;
opt_protocol = false; opt_protocol = false;
@ -4665,7 +4665,7 @@ retry:
goto retry; goto retry;
} else if (!strncasecmp(&input, "d", 1)) { } else if (!strncasecmp(&input, "d", 1)) {
opt_debug ^= true; opt_debug ^= true;
opt_log_output = opt_debug; opt_verbose = opt_debug;
if (opt_debug) if (opt_debug)
opt_quiet = false; opt_quiet = false;
wlogprint("Debug mode %s\n", opt_debug ? "enabled" : "disabled"); wlogprint("Debug mode %s\n", opt_debug ? "enabled" : "disabled");
@ -4681,7 +4681,7 @@ retry:
goto retry; goto retry;
} else if (!strncasecmp(&input, "p", 1)) { } else if (!strncasecmp(&input, "p", 1)) {
want_per_device_stats ^= true; want_per_device_stats ^= true;
opt_log_output = want_per_device_stats; opt_verbose = want_per_device_stats;
wlogprint("Per-device stats %s\n", want_per_device_stats ? "enabled" : "disabled"); wlogprint("Per-device stats %s\n", want_per_device_stats ? "enabled" : "disabled");
goto retry; goto retry;
} else if (!strncasecmp(&input, "r", 1)) { } else if (!strncasecmp(&input, "r", 1)) {
@ -8284,7 +8284,7 @@ int main(int argc, char *argv[])
} }
if (want_per_device_stats) if (want_per_device_stats)
opt_log_output = true; opt_verbose = true;
total_control_threads = 8; total_control_threads = 8;
control_thr = (struct thr_info *)calloc(total_control_threads, sizeof(*thr)); control_thr = (struct thr_info *)calloc(total_control_threads, sizeof(*thr));

Loading…
Cancel
Save