From cecb75255fbaaf856d51bcdb73652050efb06fdc Mon Sep 17 00:00:00 2001 From: "roman.khlopkov" <roman.khlopkov@demlabs.net> Date: Wed, 3 Jul 2024 16:28:54 +0300 Subject: [PATCH] [*] Constants rename --- modules/chain/dap_chain.c | 14 ++-- modules/chain/dap_chain_ch.c | 24 +++---- modules/chain/dap_chain_ch_pkt.c | 6 +- modules/chain/dap_chain_cs.c | 4 +- modules/chain/dap_chain_tx.c | 2 +- .../dap_stream_ch_chain_net_srv.c | 34 +++++----- modules/common/dap_chain_datum_decree.c | 2 +- modules/common/dap_chain_datum_token.c | 18 ++--- modules/common/dap_chain_datum_tx.c | 2 +- .../block-poa/dap_chain_cs_block_poa.c | 6 +- .../block-pos/dap_chain_cs_block_pos.c | 8 +-- .../consensus/dag-poa/dap_chain_cs_dag_poa.c | 10 +-- .../consensus/dag-pos/dap_chain_cs_dag_pos.c | 8 +-- .../consensus/esbocs/dap_chain_cs_esbocs.c | 16 ++--- modules/mempool/dap_chain_mempool.c | 4 +- modules/net/dap_chain_ledger.c | 68 +++++++++---------- modules/net/dap_chain_net.c | 18 ++--- modules/net/dap_chain_net_balancer.c | 4 +- modules/net/dap_chain_net_node_list.c | 2 +- modules/net/dap_chain_net_tx.c | 14 ++-- modules/net/dap_chain_node.c | 2 +- modules/net/dap_chain_node_cli_cmd.c | 40 +++++------ modules/net/dap_chain_node_cli_cmd_tx.c | 16 ++--- modules/net/dap_chain_node_client.c | 2 +- modules/net/dap_chain_node_dns_client.c | 2 +- modules/net/dap_chain_node_ping.c | 12 ++-- modules/net/srv/dap_chain_net_srv.c | 6 +- modules/net/srv/dap_chain_net_srv_client.c | 2 +- modules/net/srv/dap_chain_net_srv_geoip.c | 2 +- modules/net/srv/dap_chain_net_srv_order.c | 8 +-- .../srv/dap_chain_net_srv_stream_session.c | 4 +- .../service/datum/dap_chain_net_srv_datum.c | 2 +- .../dap_chain_net_srv_stake_pos_delegate.c | 24 +++---- .../service/voting/dap_chain_net_srv_voting.c | 2 +- modules/service/vpn/dap_chain_net_srv_vpn.c | 24 +++---- .../service/vpn/dap_chain_net_vpn_client.c | 2 +- .../vpn/dap_chain_net_vpn_client_tun.c | 2 +- .../xchange/dap_chain_net_srv_xchange.c | 12 ++-- modules/type/blocks/dap_chain_block.c | 2 +- modules/type/blocks/dap_chain_block_cache.c | 8 +-- modules/type/blocks/dap_chain_block_chunk.c | 8 +-- modules/type/blocks/dap_chain_cs_blocks.c | 16 ++--- modules/type/dag/dap_chain_cs_dag.c | 22 +++--- modules/type/none/dap_chain_cs_none.c | 12 ++-- modules/wallet/dap_chain_wallet.c | 8 +-- 45 files changed, 252 insertions(+), 252 deletions(-) diff --git a/modules/chain/dap_chain.c b/modules/chain/dap_chain.c index b1afa3c44a..5fc8fa1146 100644 --- a/modules/chain/dap_chain.c +++ b/modules/chain/dap_chain.c @@ -103,7 +103,7 @@ dap_chain_t *dap_chain_create(const char *a_chain_net_name, const char *a_chain_ { dap_chain_t *l_ret = DAP_NEW_Z(dap_chain_t); if ( !l_ret ) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } *l_ret = (dap_chain_t) { @@ -121,7 +121,7 @@ dap_chain_t *dap_chain_create(const char *a_chain_net_name, const char *a_chain_ DAP_DEL_Z(l_ret->name); DAP_DEL_Z(l_ret->net_name); DAP_DELETE(l_ret); - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } l_ret->_pvt = l_chain_pvt; @@ -131,7 +131,7 @@ dap_chain_t *dap_chain_create(const char *a_chain_net_name, const char *a_chain_ DAP_DEL_Z(l_ret->net_name); DAP_DELETE(l_ret->_pvt); DAP_DELETE(l_ret); - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } *l_ret_item = (dap_chain_item_t) { @@ -445,7 +445,7 @@ dap_chain_t *dap_chain_load_from_cfg(const char *a_chain_net_name, dap_chain_net l_chain->datum_types = DAP_NEW_SIZE(dap_chain_type_t, l_datum_types_count * sizeof(dap_chain_type_t)); // TODO: pls check counter for recognized types before memory allocation! if ( !l_chain->datum_types ) { DAP_DELETE(l_chain); - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } l_count_recognized = 0; @@ -470,7 +470,7 @@ dap_chain_t *dap_chain_load_from_cfg(const char *a_chain_net_name, dap_chain_net if (l_chain->datum_types) DAP_DELETE(l_chain->datum_types); DAP_DELETE(l_chain); - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } l_count_recognized = 0; @@ -496,7 +496,7 @@ dap_chain_t *dap_chain_load_from_cfg(const char *a_chain_net_name, dap_chain_net { l_chain->autoproc_datum_types = DAP_NEW_Z_SIZE(uint16_t, l_chain->datum_types_count * sizeof(uint16_t)); // TODO: pls check counter for recognized types before memory allocation! if ( !l_chain->autoproc_datum_types ) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); if (l_chain->datum_types) DAP_DELETE(l_chain->datum_types); if (l_chain->default_datum_types) @@ -835,7 +835,7 @@ void dap_chain_atom_notify(dap_chain_cell_t *a_chain_cell, dap_hash_fast_t *a_ha dap_chain_atom_notifier_t *l_notifier = (dap_chain_atom_notifier_t*)l_iter->data; struct chain_thread_notifier *l_arg = DAP_NEW_Z(struct chain_thread_notifier); if (!l_arg) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); continue; } *l_arg = (struct chain_thread_notifier) { diff --git a/modules/chain/dap_chain_ch.c b/modules/chain/dap_chain_ch.c index 5824132b4b..f91bbce7f5 100644 --- a/modules/chain/dap_chain_ch.c +++ b/modules/chain/dap_chain_ch.c @@ -225,7 +225,7 @@ void s_stream_ch_new(dap_stream_ch_t *a_ch, void *a_arg) { UNUSED(a_arg); if (!(a_ch->internal = DAP_NEW_Z(dap_chain_ch_t))) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; }; dap_chain_ch_t *l_ch_chain = DAP_CHAIN_CH(a_ch); @@ -280,7 +280,7 @@ struct legacy_sync_context *s_legacy_sync_context_create(dap_chain_ch_pkt_t *a_c }; dap_stream_ch_uuid_t *l_uuid = DAP_DUP(&a_ch->uuid); if (!l_uuid) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DELETE(l_context); return NULL; } @@ -373,7 +373,7 @@ static bool s_sync_out_gdb_proc_callback(void *a_arg) l_data_size = dap_list_length(l_list_out) * sizeof(dap_chain_ch_update_element_t); l_data = DAP_NEW_Z_SIZE(dap_chain_ch_update_element_t, l_data_size); if (!l_data) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); l_context->state = DAP_CHAIN_CH_STATE_ERROR; goto context_delete; } @@ -411,7 +411,7 @@ static bool s_sync_out_gdb_proc_callback(void *a_arg) } l_pkt_pack = dap_global_db_pkt_pack_old(l_pkt_pack, l_pkt); if (!l_pkt_pack || l_cur_size == l_pkt_pack->data_size) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); l_context->state = DAP_CHAIN_CH_STATE_ERROR; goto context_delete; } @@ -502,7 +502,7 @@ static bool s_sync_out_chains_proc_callback(void *a_arg) if (l_cur_state == DAP_CHAIN_CH_STATE_UPDATE_CHAINS) { l_hashes = DAP_NEW_Z_SIZE(dap_chain_ch_update_element_t, s_update_pack_size * sizeof(dap_chain_ch_update_element_t)); if (!l_hashes) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); l_context->state = DAP_CHAIN_CH_STATE_ERROR; goto context_delete; } @@ -675,7 +675,7 @@ static void s_gossip_payload_callback(void *a_payload, size_t a_payload_size, da } struct atom_processing_args *l_args = DAP_NEW_SIZE(struct atom_processing_args, a_payload_size + sizeof(struct atom_processing_args)); if (!l_args) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } l_args->addr = a_sender_addr; @@ -768,7 +768,7 @@ static bool s_stream_ch_packet_in(dap_stream_ch_t* a_ch, void* a_arg) } struct atom_processing_args *l_args = DAP_NEW_SIZE(struct atom_processing_args, l_ch_pkt->hdr.data_size + sizeof(struct atom_processing_args)); if (!l_args) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); break; } l_args->addr = a_ch->stream->node; @@ -856,7 +856,7 @@ static bool s_stream_ch_packet_in(dap_stream_ch_t* a_ch, void* a_arg) atomic_store(&l_context->allowed_num, l_sum.num_cur + s_sync_ack_window_size); dap_stream_ch_uuid_t *l_uuid = DAP_DUP(&a_ch->uuid); if (!l_uuid) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DELETE(l_context); break; } @@ -1128,7 +1128,7 @@ static bool s_stream_ch_packet_in(dap_stream_ch_t* a_ch, void* a_arg) if (!l_hash_item) { l_hash_item = DAP_NEW_Z(dap_chain_ch_hash_item_t); if (!l_hash_item) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_stream_ch_write_error_unsafe(a_ch, l_chain_pkt->hdr.net_id, l_chain_pkt->hdr.chain_id, l_chain_pkt->hdr.cell_id, DAP_CHAIN_CH_ERROR_OUT_OF_MEMORY); @@ -1232,7 +1232,7 @@ static bool s_stream_ch_packet_in(dap_stream_ch_t* a_ch, void* a_arg) DAP_NEW_Z_RET_VAL(l_args, struct record_processing_args, true, NULL); l_args->pkt = DAP_DUP_SIZE(l_pkt, l_chain_pkt_data_size); if (!l_args->pkt) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DEL_Z(l_args); dap_stream_ch_write_error_unsafe(a_ch, l_chain_pkt->hdr.net_id, l_chain_pkt->hdr.chain_id, l_chain_pkt->hdr.cell_id, @@ -1384,7 +1384,7 @@ static bool s_stream_ch_packet_in(dap_stream_ch_t* a_ch, void* a_arg) if (!l_hash_item) { l_hash_item = DAP_NEW_Z(dap_chain_ch_hash_item_t); if (!l_hash_item) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_stream_ch_write_error_unsafe(a_ch, l_chain_pkt->hdr.net_id, l_chain_pkt->hdr.chain_id, l_chain_pkt->hdr.cell_id, DAP_CHAIN_CH_ERROR_OUT_OF_MEMORY); @@ -1487,7 +1487,7 @@ static bool s_stream_ch_packet_in(dap_stream_ch_t* a_ch, void* a_arg) debug_if(s_debug_legacy, L_INFO, "In: CHAIN_OLD data_size=%zu", l_chain_pkt_data_size); struct atom_processing_args *l_args = DAP_NEW_Z_SIZE(struct atom_processing_args, l_ch_pkt->hdr.data_size + sizeof(struct atom_processing_args)); if (!l_args) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_stream_ch_write_error_unsafe(a_ch, l_chain_pkt->hdr.net_id, l_chain_pkt->hdr.chain_id, l_chain_pkt->hdr.cell_id, DAP_CHAIN_CH_ERROR_OUT_OF_MEMORY); diff --git a/modules/chain/dap_chain_ch_pkt.c b/modules/chain/dap_chain_ch_pkt.c index e774210cf2..f09013d7b5 100644 --- a/modules/chain/dap_chain_ch_pkt.c +++ b/modules/chain/dap_chain_ch_pkt.c @@ -57,7 +57,7 @@ size_t dap_chain_ch_pkt_write_unsafe(dap_stream_ch_t *a_ch, uint8_t a_type, : DAP_NEW_STACK_SIZE(dap_chain_ch_pkt_t, l_chain_pkt_size); if (!l_chain_pkt) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return 0; } s_chain_pkt_fill(l_chain_pkt, a_net_id, a_chain_id, a_cell_id, a_data, a_data_size, a_version); @@ -76,7 +76,7 @@ dap_chain_ch_pkt_t *dap_chain_ch_pkt_new(dap_chain_net_id_t a_net_id, dap_chain_ if (l_chain_pkt) s_chain_pkt_fill(l_chain_pkt, a_net_id, a_chain_id, a_cell_id, a_data, a_data_size, a_version); else - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return l_chain_pkt; } /** @@ -101,7 +101,7 @@ size_t dap_chain_ch_pkt_write_mt(dap_stream_worker_t *a_worker, dap_stream_ch_uu : DAP_NEW_STACK_SIZE(dap_chain_ch_pkt_t, l_chain_pkt_size); if (!l_chain_pkt) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return 0; } s_chain_pkt_fill(l_chain_pkt, a_net_id, a_chain_id, a_cell_id, a_data, a_data_size, a_version); diff --git a/modules/chain/dap_chain_cs.c b/modules/chain/dap_chain_cs.c index 6162fcd345..211dfe40cd 100644 --- a/modules/chain/dap_chain_cs.c +++ b/modules/chain/dap_chain_cs.c @@ -65,7 +65,7 @@ void dap_chain_cs_type_add (const char * a_cs_str, dap_chain_callback_new_cfg_t { dap_chain_callback_new_cfg_item_t *l_item = DAP_NEW_Z ( dap_chain_callback_new_cfg_item_t ); if ( !l_item ) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } strncpy(l_item->name, a_cs_str, sizeof (l_item->name) - 1); @@ -100,7 +100,7 @@ void dap_chain_cs_add (const char * a_cs_str, dap_chain_callback_new_cfg_t a_ca { dap_chain_callback_new_cfg_item_t *l_item = DAP_NEW_Z ( dap_chain_callback_new_cfg_item_t ); if ( !l_item ) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } strncpy(l_item->name, a_cs_str, sizeof (l_item->name) - 1); diff --git a/modules/chain/dap_chain_tx.c b/modules/chain/dap_chain_tx.c index f2c4511dc5..773ae6a1b1 100644 --- a/modules/chain/dap_chain_tx.c +++ b/modules/chain/dap_chain_tx.c @@ -36,7 +36,7 @@ dap_chain_tx_t * dap_chain_tx_wrap_packed(dap_chain_datum_tx_t * a_tx_packed) { dap_chain_tx_t * l_tx = DAP_NEW_Z(dap_chain_tx_t); if (!l_tx) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } dap_hash_fast(a_tx_packed, dap_chain_datum_tx_get_size(a_tx_packed), &l_tx->hash); diff --git a/modules/channel/chain-net-srv/dap_stream_ch_chain_net_srv.c b/modules/channel/chain-net-srv/dap_stream_ch_chain_net_srv.c index d25a159ee5..aad8bcf09d 100644 --- a/modules/channel/chain-net-srv/dap_stream_ch_chain_net_srv.c +++ b/modules/channel/chain-net-srv/dap_stream_ch_chain_net_srv.c @@ -129,7 +129,7 @@ static inline void s_grace_error(dap_chain_net_srv_grace_t *a_grace, dap_stream_ else { l_item = DAP_NEW_Z(dap_chain_net_srv_banlist_item_t); if (!l_item) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); pthread_mutex_unlock(&a_grace->usage->service->banlist_mutex); DAP_DEL_Z(a_grace->request); DAP_DEL_Z(a_grace); @@ -382,7 +382,7 @@ static bool s_service_start(dap_stream_ch_t *a_ch , dap_stream_ch_chain_net_srv_ // Create one client l_usage->client = DAP_NEW_Z( dap_chain_net_srv_client_remote_t); if (!l_usage->client) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); l_err.code = DAP_STREAM_CH_CHAIN_NET_SRV_PKT_TYPE_RESPONSE_ERROR_CODE_ALLOC_MEMORY_ERROR; if(a_ch) dap_stream_ch_pkt_write_unsafe(a_ch, DAP_STREAM_CH_CHAIN_NET_SRV_PKT_TYPE_RESPONSE_ERROR, &l_err, sizeof (l_err)); @@ -441,7 +441,7 @@ static bool s_service_start(dap_stream_ch_t *a_ch , dap_stream_ch_chain_net_srv_ dap_chain_net_srv_grace_t *l_grace = DAP_NEW_Z(dap_chain_net_srv_grace_t); if (!l_grace) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); l_err.code = DAP_STREAM_CH_CHAIN_NET_SRV_PKT_TYPE_RESPONSE_ERROR_CODE_ALLOC_MEMORY_ERROR; if(a_ch) dap_stream_ch_pkt_write_unsafe(a_ch, DAP_STREAM_CH_CHAIN_NET_SRV_PKT_TYPE_RESPONSE_ERROR, &l_err, sizeof (l_err)); @@ -453,7 +453,7 @@ static bool s_service_start(dap_stream_ch_t *a_ch , dap_stream_ch_chain_net_srv_ } l_grace->request = DAP_DUP_SIZE(a_request, a_request_size); if (!l_grace->request) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); l_err.code = DAP_STREAM_CH_CHAIN_NET_SRV_PKT_TYPE_RESPONSE_ERROR_CODE_ALLOC_MEMORY_ERROR; if(a_ch) dap_stream_ch_pkt_write_unsafe(a_ch, DAP_STREAM_CH_CHAIN_NET_SRV_PKT_TYPE_RESPONSE_ERROR, &l_err, sizeof (l_err)); @@ -478,7 +478,7 @@ static bool s_service_start(dap_stream_ch_t *a_ch , dap_stream_ch_chain_net_srv_ dap_stream_ch_chain_net_srv_pkt_success_t *l_success = DAP_NEW_Z_SIZE(dap_stream_ch_chain_net_srv_pkt_success_t, l_success_size); if(!l_success) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); l_err.code = DAP_STREAM_CH_CHAIN_NET_SRV_PKT_TYPE_RESPONSE_ERROR_CODE_ALLOC_MEMORY_ERROR; if(a_ch) dap_stream_ch_pkt_write_unsafe(a_ch, DAP_STREAM_CH_CHAIN_NET_SRV_PKT_TYPE_RESPONSE_ERROR, &l_err, sizeof (l_err)); @@ -564,7 +564,7 @@ static bool s_grace_period_start(dap_chain_net_srv_grace_t *a_grace) } dap_chain_net_srv_grace_usage_t *l_item = DAP_NEW_Z(dap_chain_net_srv_grace_usage_t); if (!l_item) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); s_grace_error(a_grace, l_err); return false; } @@ -580,7 +580,7 @@ static bool s_grace_period_start(dap_chain_net_srv_grace_t *a_grace) } else { // Else if first grace at service start dap_chain_net_srv_grace_usage_t *l_item = DAP_NEW_Z(dap_chain_net_srv_grace_usage_t); if (!l_item) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); s_grace_error(a_grace, l_err); return false; } @@ -592,7 +592,7 @@ static bool s_grace_period_start(dap_chain_net_srv_grace_t *a_grace) dap_stream_ch_chain_net_srv_pkt_success_t *l_success = DAP_NEW_Z_SIZE(dap_stream_ch_chain_net_srv_pkt_success_t, l_success_size); if(!l_success) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DEL_Z(l_item); l_err.code = DAP_STREAM_CH_CHAIN_NET_SRV_PKT_TYPE_RESPONSE_ERROR_CODE_ALLOC_MEMORY_ERROR; if(l_ch) @@ -1111,13 +1111,13 @@ static bool s_grace_period_finish(dap_chain_net_srv_grace_usage_t *a_grace_item) dap_chain_net_srv_grace_t* l_grace_new = DAP_NEW_Z(dap_chain_net_srv_grace_t); if (!l_grace_new) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); RET_WITH_DEL_A_GRACE(0); } // Parse the request l_grace_new->request = DAP_NEW_Z_SIZE(dap_stream_ch_chain_net_srv_pkt_request_t, sizeof(dap_stream_ch_chain_net_srv_pkt_request_t)); if (!l_grace_new->request) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DEL_Z(l_grace_new); RET_WITH_DEL_A_GRACE(0); } @@ -1347,7 +1347,7 @@ static bool s_stream_ch_packet_in(dap_stream_ch_t *a_ch, void *a_arg) DAP_DELETE(l_usage->receipt); l_usage->receipt = DAP_DUP_SIZE(l_receipt, l_receipt_size); if (!l_usage->receipt) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); break; } l_is_first_sign = true; @@ -1356,7 +1356,7 @@ static bool s_stream_ch_packet_in(dap_stream_ch_t *a_ch, void *a_arg) DAP_DELETE(l_usage->receipt_next); l_usage->receipt_next = DAP_DUP_SIZE(l_receipt, l_receipt_size); if (!l_usage->receipt_next) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); break; } l_usage->is_active = true; @@ -1388,7 +1388,7 @@ static bool s_stream_ch_packet_in(dap_stream_ch_t *a_ch, void *a_arg) log_it(L_ERROR, "Can't find tx cond. Start grace!"); l_grace = DAP_NEW_Z(dap_chain_net_srv_grace_t); if (!l_grace) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DELETE(l_tx_in_hash_str); break; } @@ -1396,7 +1396,7 @@ static bool s_stream_ch_packet_in(dap_stream_ch_t *a_ch, void *a_arg) // Parse the request l_grace->request = DAP_NEW_Z_SIZE(dap_stream_ch_chain_net_srv_pkt_request_t, sizeof(dap_stream_ch_chain_net_srv_pkt_request_t)); if (!l_grace->request) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DEL_Z(l_grace) DAP_DELETE(l_tx_in_hash_str); break; @@ -1418,14 +1418,14 @@ static bool s_stream_ch_packet_in(dap_stream_ch_t *a_ch, void *a_arg) l_usage->is_waiting_new_tx_cond = true; l_grace = DAP_NEW_Z(dap_chain_net_srv_grace_t); if (!l_grace) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DELETE(l_tx_in_hash_str); return true; } // Parse the request l_grace->request = DAP_NEW_Z_SIZE(dap_stream_ch_chain_net_srv_pkt_request_t, sizeof(dap_stream_ch_chain_net_srv_pkt_request_t)); if (!l_grace->request) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DEL_Z(l_grace) DAP_DELETE(l_tx_in_hash_str); return true; @@ -1621,7 +1621,7 @@ static bool s_stream_ch_packet_in(dap_stream_ch_t *a_ch, void *a_arg) dap_stream_ch_chain_net_srv_pkt_success_t *l_success = DAP_NEW_Z_SIZE(dap_stream_ch_chain_net_srv_pkt_success_t, l_success_size); if(!l_success) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); break; } l_success->hdr.usage_id = l_usage->id; diff --git a/modules/common/dap_chain_datum_decree.c b/modules/common/dap_chain_datum_decree.c index 8b681cfe8d..83710341f7 100644 --- a/modules/common/dap_chain_datum_decree.c +++ b/modules/common/dap_chain_datum_decree.c @@ -602,7 +602,7 @@ dap_chain_datum_decree_t *dap_chain_datum_decree_sign_in_cycle(dap_cert_t **a_ce size_t l_sign_size = dap_sign_get_size(l_sign); a_datum_decree = DAP_REALLOC(a_datum_decree, sizeof(dap_chain_datum_decree_t) + l_cur_sign_offset + l_sign_size); if (!a_datum_decree) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DELETE(l_sign); return NULL; } diff --git a/modules/common/dap_chain_datum_token.c b/modules/common/dap_chain_datum_token.c index 114575ca1b..33e053fda5 100644 --- a/modules/common/dap_chain_datum_token.c +++ b/modules/common/dap_chain_datum_token.c @@ -82,7 +82,7 @@ dap_chain_datum_token_t *dap_chain_datum_token_read(const byte_t *a_token_serial case DAP_CHAIN_DATUM_TOKEN_TYPE_OLD_SIMPLE: { dap_chain_datum_token_t *l_token = DAP_NEW_Z_SIZE(dap_chain_datum_token_t, l_token_size); if (!l_token) { - log_it(L_CRITICAL, g_error_memory_alloc); + log_it(L_CRITICAL, c_error_memory_alloc); return NULL; } *l_token = (dap_chain_datum_token_t) { @@ -102,7 +102,7 @@ dap_chain_datum_token_t *dap_chain_datum_token_read(const byte_t *a_token_serial case DAP_CHAIN_DATUM_TOKEN_TYPE_OLD_PRIVATE_DECL: { dap_chain_datum_token_t *l_token = DAP_NEW_Z_SIZE(dap_chain_datum_token_t, l_token_size); if (!l_token) { - log_it(L_CRITICAL, g_error_memory_alloc); + log_it(L_CRITICAL, c_error_memory_alloc); return NULL; } *l_token = (dap_chain_datum_token_t) { @@ -124,7 +124,7 @@ dap_chain_datum_token_t *dap_chain_datum_token_read(const byte_t *a_token_serial case DAP_CHAIN_DATUM_TOKEN_TYPE_OLD_PRIVATE_UPDATE: { dap_chain_datum_token_t *l_token = DAP_NEW_Z_SIZE(dap_chain_datum_token_t, l_token_size); if (!l_token) { - log_it(L_CRITICAL, g_error_memory_alloc); + log_it(L_CRITICAL, c_error_memory_alloc); return NULL; } *l_token = (dap_chain_datum_token_t) { @@ -146,7 +146,7 @@ dap_chain_datum_token_t *dap_chain_datum_token_read(const byte_t *a_token_serial case DAP_CHAIN_DATUM_TOKEN_TYPE_OLD_NATIVE_DECL: { dap_chain_datum_token_t *l_token = DAP_NEW_Z_SIZE(dap_chain_datum_token_t, l_token_size); if (!l_token) { - log_it(L_CRITICAL, g_error_memory_alloc); + log_it(L_CRITICAL, c_error_memory_alloc); return NULL; } *l_token = (dap_chain_datum_token_t) { @@ -168,7 +168,7 @@ dap_chain_datum_token_t *dap_chain_datum_token_read(const byte_t *a_token_serial case DAP_CHAIN_DATUM_TOKEN_TYPE_OLD_NATIVE_UPDATE: { dap_chain_datum_token_t *l_token = DAP_NEW_Z_SIZE(dap_chain_datum_token_t, l_token_size); if (!l_token) { - log_it(L_CRITICAL, g_error_memory_alloc); + log_it(L_CRITICAL, c_error_memory_alloc); return NULL; } *l_token = (dap_chain_datum_token_t) { @@ -190,7 +190,7 @@ dap_chain_datum_token_t *dap_chain_datum_token_read(const byte_t *a_token_serial case DAP_CHAIN_DATUM_TOKEN_TYPE_OLD_PUBLIC: { dap_chain_datum_token_t *l_token = DAP_NEW_Z_SIZE(dap_chain_datum_token_t, l_token_size); if (!l_token) { - log_it(L_CRITICAL, g_error_memory_alloc); + log_it(L_CRITICAL, c_error_memory_alloc); return NULL; } *l_token = (dap_chain_datum_token_t) { @@ -455,7 +455,7 @@ dap_chain_datum_token_emission_t *dap_chain_datum_emission_create(uint256_t a_va { dap_chain_datum_token_emission_t *l_emission = DAP_NEW_Z(dap_chain_datum_token_emission_t); if (!l_emission) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } l_emission->hdr.version = 3; @@ -499,7 +499,7 @@ dap_chain_datum_token_emission_t *dap_chain_datum_emission_read(byte_t *a_emissi size_t l_add_size = sizeof(l_emission->hdr) - l_old_hdr_size; l_emission = DAP_NEW_Z_SIZE(dap_chain_datum_token_emission_t, l_emission_size + l_add_size); if (!l_emission) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } l_emission->hdr.version = 2; @@ -514,7 +514,7 @@ dap_chain_datum_token_emission_t *dap_chain_datum_emission_read(byte_t *a_emissi } else { l_emission = DAP_DUP_SIZE(a_emission_serial, *a_emission_size); if (!l_emission) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } if (((dap_chain_datum_token_emission_t *)a_emission_serial)->hdr.version == 1) diff --git a/modules/common/dap_chain_datum_tx.c b/modules/common/dap_chain_datum_tx.c index e8069c9cb6..38d7ac9670 100644 --- a/modules/common/dap_chain_datum_tx.c +++ b/modules/common/dap_chain_datum_tx.c @@ -41,7 +41,7 @@ dap_chain_datum_tx_t* dap_chain_datum_tx_create(void) { dap_chain_datum_tx_t *tx = DAP_NEW_Z(dap_chain_datum_tx_t); if (!tx) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return 0; } tx->header.ts_created = time(NULL); diff --git a/modules/consensus/block-poa/dap_chain_cs_block_poa.c b/modules/consensus/block-poa/dap_chain_cs_block_poa.c index d36958cfc2..665b97a195 100644 --- a/modules/consensus/block-poa/dap_chain_cs_block_poa.c +++ b/modules/consensus/block-poa/dap_chain_cs_block_poa.c @@ -185,7 +185,7 @@ static int s_callback_new(dap_chain_t * a_chain, dap_config_t * a_chain_cfg) dap_chain_cs_blocks_t * l_blocks = DAP_CHAIN_CS_BLOCKS( a_chain ); dap_chain_cs_block_poa_t * l_poa = DAP_NEW_Z ( dap_chain_cs_block_poa_t); if (!l_poa) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } l_blocks->_inheritor = l_poa; @@ -194,7 +194,7 @@ static int s_callback_new(dap_chain_t * a_chain, dap_config_t * a_chain_cfg) l_blocks->callback_block_sign = s_callback_block_sign; l_poa->_pvt = DAP_NEW_Z(dap_chain_cs_block_poa_pvt_t); if (!l_poa->_pvt) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } dap_chain_cs_block_poa_pvt_t *l_poa_pvt = PVT(l_poa); @@ -207,7 +207,7 @@ static int s_callback_new(dap_chain_t * a_chain, dap_config_t * a_chain_cfg) // Type sizeof's misunderstanding in malloc? l_poa_pvt->auth_certs = DAP_NEW_Z_SIZE ( dap_cert_t *, l_poa_pvt->auth_certs_count * sizeof(dap_cert_t*)); if (!l_poa_pvt->auth_certs) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } char l_cert_name[512]; diff --git a/modules/consensus/block-pos/dap_chain_cs_block_pos.c b/modules/consensus/block-pos/dap_chain_cs_block_pos.c index 060d3b0d41..5fb06747c7 100644 --- a/modules/consensus/block-pos/dap_chain_cs_block_pos.c +++ b/modules/consensus/block-pos/dap_chain_cs_block_pos.c @@ -87,7 +87,7 @@ static int s_callback_new(dap_chain_t *a_chain, dap_config_t *a_chain_cfg) dap_chain_cs_blocks_t *l_blocks = DAP_CHAIN_CS_BLOCKS(a_chain); dap_chain_cs_block_pos_t *l_pos = DAP_NEW_Z(dap_chain_cs_block_pos_t); if (!l_pos) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } l_blocks->_inheritor = l_pos; @@ -98,7 +98,7 @@ static int s_callback_new(dap_chain_t *a_chain, dap_config_t *a_chain_cfg) l_pos->_pvt = DAP_NEW_Z(dap_chain_cs_block_pos_pvt_t); dap_chain_cs_block_pos_pvt_t *l_pos_pvt = PVT(l_pos); if (!l_pos_pvt) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); goto lb_err; } @@ -113,12 +113,12 @@ static int s_callback_new(dap_chain_t *a_chain, dap_config_t *a_chain_cfg) l_pos_pvt->tokens_hold_size = l_tokens_hold_size; l_pos_pvt->tokens_hold = DAP_NEW_Z_SIZE(char *, sizeof(char *) * l_tokens_hold_size); if (!l_pos_pvt->tokens_hold) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); goto lb_err; } l_pos_pvt->tokens_hold_value = DAP_NEW_Z_SIZE(uint64_t, l_tokens_hold_value_size * sizeof(uint64_t)); if (!l_pos_pvt->tokens_hold_value) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); goto lb_err; } for (size_t i = 0; i < l_tokens_hold_value_size; i++) { diff --git a/modules/consensus/dag-poa/dap_chain_cs_dag_poa.c b/modules/consensus/dag-poa/dap_chain_cs_dag_poa.c index 305173a049..11f1cb0ac4 100644 --- a/modules/consensus/dag-poa/dap_chain_cs_dag_poa.c +++ b/modules/consensus/dag-poa/dap_chain_cs_dag_poa.c @@ -157,7 +157,7 @@ void dap_chain_cs_dag_poa_presign_callback_set(dap_chain_t *a_chain, dap_chain_c l_poa_pvt->callback_pre_sign = (dap_chain_cs_dag_poa_presign_callback_t*)DAP_NEW_Z(dap_chain_cs_dag_poa_presign_callback_t); if (!l_poa_pvt->callback_pre_sign) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } l_poa_pvt->callback_pre_sign->callback = a_callback; @@ -347,7 +347,7 @@ static int s_callback_new(dap_chain_t * a_chain, dap_config_t * a_chain_cfg) dap_chain_cs_dag_t *l_dag = DAP_CHAIN_CS_DAG(a_chain); dap_chain_cs_dag_poa_t *l_poa = DAP_NEW_Z(dap_chain_cs_dag_poa_t); if (!l_poa) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } l_dag->_inheritor = l_poa; @@ -357,7 +357,7 @@ static int s_callback_new(dap_chain_t * a_chain, dap_config_t * a_chain_cfg) l_dag->chain->callback_get_poa_certs = dap_chain_cs_dag_poa_get_auth_certs; l_poa->_pvt = DAP_NEW_Z ( dap_chain_cs_dag_poa_pvt_t ); if (!l_poa->_pvt) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } dap_chain_cs_dag_poa_pvt_t *l_poa_pvt = PVT(l_poa); @@ -375,7 +375,7 @@ static int s_callback_new(dap_chain_t * a_chain, dap_config_t * a_chain_cfg) if (l_poa_pvt->auth_certs_count && l_poa_pvt->auth_certs_count_verify) { l_poa_pvt->auth_certs = DAP_NEW_Z_SIZE ( dap_cert_t *, l_poa_pvt->auth_certs_count * sizeof(dap_cert_t *)); if (!l_poa_pvt->auth_certs) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } char l_cert_name[512]; @@ -675,7 +675,7 @@ static void s_round_event_cs_done(dap_chain_cs_dag_t * a_dag, uint64_t a_round_i l_callback_arg = DAP_NEW_Z(struct round_timer_arg); if (!l_callback_arg) { pthread_rwlock_unlock(&l_poa_pvt->rounds_rwlock); - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } l_callback_arg->dag = a_dag; diff --git a/modules/consensus/dag-pos/dap_chain_cs_dag_pos.c b/modules/consensus/dag-pos/dap_chain_cs_dag_pos.c index 03922212fc..33911b5a96 100644 --- a/modules/consensus/dag-pos/dap_chain_cs_dag_pos.c +++ b/modules/consensus/dag-pos/dap_chain_cs_dag_pos.c @@ -83,7 +83,7 @@ static int s_callback_new(dap_chain_t * a_chain, dap_config_t * a_chain_cfg) dap_chain_cs_dag_t *l_dag = DAP_CHAIN_CS_DAG ( a_chain ); dap_chain_cs_dag_pos_t *l_pos = DAP_NEW_Z( dap_chain_cs_dag_pos_t); if (!l_pos) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } @@ -99,7 +99,7 @@ static int s_callback_new(dap_chain_t * a_chain, dap_config_t * a_chain_cfg) l_pos->_pvt = DAP_NEW_Z(dap_chain_cs_dag_pos_pvt_t); dap_chain_cs_dag_pos_pvt_t *l_pos_pvt = PVT(l_pos); if (!l_pos_pvt) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); goto lb_err; } @@ -115,13 +115,13 @@ static int s_callback_new(dap_chain_t * a_chain, dap_config_t * a_chain_cfg) l_pos_pvt->tokens_hold = DAP_NEW_Z_SIZE( char*, sizeof(char*) * l_tokens_hold_size ); if (!l_pos_pvt->tokens_hold) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); goto lb_err; } l_pos_pvt->tokens_hold_value = DAP_NEW_Z_SIZE(uint64_t, (l_tokens_hold_value_size +1) *sizeof (uint64_t)); if (!l_pos_pvt->tokens_hold_value) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); goto lb_err; } for (size_t i = 0; i < l_tokens_hold_value_size; i++){ diff --git a/modules/consensus/esbocs/dap_chain_cs_esbocs.c b/modules/consensus/esbocs/dap_chain_cs_esbocs.c index e6ffa337db..037b369271 100644 --- a/modules/consensus/esbocs/dap_chain_cs_esbocs.c +++ b/modules/consensus/esbocs/dap_chain_cs_esbocs.c @@ -222,7 +222,7 @@ static int s_callback_new(dap_chain_t *a_chain, dap_config_t *a_chain_cfg) l_esbocs->_pvt = DAP_NEW_Z(dap_chain_esbocs_pvt_t); dap_chain_esbocs_pvt_t *l_esbocs_pvt = PVT(l_esbocs); if (!l_esbocs_pvt) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); l_ret = - 5; goto lb_err; } @@ -281,7 +281,7 @@ static int s_callback_new(dap_chain_t *a_chain, dap_config_t *a_chain_cfg) } dap_chain_esbocs_validator_t *l_validator = DAP_NEW_Z(dap_chain_esbocs_validator_t); if (!l_validator) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); l_ret = - 5; goto lb_err; } @@ -740,7 +740,7 @@ int dap_chain_esbocs_set_emergency_validator(dap_chain_t *a_chain, bool a_add, u return -2; dap_chain_addr_t *l_addr_new = DAP_DUP(&l_signing_addr); if (!l_addr_new) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -4; } l_esbocs_pvt->emergency_validator_addrs = dap_list_append( @@ -1776,7 +1776,7 @@ void s_session_sync_queue_add(dap_chain_esbocs_session_t *a_session, dap_chain_e void *l_message_copy = DAP_DUP_SIZE(a_message, a_message_size); if (!l_message_copy) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } dap_chain_esbocs_sync_item_t *l_sync_item; @@ -2130,7 +2130,7 @@ static bool s_stream_ch_packet_in(dap_stream_ch_t *a_ch, void *a_arg) NODE_ADDR_FP_ARGS_S(a_ch->stream->node), NODE_ADDR_FP_ARGS_S(l_session->my_addr)); struct esbocs_msg_args *l_args = DAP_NEW_SIZE(struct esbocs_msg_args, sizeof(struct esbocs_msg_args) + l_message_size); if (!l_args) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return false; } l_args->addr_from = a_ch->stream->node; @@ -2407,7 +2407,7 @@ static void s_session_packet_in(dap_chain_esbocs_session_t *a_session, dap_chain // store for new candidate l_store = DAP_NEW_Z(dap_chain_esbocs_store_t); if (!l_store) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); goto session_unlock; } l_store->candidate_size = l_candidate_size; @@ -2671,7 +2671,7 @@ static void s_message_send(dap_chain_esbocs_session_t *a_session, uint8_t a_mess l_message->hdr.sign_size = l_sign_size; l_message = DAP_REALLOC(l_message, l_message_size + l_sign_size); if (!l_message) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } memcpy(l_message->msg_n_sign + a_data_size, l_sign, l_sign_size); @@ -2685,7 +2685,7 @@ static void s_message_send(dap_chain_esbocs_session_t *a_session, uint8_t a_mess struct esbocs_msg_args *l_args = DAP_NEW_SIZE(struct esbocs_msg_args, sizeof(struct esbocs_msg_args) + l_message_size + l_sign_size); if (!l_args) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DELETE(l_message); return; } diff --git a/modules/mempool/dap_chain_mempool.c b/modules/mempool/dap_chain_mempool.c index 91d06c0e68..d1d6aaa9fc 100644 --- a/modules/mempool/dap_chain_mempool.c +++ b/modules/mempool/dap_chain_mempool.c @@ -714,7 +714,7 @@ int dap_chain_mempool_tx_create_massive( dap_chain_t * a_chain, dap_enc_key_t *a if ( memcmp(&l_out->addr, a_addr_from, sizeof (*a_addr_from))==0 ){ dap_chain_tx_used_out_item_t *l_item_back = DAP_NEW_Z(dap_chain_tx_used_out_item_t); if (!l_item_back) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_list_free_full(l_list_used_out, NULL); DAP_DELETE(l_objs); return -6; @@ -1258,7 +1258,7 @@ dap_datum_mempool_t * dap_datum_mempool_deserialize(uint8_t *a_datum_mempool_ser //datum_mempool_size = hex2bin(a_datum_mempool_ser, datum_mempool_str_in, datum_mempool_size) / 2; dap_datum_mempool_t *datum_mempool = DAP_NEW_Z(dap_datum_mempool_t); if (!datum_mempool) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } datum_mempool->version = *(uint16_t*)(a_datum_mempool_ser + shift_size); diff --git a/modules/net/dap_chain_ledger.c b/modules/net/dap_chain_ledger.c index f650084103..feb006a659 100644 --- a/modules/net/dap_chain_ledger.c +++ b/modules/net/dap_chain_ledger.c @@ -556,13 +556,13 @@ static dap_ledger_t * dap_ledger_handle_new(void) { dap_ledger_t *l_ledger = DAP_NEW_Z(dap_ledger_t); if ( !l_ledger ) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } dap_ledger_private_t * l_ledger_pvt; l_ledger->_internal = l_ledger_pvt = DAP_NEW_Z(dap_ledger_private_t); if ( !l_ledger_pvt ) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DELETE(l_ledger); return NULL; } @@ -615,7 +615,7 @@ struct json_object *wallet_info_json_collect(dap_ledger_t *a_ledger, dap_ledger_ size_t l_addr_len = pos - a_bal->key; char *l_addr_str = DAP_NEW_STACK_SIZE(char, l_addr_len + 1); if ( !l_addr_str ) - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); memcpy(l_addr_str, a_bal->key, pos - a_bal->key); *(l_addr_str + l_addr_len) = '\0'; json_object_object_add(l_network, "address", json_object_new_string(l_addr_str)); @@ -817,7 +817,7 @@ static bool s_ledger_token_update_check(dap_ledger_token_item_t *a_cur_token_ite //Check added signs dap_chain_datum_token_t *l_token_tmp = DAP_DUP_SIZE(a_token_update, a_token_update_size); if (!l_token_tmp) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_list_free(l_tsd_list_added_pkeys); dap_list_free(l_tsd_list_remote_pkeys); return false; @@ -1129,7 +1129,7 @@ json_object *dap_ledger_token_tx_item_list(dap_ledger_t * a_ledger, dap_chain_ad { json_object * json_arr_out = json_object_new_array(); if (!json_arr_out) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } @@ -1168,7 +1168,7 @@ void s_ledger_token_cache_update(dap_ledger_t *a_ledger, dap_ledger_token_item_t size_t l_cache_size = l_token_item->datum_token_size + sizeof(uint256_t); uint8_t *l_cache = DAP_NEW_STACK_SIZE(uint8_t, l_cache_size); if ( !l_cache ) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } memcpy(l_cache, &l_token_item->current_supply, sizeof(uint256_t)); @@ -1336,7 +1336,7 @@ int dap_ledger_token_add(dap_ledger_t *a_ledger, dap_chain_datum_token_t *a_toke l_token_item = DAP_NEW_Z(dap_ledger_token_item_t); if ( !l_token_item ) { DAP_DELETE(l_token); - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -8; } *l_token_item = (dap_ledger_token_item_t) { @@ -1356,14 +1356,14 @@ int dap_ledger_token_add(dap_ledger_t *a_ledger, dap_chain_datum_token_t *a_toke if ( !l_token_item->auth_pkeys ) { DAP_DELETE(l_token); DAP_DELETE(l_token_item); - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -6; }; if ( !l_token_item->auth_pkeys ) { DAP_DELETE(l_token); DAP_DEL_Z(l_token_item->auth_pkeys); DAP_DELETE(l_token_item); - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -6; } dap_stpcpy(l_token_item->ticker, l_token->ticker); @@ -2487,12 +2487,12 @@ static bool s_load_cache_gdb_loaded_balances_callback(dap_global_db_instance_t * for (size_t i = 0; i < a_values_count; i++) { dap_ledger_wallet_balance_t *l_balance_item = DAP_NEW_Z(dap_ledger_wallet_balance_t); if (!l_balance_item) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return false; } l_balance_item->key = DAP_NEW_Z_SIZE(char, strlen(a_values[i].key) + 1); if (!l_balance_item->key) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DEL_Z(l_balance_item); return false; } @@ -2538,14 +2538,14 @@ static bool s_load_cache_gdb_loaded_txs_callback(dap_global_db_instance_t *a_dbi for (size_t i = 0; i < a_values_count; i++) { dap_ledger_tx_item_t *l_tx_item = DAP_NEW_Z(dap_ledger_tx_item_t); if ( !l_tx_item ) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return false; } dap_chain_hash_fast_from_str(a_values[i].key, &l_tx_item->tx_hash_fast); l_tx_item->tx = DAP_NEW_Z_SIZE(dap_chain_datum_tx_t, a_values[i].value_len - sizeof(l_tx_item->cache_data)); if ( !l_tx_item->tx ) { DAP_DELETE(l_tx_item); - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return false; } memcpy(&l_tx_item->cache_data, a_values[i].value, sizeof(l_tx_item->cache_data)); @@ -2618,7 +2618,7 @@ static bool s_load_cache_gdb_loaded_emissions_callback(dap_global_db_instance_t } dap_ledger_token_emission_item_t *l_emission_item = DAP_NEW_Z(dap_ledger_token_emission_item_t); if ( !l_emission_item ) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return false; } dap_chain_hash_fast_from_str(a_values[i].key, &l_emission_item->datum_token_emission_hash); @@ -2724,7 +2724,7 @@ dap_ledger_t *dap_ledger_create(dap_chain_net_t *a_net, uint16_t a_flags) { dap_ledger_t *l_ledger = dap_ledger_handle_new(); if (!l_ledger) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } l_ledger->net = a_net; @@ -2757,7 +2757,7 @@ dap_ledger_t *dap_ledger_create(dap_chain_net_t *a_net, uint16_t a_flags) for (uint16_t i = 0; i < l_whitelist_size; ++i) { dap_ledger_hal_item_t *l_hal_item = DAP_NEW_Z(dap_ledger_hal_item_t); if (!l_hal_item) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DEL_Z(l_ledger_pvt); DAP_DEL_Z(l_ledger); dap_config_close(l_cfg); @@ -3005,13 +3005,13 @@ int dap_ledger_token_emission_add(dap_ledger_t *a_ledger, byte_t *a_token_emissi if (HASH_COUNT(l_ledger_pvt->threshold_emissions) < s_threshold_emissions_max) { l_token_emission_item = DAP_NEW_Z(dap_ledger_token_emission_item_t); if ( !l_token_emission_item ) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return DAP_LEDGER_EMISSION_ADD_MEMORY_PROBLEM; } l_token_emission_item->datum_token_emission = DAP_DUP_SIZE(a_token_emission, a_token_emission_size); if ( !l_token_emission_item->datum_token_emission ) { DAP_DELETE(l_token_emission_item); - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return DAP_LEDGER_EMISSION_ADD_MEMORY_PROBLEM; } l_token_emission_item->datum_token_emission_size = a_token_emission_size; @@ -3046,7 +3046,7 @@ int dap_ledger_token_emission_add(dap_ledger_t *a_ledger, byte_t *a_token_emissi if (!l_token_emission_item) { l_token_emission_item = DAP_NEW_Z(dap_ledger_token_emission_item_t); if ( !l_token_emission_item ) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return DAP_LEDGER_EMISSION_ADD_MEMORY_PROBLEM; } l_token_emission_item->datum_token_emission_size = a_token_emission_size; @@ -3305,7 +3305,7 @@ void dap_ledger_addr_get_token_ticker_all_depricated(dap_ledger_t *a_ledger, dap if(l_tx_item) { l_tickers = DAP_NEW_Z_SIZE(char *, l_tickers_size * sizeof(char*)); if ( !l_tickers ) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } while(l_tx_item) { @@ -3323,7 +3323,7 @@ void dap_ledger_addr_get_token_ticker_all_depricated(dap_ledger_t *a_ledger, dap l_tickers_size += (l_tickers_size / 2); l_tickers = DAP_REALLOC(l_tickers, l_tickers_size); if ( !l_tickers ) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } } @@ -3337,7 +3337,7 @@ void dap_ledger_addr_get_token_ticker_all_depricated(dap_ledger_t *a_ledger, dap l_tickers_size = l_tickers_pos + 1; l_tickers = DAP_REALLOC(l_tickers, l_tickers_size * sizeof(char*)); if ( !l_tickers ) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } } @@ -3363,7 +3363,7 @@ void dap_ledger_addr_get_token_ticker_all(dap_ledger_t *a_ledger, dap_chain_addr dap_ledger_token_item_t * l_token_item, *l_tmp; char **l_tickers = DAP_NEW_Z_SIZE(char*, l_count * sizeof(char*)); if (!l_tickers) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); pthread_rwlock_unlock(&PVT(a_ledger)->balance_accounts_rwlock); return; } @@ -3383,7 +3383,7 @@ void dap_ledger_addr_get_token_ticker_all(dap_ledger_t *a_ledger, dap_chain_addr if(l_count && a_tickers){ char **l_tickers = DAP_NEW_Z_SIZE(char*, l_count * sizeof(char*)); if (!l_tickers) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); pthread_rwlock_unlock(&PVT(a_ledger)->balance_accounts_rwlock); return; } @@ -3901,7 +3901,7 @@ int dap_ledger_tx_cache_check(dap_ledger_t *a_ledger, for (dap_list_t *it = l_list_in; it; it = it->next) { dap_ledger_tx_bound_t *l_bound_item = DAP_NEW_Z(dap_ledger_tx_bound_t); if (!l_bound_item) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); l_err_num = DAP_LEDGER_TX_CHECK_MEMORY_PROBLEM; break; } @@ -4405,7 +4405,7 @@ int dap_ledger_tx_cache_check(dap_ledger_t *a_ledger, if (!l_value_cur) { l_value_cur = DAP_NEW_Z(dap_ledger_tokenizer_t); if ( !l_value_cur ) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); l_err_num = DAP_LEDGER_TX_CHECK_MEMORY_PROBLEM; break; } @@ -4449,7 +4449,7 @@ int dap_ledger_tx_cache_check(dap_ledger_t *a_ledger, } else { l_value_cur = DAP_NEW_Z(dap_ledger_tokenizer_t); if ( !l_value_cur ) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); l_err_num = DAP_LEDGER_TX_CHECK_MEMORY_PROBLEM; if ( l_list_bound_items ) dap_list_free_full(l_list_bound_items, NULL); @@ -4543,7 +4543,7 @@ int dap_ledger_tx_cache_check(dap_ledger_t *a_ledger, if (!l_value_cur) { l_value_cur = DAP_NEW_Z(dap_ledger_tokenizer_t); if ( !l_value_cur ) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); l_err_num = DAP_LEDGER_TX_CHECK_MEMORY_PROBLEM; break; } @@ -4813,14 +4813,14 @@ int dap_ledger_tx_add(dap_ledger_t *a_ledger, dap_chain_datum_tx_t *a_tx, dap_ha } else { l_item_tmp = DAP_NEW_Z(dap_ledger_tx_item_t); if ( !l_item_tmp ) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } l_item_tmp->tx_hash_fast = *a_tx_hash; l_item_tmp->tx = l_ledger_pvt->mapped ? a_tx : DAP_DUP_SIZE(a_tx, dap_chain_datum_tx_get_size(a_tx)); if ( !l_item_tmp->tx ) { DAP_DELETE(l_item_tmp); - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } l_item_tmp->ts_added = dap_nanotime_now(); @@ -4852,7 +4852,7 @@ int dap_ledger_tx_add(dap_ledger_t *a_ledger, dap_chain_datum_tx_t *a_tx, dap_ha if (PVT(a_ledger)->cached) { l_cache_used_outs = DAP_NEW_Z_SIZE(dap_store_obj_t, sizeof(dap_store_obj_t) * (l_outs_used + 1)); if ( !l_cache_used_outs ) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); l_ret = -1; goto FIN; } @@ -4899,7 +4899,7 @@ int dap_ledger_tx_add(dap_ledger_t *a_ledger, dap_chain_datum_tx_t *a_tx, dap_ha case TX_ITEM_TYPE_IN_REWARD: { dap_ledger_reward_item_t *l_item = DAP_NEW_Z(dap_ledger_reward_item_t); if (!l_item) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); l_ret = -1; goto FIN; } @@ -5077,7 +5077,7 @@ int dap_ledger_tx_add(dap_ledger_t *a_ledger, dap_chain_datum_tx_t *a_tx, dap_ha // add transaction to the cache list dap_ledger_tx_item_t *l_tx_item = DAP_NEW_Z(dap_ledger_tx_item_t); if ( !l_tx_item ) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); l_ret = -1; goto FIN; } @@ -6232,7 +6232,7 @@ int dap_ledger_verificator_add(dap_chain_tx_out_cond_subtype_t a_subtype, dap_le } l_new_verificator = DAP_NEW(dap_ledger_verificator_t); if (!l_new_verificator) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } l_new_verificator->subtype = (int)a_subtype; diff --git a/modules/net/dap_chain_net.c b/modules/net/dap_chain_net.c index ab659d3377..ad0c4189a2 100644 --- a/modules/net/dap_chain_net.c +++ b/modules/net/dap_chain_net.c @@ -1880,7 +1880,7 @@ int s_net_init(const char *a_net_name, uint16_t a_acl_idx) // Add network to the list dap_chain_net_item_t *l_net_item = DAP_NEW_Z(dap_chain_net_item_t); if (!l_net_item) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_chain_net_delete(l_net); dap_config_close(l_cfg); return -4; @@ -1896,7 +1896,7 @@ int s_net_init(const char *a_net_name, uint16_t a_acl_idx) if (l_net_pvt->permanent_links_count) { l_net_pvt->permanent_links = DAP_NEW_Z_COUNT(dap_link_info_t *, l_net_pvt->permanent_links_count); if (!l_net_pvt->permanent_links) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_chain_net_delete(l_net); dap_config_close(l_cfg); return -4; @@ -1905,7 +1905,7 @@ int s_net_init(const char *a_net_name, uint16_t a_acl_idx) for (uint16_t i = 0; i < l_net_pvt->permanent_links_count; ++i) { l_net_pvt->permanent_links[i] = DAP_NEW_Z(dap_link_info_t); if (!l_net_pvt->permanent_links[i]) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_chain_net_delete(l_net); dap_config_close(l_cfg); return -4; @@ -1954,7 +1954,7 @@ int s_net_init(const char *a_net_name, uint16_t a_acl_idx) if (!l_net_pvt->seed_nodes_count) log_it(L_WARNING, "Can't read seed nodes addresses, work with local balancer only"); else if (!(l_net_pvt->seed_nodes_info = DAP_NEW_Z_COUNT(struct request_link_info *, l_net_pvt->seed_nodes_count))) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_chain_net_delete(l_net); dap_config_close(l_cfg); return -4; @@ -1971,7 +1971,7 @@ int s_net_init(const char *a_net_name, uint16_t a_acl_idx) } l_net_pvt->seed_nodes_info[i] = DAP_NEW_Z(struct request_link_info); if (!l_net_pvt->seed_nodes_info[i]) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_chain_net_delete(l_net); dap_config_close(l_cfg); return -4; @@ -1998,7 +1998,7 @@ int s_net_init(const char *a_net_name, uint16_t a_acl_idx) continue; char *l_entry_name = dap_strdup(l_dir_entry->d_name); if (!l_entry_name) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_chain_net_delete(l_net); closedir(l_chains_dir); return -8; @@ -2012,7 +2012,7 @@ int s_net_init(const char *a_net_name, uint16_t a_acl_idx) if(l_cfg_new) { list_priority *l_chain_prior = DAP_NEW_Z(list_priority); if (!l_chain_prior) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DELETE(l_entry_name); dap_config_close(l_cfg_new); closedir(l_chains_dir); @@ -2405,7 +2405,7 @@ static void s_ch_in_pkt_callback(dap_stream_ch_t *a_ch, uint8_t a_type, const vo : c_dap_chain_cell_id_null, NULL); if (!l_iter) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_stream_ch_write_error_unsafe(a_ch, l_net->pub.id, l_net_pvt->sync_context.cur_chain->id, l_net_pvt->sync_context.cur_cell @@ -2541,7 +2541,7 @@ static void s_sync_timer_callback(void *a_arg) l_net_pvt->sync_context.cur_cell ? l_net_pvt->sync_context.cur_cell->id : c_dap_chain_cell_id_null, &l_request, sizeof(l_request), DAP_CHAIN_CH_PKT_VERSION_CURRENT); if (!l_chain_pkt) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } log_it(L_INFO, "Start synchronization process with " NODE_ADDR_FP_STR diff --git a/modules/net/dap_chain_net_balancer.c b/modules/net/dap_chain_net_balancer.c index 182a023c96..17f20611bb 100644 --- a/modules/net/dap_chain_net_balancer.c +++ b/modules/net/dap_chain_net_balancer.c @@ -235,7 +235,7 @@ static dap_chain_net_links_t *s_get_node_addrs(dap_chain_net_t *a_net, uint16_t // memory alloc dap_chain_net_links_t *l_ret = DAP_NEW_Z_SIZE(dap_chain_net_links_t, sizeof(dap_chain_net_links_t) + l_nodes_count * sizeof(dap_link_info_t)); if (!l_ret) { - log_it(L_ERROR, "%s", g_error_memory_alloc); + log_it(L_ERROR, "%s", c_error_memory_alloc); dap_list_free_full(l_nodes_list, NULL); return NULL; } @@ -272,7 +272,7 @@ static dap_chain_net_links_t *s_get_node_addrs_old(dap_chain_net_t *a_net, uint1 // memory alloc dap_chain_net_links_t *l_ret = DAP_NEW_Z_SIZE(dap_chain_net_links_t, sizeof(dap_chain_net_links_t) + l_nodes_count * sizeof(dap_chain_node_info_old_t)); if (!l_ret) { - log_it(L_ERROR, "%s", g_error_memory_alloc); + log_it(L_ERROR, "%s", c_error_memory_alloc); dap_list_free_full(l_nodes_list, NULL); return NULL; } diff --git a/modules/net/dap_chain_net_node_list.c b/modules/net/dap_chain_net_node_list.c index 87257742cb..f247519250 100644 --- a/modules/net/dap_chain_net_node_list.c +++ b/modules/net/dap_chain_net_node_list.c @@ -259,7 +259,7 @@ int dap_chain_net_node_list_request(dap_chain_net_t *a_net, uint16_t a_port, boo struct node_link_request *l_link_node_request = s_node_list_request_init(); if (!l_link_node_request) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -4; }; diff --git a/modules/net/dap_chain_net_tx.c b/modules/net/dap_chain_net_tx.c index 3f9b24196e..f6222d6774 100644 --- a/modules/net/dap_chain_net_tx.c +++ b/modules/net/dap_chain_net_tx.c @@ -78,7 +78,7 @@ static void s_tx_cond_all_with_spends_by_srv_uid_callback(dap_chain_net_t* a_net if (l_tx_prev_out_item){ // we found previous out_cond with target srv_uid dap_chain_datum_tx_spends_item_t *l_item_in = DAP_NEW_Z(dap_chain_datum_tx_spends_item_t); if (!l_item_in) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return ; } size_t l_tx_size = dap_chain_datum_tx_get_size(l_tx); @@ -99,7 +99,7 @@ static void s_tx_cond_all_with_spends_by_srv_uid_callback(dap_chain_net_t* a_net if(l_tx_out_cond->header.srv_uid.uint64 == l_arg->srv_uid.uint64){ dap_chain_datum_tx_spends_item_t * l_item = DAP_NEW_Z(dap_chain_datum_tx_spends_item_t); if (!l_item) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return ; } size_t l_tx_size = dap_chain_datum_tx_get_size(l_tx); @@ -132,14 +132,14 @@ dap_chain_datum_tx_spends_items_t * dap_chain_net_get_tx_cond_all_with_spends_by { cond_all_with_spends_by_srv_uid_arg_t *l_ret = DAP_NEW_Z(cond_all_with_spends_by_srv_uid_arg_t); if (!l_ret) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } l_ret->ret = DAP_NEW_Z(dap_chain_datum_tx_spends_items_t); if (!l_ret->ret) { DAP_DEL_Z(l_ret); - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } l_ret->srv_uid = a_srv_uid; @@ -294,7 +294,7 @@ static void s_get_tx_cond_chain_callback(dap_chain_net_t* a_net, dap_chain_datum }else if(a_tx){ dap_hash_fast_t * l_tx_hash = a_tx_hash; if (!l_tx_hash) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } if (dap_hash_fast_compare(l_tx_hash,l_args->tx_begin_hash)) { @@ -327,7 +327,7 @@ dap_list_t * dap_chain_net_get_tx_cond_chain(dap_chain_net_t * a_net, dap_hash_f { struct get_tx_cond_all_from_tx * l_args = DAP_NEW_Z(struct get_tx_cond_all_from_tx); if (!l_args) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } l_args->tx_begin_hash = a_tx_hash; @@ -448,7 +448,7 @@ dap_list_t * dap_chain_net_get_tx_cond_all_for_addr(dap_chain_net_t * a_net, dap { struct get_tx_cond_all_for_addr * l_args = DAP_NEW_Z(struct get_tx_cond_all_for_addr); if (!l_args) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } l_args->addr = a_addr; diff --git a/modules/net/dap_chain_node.c b/modules/net/dap_chain_node.c index 829377cc71..f48a4fcce0 100644 --- a/modules/net/dap_chain_node.c +++ b/modules/net/dap_chain_node.c @@ -421,7 +421,7 @@ dap_list_t *dap_chain_node_get_states_list_sort(dap_chain_net_t *a_net, dap_chai } dap_chain_node_states_info_t *l_item = DAP_NEW_Z(dap_chain_node_states_info_t); if(!l_item) { - log_it(L_ERROR, "%s", g_error_memory_alloc); + log_it(L_ERROR, "%s", c_error_memory_alloc); break; } dap_nanotime_t l_state_timestamp = 0; diff --git a/modules/net/dap_chain_node_cli_cmd.c b/modules/net/dap_chain_node_cli_cmd.c index 48e7e60841..05b1ea65d4 100644 --- a/modules/net/dap_chain_node_cli_cmd.c +++ b/modules/net/dap_chain_node_cli_cmd.c @@ -563,7 +563,7 @@ int com_global_db(int a_argc, char ** a_argv, void **a_str_reply) dap_get_data_hash_str_static(l_value, l_value_len, l_hash_str); char *l_value_str = DAP_NEW_Z_SIZE(char, l_value_len * 2 + 2); if(!l_value_str) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DELETE(l_value); return -1; } @@ -2131,7 +2131,7 @@ int l_arg_index = 1, l_rc, cmd_num = CMD_NONE; l_seed_size = (l_restore_str_size - 2) / 2; l_seed = DAP_NEW_Z_SIZE(uint8_t, l_seed_size); if(!l_seed) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); json_object_put(json_arr_out); return DAP_CHAIN_NODE_CLI_COM_TX_WALLET_MEMORY_ERR; } @@ -4189,7 +4189,7 @@ static int s_parse_additional_token_decl_arg(int a_argc, char ** a_argv, void ** size_t l_tsd_offset = 0; a_params->ext.parsed_tsd = DAP_NEW_SIZE(byte_t, l_tsd_total_size); if(l_tsd_total_size && !a_params->ext.parsed_tsd) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } for (dap_list_t *l_iter = dap_list_first(l_tsd_list); l_iter; l_iter = l_iter->next) { @@ -4322,7 +4322,7 @@ int com_token_decl(int a_argc, char ** a_argv, void **a_str_reply) dap_sdk_cli_params* l_params = DAP_NEW_Z(dap_sdk_cli_params); if (!l_params) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } @@ -4439,7 +4439,7 @@ int com_token_decl(int a_argc, char ** a_argv, void **a_str_reply) // Create new datum token l_datum_token = DAP_NEW_Z_SIZE(dap_chain_datum_token_t, sizeof(dap_chain_datum_token_t) + l_tsd_total_size); if (!l_datum_token) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_cli_server_cmd_set_reply_text(a_str_reply, "Out of memory in com_token_decl"); DAP_DEL_Z(l_params); return -1; @@ -4530,7 +4530,7 @@ int com_token_decl(int a_argc, char ** a_argv, void **a_str_reply) case DAP_CHAIN_DATUM_TOKEN_SUBTYPE_SIMPLE: { // 256 l_datum_token = DAP_NEW_Z_SIZE(dap_chain_datum_token_t, sizeof(dap_chain_datum_token_t)); if (!l_datum_token) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_cli_server_cmd_set_reply_text(a_str_reply, "Out of memory in com_token_decl"); DAP_DEL_Z(l_params); return -1; @@ -4663,7 +4663,7 @@ int com_token_update(int a_argc, char ** a_argv, void **a_str_reply) dap_sdk_cli_params* l_params = DAP_NEW_Z(dap_sdk_cli_params); if (!l_params) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } @@ -4701,7 +4701,7 @@ int com_token_update(int a_argc, char ** a_argv, void **a_str_reply) // Create new datum token l_datum_token = DAP_NEW_Z_SIZE(dap_chain_datum_token_t, sizeof(dap_chain_datum_token_t) + l_params->ext.tsd_total_size); if (!l_datum_token) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } l_datum_token->version = 2; @@ -4738,7 +4738,7 @@ int com_token_update(int a_argc, char ** a_argv, void **a_str_reply) case DAP_CHAIN_DATUM_TOKEN_SUBTYPE_SIMPLE: { // 256 l_datum_token = DAP_NEW_Z_SIZE(dap_chain_datum_token_t, sizeof(dap_chain_datum_token_t)); if (!l_datum_token) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } l_datum_token->version = 2; @@ -5853,7 +5853,7 @@ int com_chain_ca_pub( int a_argc, char ** a_argv, void **a_str_reply) l_cert_new->enc_key->pub_key_data_size = l_cert->enc_key->pub_key_data_size ); if(!l_cert_new->enc_key->pub_key_data) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DELETE(l_cert_new->enc_key); DAP_DELETE(l_cert_new); return -11; @@ -7484,7 +7484,7 @@ int cmd_gdb_export(int a_argc, char **a_argv, void **a_str_reply) char *l_value_enc_str = DAP_NEW_Z_SIZE(char, l_out_size); char *l_sign_str = DAP_NEW_Z_SIZE(char, l_sign_size); if(!l_value_enc_str || !l_sign_str) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DEL_Z(l_sign_str); DAP_DEL_Z(l_value_enc_str); return -1; @@ -7576,7 +7576,7 @@ int cmd_gdb_import(int a_argc, char **a_argv, void **a_str_reply) size_t l_records_count = json_object_array_length(l_json_records); dap_store_obj_t *l_group_store = DAP_NEW_Z_SIZE(dap_store_obj_t, l_records_count * sizeof(dap_store_obj_t)); if(!l_group_store) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } for (size_t j = 0; j < l_records_count; ++j) { @@ -7589,13 +7589,13 @@ int cmd_gdb_import(int a_argc, char **a_argv, void **a_str_reply) l_ts = json_object_object_get(l_record, "timestamp"); l_group_store[j].key = dap_strdup(json_object_get_string(l_key)); if(!l_group_store[j].key) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); l_records_count = j; break; } l_group_store[j].group = dap_strdup(l_group_name); if(!l_group_store[j].group) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); l_records_count = j; break; } @@ -7606,7 +7606,7 @@ int cmd_gdb_import(int a_argc, char **a_argv, void **a_str_reply) const char *l_value_str = json_object_get_string(l_value); char *l_val = DAP_NEW_Z_SIZE(char, l_group_store[j].value_len); if(!l_val) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); l_records_count = j; break; } @@ -7706,7 +7706,7 @@ int cmd_remove(int a_argc, char **a_argv, void **a_str_reply) for (dap_chain_net_t *it = dap_chain_net_iter_start(); it; it = dap_chain_net_iter_next(it)) { _pvt_net_nodes_list_t *l_gdb_groups = DAP_NEW(_pvt_net_nodes_list_t); if (!l_gdb_groups) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_list_free(l_net_returns); return -1; } @@ -8268,7 +8268,7 @@ static byte_t *s_concat_meta (dap_list_t *a_meta, size_t *a_fullsize) int l_power = 1; byte_t *l_buf = DAP_CALLOC(l_part * l_power++, 1); if (!l_buf) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } size_t l_counter = 0; @@ -8284,7 +8284,7 @@ static byte_t *s_concat_meta (dap_list_t *a_meta, size_t *a_fullsize) l_part_power = l_part * l_power++; l_buf = (byte_t *) DAP_REALLOC(l_buf, l_part_power); if (!l_buf) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } } @@ -8307,7 +8307,7 @@ static uint8_t *s_concat_hash_and_mimetypes (dap_chain_hash_fast_t *a_chain_hash *a_fullsize += sizeof (a_chain_hash->raw) + 1; uint8_t *l_fullbuf = DAP_CALLOC(*a_fullsize, 1); if (!l_fullbuf) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DELETE(l_buf); return NULL; } @@ -8326,7 +8326,7 @@ static char *s_strdup_by_index (const char *a_file, const int a_index) { char *l_buf = DAP_CALLOC(a_index + 1, 1); if (!l_buf) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } strncpy (l_buf, a_file, a_index); diff --git a/modules/net/dap_chain_node_cli_cmd_tx.c b/modules/net/dap_chain_node_cli_cmd_tx.c index 26a382ae19..4f1c02a87a 100644 --- a/modules/net/dap_chain_node_cli_cmd_tx.c +++ b/modules/net/dap_chain_node_cli_cmd_tx.c @@ -270,7 +270,7 @@ static void s_tx_header_print(json_object* json_obj_datum, dap_chain_tx_hash_pro else { l_tx_data = DAP_NEW_Z(dap_chain_tx_hash_processed_ht_t); if (!l_tx_data) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } l_tx_data->hash = *a_tx_hash; @@ -332,7 +332,7 @@ json_object* dap_db_history_addr(dap_chain_addr_t *a_addr, dap_chain_t *a_chain, { json_object* json_obj_datum = json_object_new_array(); if (!json_obj_datum){ - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_json_rpc_error_add(-44, "Memory allocation error"); return NULL; } @@ -773,7 +773,7 @@ json_object *dap_db_history_tx_all(dap_chain_t *l_chain, dap_chain_net_t *l_net, bool accepted_tx; json_object* json_obj_datum = dap_db_tx_history_to_json(&l_ttx_hash, NULL, l_tx, l_chain, l_hash_out_type, l_net, 0, &accepted_tx, out_brief); if (!json_obj_datum) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } if (accepted_tx) { @@ -896,7 +896,7 @@ static char* dap_db_history_filter(dap_chain_t * a_chain, dap_ledger_t *a_ledger } dap_string_t *l_str_out = dap_string_new(NULL); if (!l_str_out) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } // list all transactions @@ -982,7 +982,7 @@ static char* dap_db_history_filter(dap_chain_t * a_chain, dap_ledger_t *a_ledger } l_sht = DAP_NEW_Z(dap_chain_tx_hash_processed_ht_t); if (!l_sht) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } l_sht->hash = l_tx_hash; @@ -1603,7 +1603,7 @@ int cmd_decree(int a_argc, char **a_argv, void **a_str_reply) l_total_tsd_size += sizeof(dap_tsd_t) + sizeof(dap_chain_addr_t); l_tsd = DAP_NEW_Z_SIZE(dap_tsd_t, l_total_tsd_size); if (!l_tsd) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_list_free_full(l_tsd_list, NULL); return -1; } @@ -1617,7 +1617,7 @@ int cmd_decree(int a_argc, char **a_argv, void **a_str_reply) l_total_tsd_size += sizeof(dap_tsd_t) + sizeof(uint256_t); l_tsd = DAP_NEW_Z_SIZE(dap_tsd_t, l_total_tsd_size); if (!l_tsd) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_list_free_full(l_tsd_list, NULL); return -1; } @@ -1674,7 +1674,7 @@ int cmd_decree(int a_argc, char **a_argv, void **a_str_reply) l_total_tsd_size = sizeof(dap_tsd_t) + sizeof(uint256_t); l_tsd = DAP_NEW_Z_SIZE(dap_tsd_t, l_total_tsd_size); if (!l_tsd) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_list_free_full(l_tsd_list, NULL); return -1; } diff --git a/modules/net/dap_chain_node_client.c b/modules/net/dap_chain_node_client.c index 85c1e97920..41e93f4a1e 100644 --- a/modules/net/dap_chain_node_client.c +++ b/modules/net/dap_chain_node_client.c @@ -260,7 +260,7 @@ dap_chain_node_client_t *dap_chain_node_client_create(dap_chain_net_t *a_net, } dap_chain_node_client_t *l_node_client = DAP_NEW_Z(dap_chain_node_client_t); if (!l_node_client) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } diff --git a/modules/net/dap_chain_node_dns_client.c b/modules/net/dap_chain_node_dns_client.c index fdf0d57a4f..3d82dd6152 100644 --- a/modules/net/dap_chain_node_dns_client.c +++ b/modules/net/dap_chain_node_dns_client.c @@ -178,7 +178,7 @@ static void s_dns_client_esocket_worker_assign_callback(dap_events_socket_t * a_ dap_events_socket_uuid_t * l_es_uuid_ptr = DAP_NEW_Z(dap_events_socket_uuid_t); if (!l_es_uuid_ptr) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } *l_es_uuid_ptr = a_esocket->uuid; diff --git a/modules/net/dap_chain_node_ping.c b/modules/net/dap_chain_node_ping.c index f4b19e85dd..fdcf333b5a 100644 --- a/modules/net/dap_chain_node_ping.c +++ b/modules/net/dap_chain_node_ping.c @@ -93,7 +93,7 @@ static void* node_ping_proc(void *a_arg) /*char *host4 = DAP_NEW_SIZE(char, INET_ADDRSTRLEN); if (!host4) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } struct sockaddr_in sa4 = { .sin_family = AF_INET, .sin_addr = l_addr }; @@ -166,7 +166,7 @@ int start_node_ping(pthread_t *a_thread, struct in_addr a_addr, int a_port, int { uint8_t *l_data = DAP_NEW_Z_SIZE(uint8_t, sizeof(struct in_addr) + 2 * sizeof(int)); if (!l_data) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } memcpy(l_data, &a_count, sizeof(int)); @@ -280,7 +280,7 @@ static void* node_ping_background_proc(void *a_arg) dap_chain_node_addr_t *l_node_addr_tmp; l_node_addr_tmp = DAP_NEW(dap_chain_node_addr_t); if (!l_node_addr_tmp) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_list_free_full(l_node_list0, NULL); DAP_DEL_Z(s_node_addr_ping); DAP_DELETE(a_arg); @@ -293,7 +293,7 @@ static void* node_ping_background_proc(void *a_arg) l_node_addr_tmp = DAP_NEW(dap_chain_node_addr_t); if (!l_node_addr_tmp) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_list_free_full(l_node_list0, NULL); DAP_DEL_Z(s_node_addr_ping); DAP_DELETE(a_arg); @@ -323,7 +323,7 @@ int dap_chain_node_ping_background_start(dap_chain_net_t *a_net, dap_list_t *a_n while(l_node_list_tmp) { dap_chain_node_addr_t *l_addr = DAP_NEW(dap_chain_node_addr_t); if (!l_addr) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_list_free_full(l_node_list, NULL); return -1; } @@ -336,7 +336,7 @@ int dap_chain_node_ping_background_start(dap_chain_net_t *a_net, dap_list_t *a_n // uint8_t *l_arg = DAP_NEW_SIZE(uint8_t, sizeof(dap_chain_net_t*) + sizeof(dap_list_t*)); if (!l_arg) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_list_free_full(l_node_list, NULL); return -1; } diff --git a/modules/net/srv/dap_chain_net_srv.c b/modules/net/srv/dap_chain_net_srv.c index b3b6fbe93b..0e560cdaf5 100644 --- a/modules/net/srv/dap_chain_net_srv.c +++ b/modules/net/srv/dap_chain_net_srv.c @@ -857,7 +857,7 @@ dap_chain_net_srv_price_t * dap_chain_net_srv_get_price_from_order(dap_chain_net dap_chain_net_srv_price_t *l_price = DAP_NEW_Z(dap_chain_net_srv_price_t); if (!l_price) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DEL_Z(l_order); return NULL; } @@ -977,7 +977,7 @@ dap_chain_net_srv_t* dap_chain_net_srv_add(dap_chain_net_srv_uid_t a_uid, if(!l_sdata) { l_srv = DAP_NEW_Z(dap_chain_net_srv_t); if (!l_srv) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); pthread_mutex_unlock(&s_srv_list_mutex); return NULL; } @@ -987,7 +987,7 @@ dap_chain_net_srv_t* dap_chain_net_srv_add(dap_chain_net_srv_uid_t a_uid, pthread_mutex_init(&l_srv->banlist_mutex, NULL); l_sdata = DAP_NEW_Z(service_list_t); if (!l_sdata) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DEL_Z(l_srv); pthread_mutex_unlock(&s_srv_list_mutex); return NULL; diff --git a/modules/net/srv/dap_chain_net_srv_client.c b/modules/net/srv/dap_chain_net_srv_client.c index de1bc0e0f5..f636c5e610 100644 --- a/modules/net/srv/dap_chain_net_srv_client.c +++ b/modules/net/srv/dap_chain_net_srv_client.c @@ -42,7 +42,7 @@ dap_chain_net_srv_client_t *dap_chain_net_srv_client_create_n_connect(dap_chain_ { dap_chain_net_srv_client_t *l_ret = DAP_NEW_Z(dap_chain_net_srv_client_t); if (!l_ret) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } if (a_callbacks) diff --git a/modules/net/srv/dap_chain_net_srv_geoip.c b/modules/net/srv/dap_chain_net_srv_geoip.c index a2117620ea..96a861c09f 100644 --- a/modules/net/srv/dap_chain_net_srv_geoip.c +++ b/modules/net/srv/dap_chain_net_srv_geoip.c @@ -188,7 +188,7 @@ geoip_info_t *chain_net_geoip_get_ip_info_by_local_db(const char *a_ip_str, cons geoip_info_t *l_ret = DAP_NEW_Z(geoip_info_t); if (!l_ret) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } diff --git a/modules/net/srv/dap_chain_net_srv_order.c b/modules/net/srv/dap_chain_net_srv_order.c index 6ffa4c02d4..d020aefde0 100644 --- a/modules/net/srv/dap_chain_net_srv_order.c +++ b/modules/net/srv/dap_chain_net_srv_order.c @@ -163,7 +163,7 @@ bool dap_chain_net_srv_order_get_continent_region(const dap_chain_net_srv_order_ if(l_size > 0) { *a_region = DAP_NEW_SIZE(char, l_size); if (!a_region) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return false; } memcpy(*a_region, a_order_static->ext_n_sign + 1 + sizeof(uint8_t), l_size); @@ -298,7 +298,7 @@ dap_chain_net_srv_order_t *dap_chain_net_srv_order_compose(dap_chain_net_t *a_ne if (a_ext_size) { l_order = (dap_chain_net_srv_order_t *)DAP_NEW_Z_SIZE(void, sizeof(dap_chain_net_srv_order_t) + a_ext_size); if (!l_order) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } memcpy(l_order->ext_n_sign, a_ext, a_ext_size); @@ -307,7 +307,7 @@ dap_chain_net_srv_order_t *dap_chain_net_srv_order_compose(dap_chain_net_t *a_ne else { l_order = DAP_NEW_Z(dap_chain_net_srv_order_t); if (!l_order) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } dap_chain_net_srv_order_set_continent_region(&l_order, a_continent_num, a_region); @@ -461,7 +461,7 @@ int dap_chain_net_srv_order_find_all_by(dap_chain_net_t *a_net, const dap_chain_ size_t l_order_mem_size = dap_chain_net_srv_order_get_size(l_order); dap_chain_net_srv_order_t *l_output_order = DAP_DUP_SIZE(l_order, l_order_mem_size); if (!l_output_order) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_global_db_objs_delete(l_orders, l_orders_count); return -1; } diff --git a/modules/net/srv/dap_chain_net_srv_stream_session.c b/modules/net/srv/dap_chain_net_srv_stream_session.c index f471895fb5..fd218ff8f2 100644 --- a/modules/net/srv/dap_chain_net_srv_stream_session.c +++ b/modules/net/srv/dap_chain_net_srv_stream_session.c @@ -42,7 +42,7 @@ dap_chain_net_srv_stream_session_t * dap_chain_net_srv_stream_session_create( da } dap_chain_net_srv_stream_session_t * l_session_srv= DAP_NEW_Z(dap_chain_net_srv_stream_session_t); if (!l_session_srv) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } a_session->_inheritor = l_session_srv; @@ -80,7 +80,7 @@ dap_chain_net_srv_usage_t* dap_chain_net_srv_usage_add (dap_chain_net_srv_stream if ( a_srv_session && a_net && a_srv ){ dap_chain_net_srv_usage_t * l_ret = DAP_NEW_Z(dap_chain_net_srv_usage_t); if (!l_ret) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } randombytes(&l_ret->id, sizeof(l_ret->id)); diff --git a/modules/service/datum/dap_chain_net_srv_datum.c b/modules/service/datum/dap_chain_net_srv_datum.c index 58ff27e104..edc7d16a3a 100644 --- a/modules/service/datum/dap_chain_net_srv_datum.c +++ b/modules/service/datum/dap_chain_net_srv_datum.c @@ -53,7 +53,7 @@ int dap_chain_net_srv_datum_init() "\tLoad datum custum from file to mempool.\n\n"); s_srv_datum = DAP_NEW_Z(dap_chain_net_srv_t); if (!s_srv_datum) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } s_srv_datum->uid.uint64 = DAP_CHAIN_NET_SRV_DATUM_ID; diff --git a/modules/service/stake/dap_chain_net_srv_stake_pos_delegate.c b/modules/service/stake/dap_chain_net_srv_stake_pos_delegate.c index 05cf9f8cb3..f47951e508 100644 --- a/modules/service/stake/dap_chain_net_srv_stake_pos_delegate.c +++ b/modules/service/stake/dap_chain_net_srv_stake_pos_delegate.c @@ -514,7 +514,7 @@ dap_list_t *dap_chain_net_srv_stake_get_validators(dap_chain_net_id_t a_net_id, } return l_ret; fail_ret: - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_list_free_full(l_ret, NULL); if (a_excluded_list) DAP_DELETE(*a_excluded_list); @@ -612,7 +612,7 @@ int dap_chain_net_srv_stake_load_cache(dap_chain_net_t *a_net) (dap_chain_net_srv_stake_cache_data_t *)l_objs[i].value; dap_chain_net_srv_stake_cache_item_t *l_cache = DAP_NEW_Z(dap_chain_net_srv_stake_cache_item_t); if (!l_cache) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -3; } l_cache->signing_addr = l_cache_data->signing_addr; @@ -835,7 +835,7 @@ dap_chain_datum_decree_t *dap_chain_net_srv_stake_decree_approve(dap_chain_net_t l_total_tsd_size += sizeof(dap_tsd_t) + sizeof(dap_hash_fast_t); l_tsd = DAP_NEW_Z_SIZE(dap_tsd_t, l_total_tsd_size); if (!l_tsd) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } l_tsd->type = DAP_CHAIN_DATUM_DECREE_TSD_TYPE_HASH; @@ -846,7 +846,7 @@ dap_chain_datum_decree_t *dap_chain_net_srv_stake_decree_approve(dap_chain_net_t l_total_tsd_size += sizeof(dap_tsd_t) + sizeof(uint256_t); l_tsd = DAP_NEW_Z_SIZE(dap_tsd_t, l_total_tsd_size); if (!l_tsd) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_list_free_full(l_tsd_list, NULL); return NULL; } @@ -858,7 +858,7 @@ dap_chain_datum_decree_t *dap_chain_net_srv_stake_decree_approve(dap_chain_net_t l_total_tsd_size += sizeof(dap_tsd_t) + sizeof(dap_chain_addr_t); l_tsd = DAP_NEW_Z_SIZE(dap_tsd_t, l_total_tsd_size); if (!l_tsd) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_list_free_full(l_tsd_list, NULL); return NULL; } @@ -870,7 +870,7 @@ dap_chain_datum_decree_t *dap_chain_net_srv_stake_decree_approve(dap_chain_net_t l_total_tsd_size += sizeof(dap_tsd_t) + sizeof(dap_chain_node_addr_t); l_tsd = DAP_NEW_Z_SIZE(dap_tsd_t, l_total_tsd_size); if (!l_tsd) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_list_free_full(l_tsd_list, NULL); return NULL; } @@ -881,7 +881,7 @@ dap_chain_datum_decree_t *dap_chain_net_srv_stake_decree_approve(dap_chain_net_t l_decree = DAP_NEW_Z_SIZE(dap_chain_datum_decree_t, sizeof(dap_chain_datum_decree_t) + l_total_tsd_size); if (!l_decree) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_list_free_full(l_tsd_list, NULL); return NULL; } @@ -922,7 +922,7 @@ dap_chain_datum_decree_t *dap_chain_net_srv_stake_decree_approve(dap_chain_net_t size_t l_sign_size = dap_sign_get_size(l_sign); l_decree = DAP_REALLOC(l_decree, sizeof(dap_chain_datum_decree_t) + l_cur_sign_offset + l_sign_size); if (!l_decree) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DELETE(l_sign); return NULL; } @@ -1098,7 +1098,7 @@ static dap_chain_datum_decree_t *s_stake_decree_invalidate(dap_chain_net_t *a_ne l_total_tsd_size += sizeof(dap_tsd_t) + sizeof(dap_chain_addr_t); l_tsd = DAP_NEW_Z_SIZE(dap_tsd_t, l_total_tsd_size); if (!l_tsd) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } l_tsd->type = DAP_CHAIN_DATUM_DECREE_TSD_TYPE_STAKE_SIGNING_ADDR; @@ -1108,7 +1108,7 @@ static dap_chain_datum_decree_t *s_stake_decree_invalidate(dap_chain_net_t *a_ne l_decree = DAP_NEW_Z_SIZE(dap_chain_datum_decree_t, sizeof(dap_chain_datum_decree_t) + l_total_tsd_size); if (!l_decree) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_list_free_full(l_tsd_list, NULL); return NULL; } @@ -1150,7 +1150,7 @@ static dap_chain_datum_decree_t *s_stake_decree_invalidate(dap_chain_net_t *a_ne size_t l_sign_size = dap_sign_get_size(l_sign); l_decree = DAP_REALLOC(l_decree, sizeof(dap_chain_datum_decree_t) + l_cur_sign_offset + l_sign_size); if (!l_decree) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DELETE(l_sign); return NULL; } @@ -2626,7 +2626,7 @@ static int s_cli_srv_stake(int a_argc, char **a_argv, void **a_str_reply) } struct get_tx_cond_pos_del_from_tx * l_args = DAP_NEW_Z(struct get_tx_cond_pos_del_from_tx); if(!l_args) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_cli_server_cmd_set_reply_text(a_str_reply, "Out of memory"); return -1; } diff --git a/modules/service/voting/dap_chain_net_srv_voting.c b/modules/service/voting/dap_chain_net_srv_voting.c index 2f9597ab7c..4f294dbc59 100644 --- a/modules/service/voting/dap_chain_net_srv_voting.c +++ b/modules/service/voting/dap_chain_net_srv_voting.c @@ -158,7 +158,7 @@ uint64_t* dap_chain_net_voting_get_result(dap_ledger_t* a_ledger, dap_chain_hash l_voting_results = DAP_NEW_Z_SIZE(uint64_t, sizeof(uint64_t)*dap_list_length(l_voting->voting_params.option_offsets_list)); if (!l_voting_results){ - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } diff --git a/modules/service/vpn/dap_chain_net_srv_vpn.c b/modules/service/vpn/dap_chain_net_srv_vpn.c index 81a078789a..7ddd013c18 100644 --- a/modules/service/vpn/dap_chain_net_srv_vpn.c +++ b/modules/service/vpn/dap_chain_net_srv_vpn.c @@ -294,7 +294,7 @@ static bool s_tun_client_send_data(dap_chain_net_srv_ch_vpn_info_t * l_ch_vpn_in assert(a_data_size > sizeof (dap_os_iphdr_t)); ch_vpn_pkt_t *l_pkt_out = DAP_NEW_Z_SIZE(ch_vpn_pkt_t, sizeof(l_pkt_out->header) + a_data_size); if (!l_pkt_out) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return false; } l_pkt_out->header.op_code = VPN_PACKET_OP_CODE_VPN_RECV; @@ -335,7 +335,7 @@ static bool s_tun_client_send_data(dap_chain_net_srv_ch_vpn_info_t * l_ch_vpn_in /* Shift it to other worker context */ tun_socket_msg_t* l_msg = DAP_NEW_Z(tun_socket_msg_t); if (!l_msg) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DEL_Z(l_pkt_out); return false; } @@ -417,7 +417,7 @@ static void s_tun_recv_msg_callback(dap_events_socket_t * a_esocket_queue, void }else{ l_new_info = DAP_NEW_Z(dap_chain_net_srv_ch_vpn_info_t); if (!l_new_info) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DELETE(l_msg); return; } @@ -495,7 +495,7 @@ static void s_tun_send_msg_ip_assigned(uint32_t a_worker_own_id, uint32_t a_work { struct tun_socket_msg * l_msg = DAP_NEW_Z(struct tun_socket_msg); if (!l_msg) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } l_msg->type = TUN_SOCKET_MSG_IP_ASSIGNED; @@ -536,7 +536,7 @@ static void s_tun_send_msg_ip_unassigned(uint32_t a_worker_own_id, uint32_t a_wo { struct tun_socket_msg * l_msg = DAP_NEW_Z(struct tun_socket_msg); if (!l_msg) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } l_msg->type = TUN_SOCKET_MSG_IP_UNASSIGNED; @@ -585,7 +585,7 @@ static void s_tun_send_msg_esocket_reassigned_inter(uint32_t a_worker_own_id, da { struct tun_socket_msg * l_msg = DAP_NEW_Z(struct tun_socket_msg); if (!l_msg) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } l_msg->type = TUN_SOCKET_MSG_ESOCKET_REASSIGNED ; @@ -843,7 +843,7 @@ static int s_vpn_tun_init() { s_raw_server=DAP_NEW_Z(vpn_local_network_t); if (!s_raw_server) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } pthread_rwlock_init(&s_raw_server->rwlock, NULL); @@ -879,7 +879,7 @@ static int s_vpn_service_create(dap_config_t * g_config) dap_chain_net_srv_vpn_t* l_srv_vpn = DAP_NEW_Z( dap_chain_net_srv_vpn_t); if(!l_srv_vpn) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } l_srv->_internal = l_srv_vpn; @@ -1247,7 +1247,7 @@ void s_ch_vpn_new(dap_stream_ch_t* a_ch, void* a_arg) a_ch->internal = DAP_NEW_Z(dap_chain_net_srv_ch_vpn_t); if (!a_ch->internal) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } dap_chain_net_srv_ch_vpn_t * l_srv_vpn = CH_VPN(a_ch); @@ -1310,7 +1310,7 @@ static void s_ch_vpn_delete(dap_stream_ch_t* a_ch, void* arg) log_it(L_DEBUG, "Unlease address %s and store in treshold", inet_ntoa(l_ch_vpn->addr_ipv4)); dap_chain_net_srv_vpn_item_ipv4_t * l_item_unleased = DAP_NEW_Z(dap_chain_net_srv_vpn_item_ipv4_t); if (!l_item_unleased) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); pthread_rwlock_unlock(&s_clients_rwlock); return; } @@ -1475,7 +1475,7 @@ static void send_pong_pkt(dap_stream_ch_t* a_ch) // log_it(L_DEBUG,"---------------------------------- PONG!"); ch_vpn_pkt_t *pkt_out = (ch_vpn_pkt_t*) calloc(1, sizeof(pkt_out->header)); if (!pkt_out) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } pkt_out->header.op_code = VPN_PACKET_OP_CODE_PONG; @@ -1504,7 +1504,7 @@ static void s_ch_packet_in_vpn_address_request(dap_stream_ch_t *a_ch, dap_chain_ log_it(L_WARNING, "IP address is already leased"); ch_vpn_pkt_t* pkt_out = DAP_NEW_STACK_SIZE(ch_vpn_pkt_t, sizeof(pkt_out->header)); if (!pkt_out) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } pkt_out->header.op_code = VPN_PACKET_OP_CODE_PROBLEM; diff --git a/modules/service/vpn/dap_chain_net_vpn_client.c b/modules/service/vpn/dap_chain_net_vpn_client.c index 3478c73d2e..8cce01f46e 100644 --- a/modules/service/vpn/dap_chain_net_vpn_client.c +++ b/modules/service/vpn/dap_chain_net_vpn_client.c @@ -183,7 +183,7 @@ static int s_callback_client_success(dap_chain_net_srv_t * a_srv, uint32_t a_usa size_t l_ipv4_str_len = 0; //dap_strlen(a_ipv4_str); ch_vpn_pkt_t *pkt_out = (ch_vpn_pkt_t*) calloc(1, sizeof(pkt_out->header) + l_ipv4_str_len); if (!pkt_out) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_stream_session_unlock(); return -1; } diff --git a/modules/service/vpn/dap_chain_net_vpn_client_tun.c b/modules/service/vpn/dap_chain_net_vpn_client_tun.c index 028eec5d05..1dfb14c397 100644 --- a/modules/service/vpn/dap_chain_net_vpn_client_tun.c +++ b/modules/service/vpn/dap_chain_net_vpn_client_tun.c @@ -683,7 +683,7 @@ void ch_sf_tun_client_send(dap_chain_net_srv_ch_vpn_t * ch_sf, void * pkt_data, //log_it(ERROR,"raw socket ring buffer overflowed"); ch_vpn_pkt_t *pkt_out = (ch_vpn_pkt_t*) calloc(1, sizeof(pkt_out->header)); if (!pkt_out) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); if(in_daddr_str) DAP_DELETE(in_daddr_str); if(in_saddr_str) diff --git a/modules/service/xchange/dap_chain_net_srv_xchange.c b/modules/service/xchange/dap_chain_net_srv_xchange.c index 0040e2d36f..dbfd9c937d 100644 --- a/modules/service/xchange/dap_chain_net_srv_xchange.c +++ b/modules/service/xchange/dap_chain_net_srv_xchange.c @@ -194,7 +194,7 @@ int dap_chain_net_srv_xchange_init() dap_chain_net_srv_t* l_srv = dap_chain_net_srv_add(l_uid, "srv_xchange", &l_srv_callbacks); s_srv_xchange = DAP_NEW_Z(dap_chain_net_srv_xchange_t); if (!s_srv_xchange || !l_srv) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } l_srv->_internal = s_srv_xchange; @@ -208,7 +208,7 @@ int dap_chain_net_srv_xchange_init() uint256_t l_fee_value = dap_chain_coins_to_balance(dap_config_get_item_str_default(g_config, "srv_xchange", "fee_value", "0.02")); const char *l_wallet_addr = dap_config_get_item_str_default(g_config, "srv_xchange", "wallet_addr", NULL); if(!l_wallet_addr){ - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } const char *l_net_str = dap_config_get_item_str_default(g_config, "srv_xchange", "net", NULL); @@ -414,7 +414,7 @@ static dap_chain_datum_tx_receipt_t *s_xchange_receipt_create(dap_chain_net_srv_ uint32_t l_ext_size = sizeof(uint256_t) + DAP_CHAIN_TICKER_SIZE_MAX; uint8_t *l_ext = DAP_NEW_STACK_SIZE(uint8_t, l_ext_size); if (!l_ext) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } memcpy(l_ext, &a_datoshi_buy, sizeof(uint256_t)); @@ -1122,7 +1122,7 @@ dap_chain_net_srv_xchange_price_t *s_xchange_price_from_order(dap_chain_net_t *a return NULL; dap_chain_net_srv_xchange_price_t *l_price = DAP_NEW_Z(dap_chain_net_srv_xchange_price_t); if (!l_price) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } l_price->creation_date = a_order->header.ts_created; @@ -1910,7 +1910,7 @@ dap_string_t *l_reply_str; size_t l_tx_total; if ( !(l_reply_str = dap_string_new("")) ) /* Prepare output string discriptor*/ - return log_it(L_CRITICAL, "%s", g_error_memory_alloc), -ENOMEM; + return log_it(L_CRITICAL, "%s", c_error_memory_alloc), -ENOMEM; memset(&l_tx_first_hash, 0, sizeof(dap_chain_hash_fast_t)); /* Initial hash == zero */ @@ -2705,7 +2705,7 @@ dap_chain_net_srv_xchange_create_error_t dap_chain_net_srv_xchange_create(dap_ch // Create the price dap_chain_net_srv_xchange_price_t *l_price = DAP_NEW_Z(dap_chain_net_srv_xchange_price_t); if (!l_price) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return XCHANGE_CREATE_ERROR_MEMORY_ALLOCATED; } dap_stpcpy(l_price->token_sell, a_token_sell); diff --git a/modules/type/blocks/dap_chain_block.c b/modules/type/blocks/dap_chain_block.c index 304c1f1128..760f1b45fc 100644 --- a/modules/type/blocks/dap_chain_block.c +++ b/modules/type/blocks/dap_chain_block.c @@ -401,7 +401,7 @@ dap_chain_datum_t** dap_chain_block_get_datums(const dap_chain_block_t *a_block, dap_chain_datum_t * l_datum =(dap_chain_datum_t *) (a_block->meta_n_datum_n_sign + l_offset); dap_chain_datum_t **l_ret = DAP_NEW_Z_SIZE(dap_chain_datum_t *, sizeof(dap_chain_datum_t *) * a_block->hdr.datum_count); if (!l_ret) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } for(size_t n=0; n<a_block->hdr.datum_count && l_offset<(a_block_size-sizeof (a_block->hdr)) ; n++){ diff --git a/modules/type/blocks/dap_chain_block_cache.c b/modules/type/blocks/dap_chain_block_cache.c index ce599f2b09..b3e9a03166 100644 --- a/modules/type/blocks/dap_chain_block_cache.c +++ b/modules/type/blocks/dap_chain_block_cache.c @@ -61,12 +61,12 @@ dap_chain_block_cache_t *dap_chain_block_cache_new(dap_hash_fast_t *a_block_hash dap_chain_block_cache_t * l_block_cache = DAP_NEW_Z(dap_chain_block_cache_t); if (!l_block_cache) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } l_block_cache->block = a_copy_block ? DAP_DUP_SIZE(a_block, a_block_size) : a_block; if (!l_block_cache->block) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DEL_Z(l_block_cache); return NULL; } @@ -93,7 +93,7 @@ dap_chain_block_cache_t * dap_chain_block_cache_dup(dap_chain_block_cache_t * a_ { dap_chain_block_cache_t *l_ret = DAP_DUP(a_block); if (!l_ret) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } l_ret->hh = (UT_hash_handle){ }; // Drop hash handle to prevent its usage @@ -181,7 +181,7 @@ dap_list_t * dap_chain_block_get_list_tx_cond_outs_with_val(dap_ledger_t *a_ledg if (!dap_ledger_tx_hash_is_used_out_item (a_ledger, l_tx_hash, l_out_idx_tmp, NULL)) { dap_chain_tx_used_out_item_t *l_item = DAP_NEW_Z(dap_chain_tx_used_out_item_t); if (!l_item) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); if (l_list_used_out) dap_list_free_full(l_list_used_out, NULL); return NULL; diff --git a/modules/type/blocks/dap_chain_block_chunk.c b/modules/type/blocks/dap_chain_block_chunk.c index c29d1ec425..697a99523b 100644 --- a/modules/type/blocks/dap_chain_block_chunk.c +++ b/modules/type/blocks/dap_chain_block_chunk.c @@ -38,7 +38,7 @@ dap_chain_block_chunks_t * dap_chain_block_chunks_create(dap_chain_cs_blocks_t * assert(a_blocks->chain); dap_chain_block_chunks_t * l_ret = DAP_NEW_Z(dap_chain_block_chunks_t); if (!l_ret) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } l_ret->blocks = a_blocks; @@ -110,7 +110,7 @@ void dap_chain_block_chunks_add(dap_chain_block_chunks_t * a_chunks,dap_chain_bl // Init cache-hash object l_chunk_cache_hash = DAP_NEW_Z(dap_chain_block_cache_hash_t); if (!l_chunk_cache_hash) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } l_chunk_cache_hash->block_cache=a_block_cache; @@ -136,7 +136,7 @@ void dap_chain_block_chunks_add(dap_chain_block_chunks_t * a_chunks,dap_chain_bl // Init cache-hash object l_chunk_cache_hash = DAP_NEW_Z(dap_chain_block_cache_hash_t); if (!l_chunk_cache_hash) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } l_chunk_cache_hash->block_cache=a_block_cache; @@ -168,7 +168,7 @@ dap_chain_block_chunk_t * dap_chain_block_chunk_create(dap_chain_block_chunks_t { dap_chain_block_chunk_t * l_chunk = DAP_NEW_Z(dap_chain_block_chunk_t); if (!l_chunk) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } // Add in tail diff --git a/modules/type/blocks/dap_chain_cs_blocks.c b/modules/type/blocks/dap_chain_cs_blocks.c index 04e518cb29..977a85e400 100644 --- a/modules/type/blocks/dap_chain_cs_blocks.c +++ b/modules/type/blocks/dap_chain_cs_blocks.c @@ -256,7 +256,7 @@ static int s_chain_cs_blocks_new(dap_chain_t *a_chain, dap_config_t *a_chain_con { dap_chain_cs_blocks_t * l_cs_blocks = DAP_NEW_Z(dap_chain_cs_blocks_t); if (!l_cs_blocks) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } a_chain->_inheritor = l_cs_blocks; @@ -301,7 +301,7 @@ static int s_chain_cs_blocks_new(dap_chain_t *a_chain, dap_config_t *a_chain_con dap_chain_cs_blocks_pvt_t *l_cs_blocks_pvt = DAP_NEW_Z(dap_chain_cs_blocks_pvt_t); if (!l_cs_blocks_pvt) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } l_cs_blocks->_pvt = l_cs_blocks_pvt; @@ -335,7 +335,7 @@ static int s_chain_cs_blocks_new(dap_chain_t *a_chain, dap_config_t *a_chain_con for (uint16_t i = 0; i < l_list_len; i++) { struct cs_blocks_hal_item *l_hal_item = DAP_NEW_Z(struct cs_blocks_hal_item); if (!l_hal_item){ - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DEL_Z(l_cs_blocks_pvt); DAP_DELETE(l_cs_blocks); return -10; @@ -381,7 +381,7 @@ static char *s_blocks_decree_set_reward(dap_chain_net_t *a_net, dap_chain_t *a_c size_t l_decree_size = sizeof(dap_chain_datum_decree_t) + l_tsd_total_size; dap_chain_datum_decree_t *l_decree = DAP_NEW_Z_SIZE(dap_chain_datum_decree_t, l_decree_size); if (!l_decree) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } // Fill the header @@ -659,7 +659,7 @@ static int s_cli_blocks(int a_argc, char ** a_argv, void **a_str_reply) dap_chain_datum_t ** l_datums = DAP_NEW_Z_SIZE(dap_chain_datum_t*, sizeof(dap_chain_datum_t*)*l_datums_count); if (!l_datums) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_json_rpc_error_add(DAP_CHAIN_NODE_CLI_COM_BLOCK_MEMORY_ERR, "Out of memory in s_cli_blocks"); return DAP_CHAIN_NODE_CLI_COM_BLOCK_MEMORY_ERR; } @@ -1487,7 +1487,7 @@ static int s_add_atom_datums(dap_chain_cs_blocks_t *a_blocks, dap_chain_block_ca // Save datum hash -> block_hash link in hash table dap_chain_block_datum_index_t *l_datum_index = DAP_NEW_Z(dap_chain_block_datum_index_t); if (!l_datum_index) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return 1; } l_datum_index->ts_added = time(NULL); @@ -2044,7 +2044,7 @@ static dap_chain_atom_iter_t *s_callback_atom_iter_create(dap_chain_t *a_chain, { dap_chain_atom_iter_t * l_atom_iter = DAP_NEW_Z(dap_chain_atom_iter_t); if (!l_atom_iter) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } l_atom_iter->chain = a_chain; @@ -2154,7 +2154,7 @@ static dap_chain_datum_iter_t *s_chain_callback_datum_iter_create(dap_chain_t *a { dap_chain_datum_iter_t *l_ret = DAP_NEW_Z(dap_chain_datum_iter_t); if (!l_ret) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } l_ret->chain = a_chain; diff --git a/modules/type/dag/dap_chain_cs_dag.c b/modules/type/dag/dap_chain_cs_dag.c index 7480090f41..e8241b4e56 100644 --- a/modules/type/dag/dap_chain_cs_dag.c +++ b/modules/type/dag/dap_chain_cs_dag.c @@ -190,12 +190,12 @@ static int s_chain_cs_dag_new(dap_chain_t * a_chain, dap_config_t * a_chain_cfg) { dap_chain_cs_dag_t * l_dag = DAP_NEW_Z(dap_chain_cs_dag_t); if (!l_dag){ - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } l_dag->_pvt = DAP_NEW_Z(dap_chain_cs_dag_pvt_t); if (!l_dag->_pvt){ - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DELETE(l_dag); return -1; } @@ -262,7 +262,7 @@ static int s_chain_cs_dag_new(dap_chain_t * a_chain, dap_config_t * a_chain_cfg) for (uint16_t i = 0; i < l_list_len; i++) { dap_chain_cs_dag_hal_item_t *l_hal_item = DAP_NEW_Z(dap_chain_cs_dag_hal_item_t); if (!l_hal_item){ - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DEL_Z(l_dag->_pvt); DAP_DELETE(l_dag); return -1; @@ -302,7 +302,7 @@ static void s_dap_chain_cs_dag_threshold_free(dap_chain_cs_dag_t *a_dag) { if (l_current->ts_added < l_time_cut_off) { dap_chain_cs_dag_blocked_t *l_el = DAP_NEW(dap_chain_cs_dag_blocked_t); if (!l_el) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); pthread_mutex_unlock(&l_pvt->events_mutex); return; } @@ -498,7 +498,7 @@ static dap_chain_atom_verify_res_t s_chain_callback_atom_add(dap_chain_t * a_cha } if ( !(l_event_item = DAP_NEW_Z(dap_chain_cs_dag_event_item_t)) ) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); pthread_mutex_unlock(&PVT(l_dag)->events_mutex); return ATOM_REJECT; } @@ -904,7 +904,7 @@ void s_dag_events_lasts_process_new_last_event(dap_chain_cs_dag_t * a_dag, dap_c //add self dap_chain_cs_dag_event_item_t * l_event_last= DAP_NEW_Z(dap_chain_cs_dag_event_item_t); if (!l_event_last) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return; } l_event_last->ts_added = a_event_item->ts_added; @@ -1040,7 +1040,7 @@ static dap_chain_datum_t **s_chain_callback_atom_get_datum(dap_chain_atom_ptr_t dap_chain_datum_t **l_datums = DAP_NEW_Z(dap_chain_datum_t*); if (!l_datums) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } if (a_datums_count) @@ -1070,14 +1070,14 @@ static dap_chain_atom_ptr_t* s_chain_callback_atom_iter_get_links( dap_chain_ato dap_chain_atom_ptr_t * l_ret = DAP_NEW_Z_SIZE(dap_chain_atom_ptr_t, sizeof (dap_chain_atom_ptr_t) * l_event->header.hash_count ); if (!l_ret) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } if( a_links_size) *a_links_size = l_event->header.hash_count; *a_links_size_array = DAP_NEW_Z_SIZE(size_t, l_event->header.hash_count*sizeof (size_t)); if (!*a_links_size_array) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DEL_Z(l_ret); return NULL; } @@ -1120,7 +1120,7 @@ static dap_chain_atom_iter_t *s_chain_callback_atom_iter_create(dap_chain_t *a_c { dap_chain_atom_iter_t * l_atom_iter = DAP_NEW_Z(dap_chain_atom_iter_t); if (!l_atom_iter) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } l_atom_iter->chain = a_chain; @@ -1238,7 +1238,7 @@ static dap_chain_datum_iter_t *s_chain_callback_datum_iter_create(dap_chain_t *a { dap_chain_datum_iter_t *l_ret = DAP_NEW_Z(dap_chain_datum_iter_t); if (!l_ret) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } l_ret->chain = a_chain; diff --git a/modules/type/none/dap_chain_cs_none.c b/modules/type/none/dap_chain_cs_none.c index 008e321717..e6d7b4d14c 100644 --- a/modules/type/none/dap_chain_cs_none.c +++ b/modules/type/none/dap_chain_cs_none.c @@ -149,12 +149,12 @@ static int s_cs_callback_new(dap_chain_t *a_chain, dap_config_t UNUSED_ARG *a_ch { dap_nonconsensus_t *l_nochain = DAP_NEW_Z(dap_nonconsensus_t); if (!l_nochain) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -1; } dap_nonconsensus_private_t *l_nochain_priv = DAP_NEW_Z(dap_nonconsensus_private_t); if (!l_nochain_priv) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DELETE(l_nochain); return -2; } @@ -322,7 +322,7 @@ static dap_chain_atom_verify_res_t s_nonconsensus_callback_atom_add(dap_chain_t dap_nonconsensus_datum_hash_item_t * l_hash_item = DAP_NEW_Z(dap_nonconsensus_datum_hash_item_t); if (!l_hash_item) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return ATOM_REJECT; } size_t l_datum_size = dap_chain_datum_size(l_datum); @@ -379,7 +379,7 @@ static dap_chain_atom_iter_t* s_nonconsensus_callback_atom_iter_create(dap_chain { dap_chain_atom_iter_t * l_iter = DAP_NEW_Z(dap_chain_atom_iter_t); if (!l_iter) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } l_iter->chain = a_chain; @@ -508,7 +508,7 @@ static dap_chain_datum_t **s_nonconsensus_callback_atom_get_datum(dap_chain_atom if (l_datum){ dap_chain_datum_t **l_datums = DAP_NEW(dap_chain_datum_t *); if (!l_datums) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } if (a_datums_count) @@ -525,7 +525,7 @@ static dap_chain_datum_iter_t *s_nonconsensus_callback_datum_iter_create(dap_cha { dap_chain_datum_iter_t *l_ret = DAP_NEW_Z(dap_chain_datum_iter_t); if (!l_ret) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return NULL; } l_ret->chain = a_chain; diff --git a/modules/wallet/dap_chain_wallet.c b/modules/wallet/dap_chain_wallet.c index 95e5dcdb2a..12f8fd9ac1 100644 --- a/modules/wallet/dap_chain_wallet.c +++ b/modules/wallet/dap_chain_wallet.c @@ -134,7 +134,7 @@ char *c_wallets_path; { l_prec = DAP_NEW_Z(dap_chain_wallet_n_pass_t); /* Get memory for new record */ if (!l_prec) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); return -EINVAL; } *l_prec = l_rec; /* Fill it by data */ @@ -849,7 +849,7 @@ uint32_t l_csum = CRC32C_INIT, l_csum2 = CRC32C_INIT; l_wallet = DAP_NEW_Z(dap_chain_wallet_t); assert(l_wallet); if (!l_wallet) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); dap_fileclose(l_fh); if ( a_out_stat ) *a_out_stat = 9; @@ -859,7 +859,7 @@ uint32_t l_csum = CRC32C_INIT, l_csum2 = CRC32C_INIT; DAP_CHAIN_WALLET_INTERNAL_LOCAL_NEW(l_wallet); assert(l_wallet_internal); if (!l_wallet_internal) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DEL_Z(l_wallet); dap_fileclose(l_fh); if ( a_out_stat ) @@ -884,7 +884,7 @@ uint32_t l_csum = CRC32C_INIT, l_csum2 = CRC32C_INIT; l_wallet_internal->certs = DAP_NEW_Z_SIZE(dap_cert_t *, l_wallet_internal->certs_count * sizeof(dap_cert_t *)); assert(l_wallet_internal->certs); if (!l_wallet_internal->certs) { - log_it(L_CRITICAL, "%s", g_error_memory_alloc); + log_it(L_CRITICAL, "%s", c_error_memory_alloc); DAP_DEL_Z(l_wallet); dap_fileclose(l_fh); if ( a_out_stat ) -- GitLab