mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-12 07:48:22 +00:00
Move add pool to somewhere clean and obvious.
This commit is contained in:
parent
05dfc16035
commit
fd10b993b0
17
main.c
17
main.c
@ -206,6 +206,17 @@ static void applog_and_exit(const char *fmt, ...)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void add_pool(void)
|
||||||
|
{
|
||||||
|
total_pools++;
|
||||||
|
pools = realloc(pools, sizeof(struct pool) * total_pools);
|
||||||
|
if (!pools) {
|
||||||
|
applog(LOG_ERR, "Failed to malloc pools in add_pool");
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
memset(&pools[total_pools - 1], 0, sizeof(struct pool));
|
||||||
|
}
|
||||||
|
|
||||||
/* FIXME: Use asprintf for better errors. */
|
/* FIXME: Use asprintf for better errors. */
|
||||||
static char *set_algo(const char *arg, enum sha256_algos *algo)
|
static char *set_algo(const char *arg, enum sha256_algos *algo)
|
||||||
{
|
{
|
||||||
@ -277,12 +288,8 @@ static char *set_url(const char *arg, char **p)
|
|||||||
{
|
{
|
||||||
struct pool *pool;
|
struct pool *pool;
|
||||||
|
|
||||||
total_pools++;
|
add_pool();
|
||||||
pools = realloc(pools, sizeof(struct pool) * total_pools);
|
|
||||||
if (!pools)
|
|
||||||
return "Failed to malloc pools in set_url";
|
|
||||||
pool = &pools[total_pools - 1];
|
pool = &pools[total_pools - 1];
|
||||||
memset(pool, 0, sizeof(struct pool));
|
|
||||||
|
|
||||||
opt_set_charp(arg, &pool->rpc_url);
|
opt_set_charp(arg, &pool->rpc_url);
|
||||||
if (strncmp(arg, "http://", 7) &&
|
if (strncmp(arg, "http://", 7) &&
|
||||||
|
Loading…
Reference in New Issue
Block a user