aboutsummaryrefslogtreecommitdiff
path: root/cpu-miner.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2010-11-26 15:20:54 -0500
committerJeff Garzik <jgarzik@redhat.com>2010-11-26 15:20:54 -0500
commit59f1fb2ec87b4a8e3d6608b405b6aa649b89db95 (patch)
tree68b60777ae09f5d1abb9de804f6f91d7346b714a /cpu-miner.c
parent5d1a45294b4dcc1ca7e1e2c1243ee4904f0f53fe (diff)
Link with pthreads lib, if present. Remove GNU-specific asprintf usage.
Diffstat (limited to 'cpu-miner.c')
-rw-r--r--cpu-miner.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/cpu-miner.c b/cpu-miner.c
index 2b404af..da6e007 100644
--- a/cpu-miner.c
+++ b/cpu-miner.c
@@ -8,7 +8,6 @@
* any later version. See COPYING for more details.
*/
-#define _GNU_SOURCE
#include "cpuminer-config.h"
#include <stdio.h>
@@ -136,8 +135,9 @@ err_out:
static void submit_work(struct work *work)
{
- char *hexstr = NULL, *s = NULL;
+ char *hexstr = NULL;
json_t *val, *res;
+ char s[256];
printf("PROOF OF WORK FOUND? submitting...\n");
@@ -147,12 +147,9 @@ static void submit_work(struct work *work)
goto out;
/* build JSON-RPC request */
- if (asprintf(&s,
- "{\"method\": \"getwork\", \"params\": [ \"%s\" ], \"id\":1}\r\n",
- hexstr) < 0) {
- fprintf(stderr, "asprintf failed\n");
- goto out;
- }
+ sprintf(s,
+ "{\"method\": \"getwork\", \"params\": [ \"%s\" ], \"id\":1}\r\n",
+ hexstr);
if (opt_debug)
fprintf(stderr, "DBG: sending RPC call:\n%s", s);
@@ -172,7 +169,6 @@ static void submit_work(struct work *work)
json_decref(val);
out:
- free(s);
free(hexstr);
}