drop the debug asserts
This commit is contained in:
parent
1e0dc5da30
commit
5e875c0b25
|
@ -33,7 +33,6 @@ developers.
|
|||
*/
|
||||
|
||||
#include "bstack.h"
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@ -51,7 +50,6 @@ struct bstack_t
|
|||
void
|
||||
bstack_new(bstack_t **out, size_t count, size_t size, recycle_fun recycle)
|
||||
{
|
||||
assert(*out==NULL);
|
||||
bstack_t *q = (bstack_t*) calloc(1, sizeof(bstack_t));
|
||||
q->c = count;
|
||||
q->cc = 0;
|
||||
|
@ -66,7 +64,6 @@ bstack_new(bstack_t **out, size_t count, size_t size, recycle_fun recycle)
|
|||
void
|
||||
bstack_free(bstack_t *q)
|
||||
{
|
||||
assert(q);
|
||||
if (q->rf)
|
||||
{
|
||||
char *ps = q->b;
|
||||
|
@ -84,7 +81,6 @@ bstack_free(bstack_t *q)
|
|||
void *
|
||||
bstack_push(bstack_t *q, void *item)
|
||||
{
|
||||
assert(q);
|
||||
size_t idx = q->n++ % q->c;
|
||||
void *pb = q->b + (idx * q->z);
|
||||
if (q->rf && q->cc == q->c)
|
||||
|
@ -102,7 +98,6 @@ bstack_push(bstack_t *q, void *item)
|
|||
void
|
||||
bstack_drop(bstack_t *q)
|
||||
{
|
||||
assert(q);
|
||||
if (!q->cc)
|
||||
return;
|
||||
q->n--;
|
||||
|
@ -116,7 +111,6 @@ bstack_drop(bstack_t *q)
|
|||
void *
|
||||
bstack_top(bstack_t *q)
|
||||
{
|
||||
assert(q);
|
||||
if (!q->cc)
|
||||
return NULL;
|
||||
size_t idx = (q->n - (q->cc + 1)) % q->c;
|
||||
|
@ -128,14 +122,12 @@ bstack_top(bstack_t *q)
|
|||
|
||||
size_t bstack_count(bstack_t *q)
|
||||
{
|
||||
assert(q);
|
||||
return q->cc;
|
||||
}
|
||||
|
||||
void *
|
||||
bstack_next(bstack_t *q)
|
||||
{
|
||||
assert(q);
|
||||
if (!q->ni)
|
||||
return NULL;
|
||||
q->ni--;
|
||||
|
@ -147,7 +139,6 @@ bstack_next(bstack_t *q)
|
|||
void
|
||||
bstack_reset(bstack_t *q)
|
||||
{
|
||||
assert(q);
|
||||
q->ni = q->cc;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ developers.
|
|||
*/
|
||||
|
||||
#include "growbag.h"
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
@ -54,7 +53,6 @@ void
|
|||
gbag_new(gbag_t **out, size_t count, size_t size,
|
||||
gbag_recycle recycle, gbag_moved moved)
|
||||
{
|
||||
assert(*out==NULL && count && size);
|
||||
gbag_t *gb = (gbag_t*) calloc(1, sizeof(gbag_t));
|
||||
gb->z = size;
|
||||
gb->max = count;
|
||||
|
@ -70,7 +68,6 @@ gbag_new(gbag_t **out, size_t count, size_t size,
|
|||
void
|
||||
gbag_free(gbag_t *gb)
|
||||
{
|
||||
assert(gb && gb->max && gb->b);
|
||||
char *end = gb->b + (gb->max * gb->z);
|
||||
char *cur = gb->b;
|
||||
if (gb->rc)
|
||||
|
@ -94,7 +91,6 @@ gbag_free(gbag_t *gb)
|
|||
void *
|
||||
gbag_get(gbag_t *gb)
|
||||
{
|
||||
assert(gb && gb->max && gb->b);
|
||||
char *end = gb->b + (gb->max * gb->z);
|
||||
char *from = gb->n;
|
||||
size_t nc, oc, ocz;
|
||||
|
@ -146,7 +142,6 @@ grow:
|
|||
void
|
||||
gbag_put(gbag_t *gb, void *item)
|
||||
{
|
||||
assert(gb && item && gb->ref>0);
|
||||
if (gb->rc)
|
||||
gb->rc(item);
|
||||
memset(item, 0, gb->z);
|
||||
|
@ -169,14 +164,12 @@ gbag_used(gbag_t *gb)
|
|||
void *
|
||||
gbag_find(gbag_t *gb, const void *key, gbag_cmp cmp)
|
||||
{
|
||||
assert(gb && gb->b && gb->max);
|
||||
return gbag_find_after(gb, key, cmp, NULL);
|
||||
}
|
||||
|
||||
void *
|
||||
gbag_find_after(gbag_t *gb, const void *key, gbag_cmp cmp, void *from)
|
||||
{
|
||||
assert(gb && gb->b && gb->max);
|
||||
char *s = gb->b;
|
||||
char *e = gb->b + (gb->max * gb->z);
|
||||
if (from)
|
||||
|
@ -188,7 +181,6 @@ gbag_find_after(gbag_t *gb, const void *key, gbag_cmp cmp, void *from)
|
|||
void *
|
||||
gbag_first(gbag_t *gb)
|
||||
{
|
||||
assert(gb && gb->b && gb->max);
|
||||
char *s = gb->b;
|
||||
char *e = gb->b + (gb->max * gb->z);
|
||||
gb->ni = s;
|
||||
|
@ -205,7 +197,6 @@ gbag_first(gbag_t *gb)
|
|||
void *
|
||||
gbag_next(gbag_t *gb, void* from)
|
||||
{
|
||||
assert(gb && gb->b && gb->max);
|
||||
if (from)
|
||||
gb->ni = ((char*)from) + gb->z;
|
||||
char *e = gb->b + (gb->max * gb->z);
|
||||
|
|
|
@ -45,7 +45,6 @@ developers.
|
|||
|
||||
#include <lmdb.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -1492,8 +1491,6 @@ response_to_block_template(json_object *result,
|
|||
{
|
||||
JSON_GET_OR_WARN(seed_hash, result, json_type_string);
|
||||
JSON_GET_OR_WARN(next_seed_hash, result, json_type_string);
|
||||
assert(seed_hash != NULL);
|
||||
assert(next_seed_hash != NULL);
|
||||
strncpy(block_template->seed_hash,
|
||||
json_object_get_string(seed_hash), 64);
|
||||
strncpy(block_template->next_seed_hash,
|
||||
|
@ -1704,7 +1701,6 @@ rpc_on_block_headers_range(const char* data, rpc_callback_t *callback)
|
|||
|
||||
JSON_GET_OR_WARN(headers, result, json_type_array);
|
||||
size_t headers_len = json_object_array_length(headers);
|
||||
assert(headers_len == BLOCK_HEADERS_RANGE);
|
||||
for (size_t i=0; i<headers_len; i++)
|
||||
{
|
||||
json_object *header = json_object_array_get_idx(headers, i);
|
||||
|
@ -3024,8 +3020,6 @@ miner_on_block_template(json_object *message, client_t *client)
|
|||
{
|
||||
JSON_GET_OR_WARN(seed_hash, params, json_type_string);
|
||||
JSON_GET_OR_WARN(next_seed_hash, params, json_type_string);
|
||||
assert(seed_hash != NULL);
|
||||
assert(next_seed_hash != NULL);
|
||||
strncpy(job->miner_template->seed_hash,
|
||||
json_object_get_string(seed_hash), 64);
|
||||
strncpy(job->miner_template->next_seed_hash,
|
||||
|
|
|
@ -32,7 +32,6 @@ Parts of the project are originally copyright (c) 2012-2013 The Cryptonote
|
|||
developers.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -60,8 +59,6 @@ void
|
|||
hex_to_bin(const char *hex, const size_t hex_len,
|
||||
unsigned char *bin, const size_t bin_size)
|
||||
{
|
||||
assert(hex_len % 2 == 0);
|
||||
assert(bin_size >= hex_len >> 1);
|
||||
const char *ph = hex;
|
||||
unsigned char *end = bin + bin_size;
|
||||
while (*ph && bin < end)
|
||||
|
@ -75,7 +72,6 @@ void
|
|||
bin_to_hex(const unsigned char *bin, const size_t bin_size,
|
||||
char *hex, const size_t hex_size)
|
||||
{
|
||||
assert(bin_size << 1 == hex_size);
|
||||
const char *hex_chars = "0123456789abcdef";
|
||||
char *ph = hex;
|
||||
const unsigned char *pb = bin;
|
||||
|
|
|
@ -32,7 +32,6 @@ Parts of the project are originally copyright (c) 2012-2013 The Cryptonote
|
|||
developers.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
|
Loading…
Reference in New Issue