From 2093b2a61ede75f4f6d1e8f289422585d583d54b Mon Sep 17 00:00:00 2001 From: Chalith Desaman Date: Fri, 25 Jun 2021 14:19:54 +0530 Subject: [PATCH] C contract library changes. (#327) --- examples/c_contract/hotpocket_contract.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/c_contract/hotpocket_contract.h b/examples/c_contract/hotpocket_contract.h index e652b23f..74dcbd7d 100644 --- a/examples/c_contract/hotpocket_contract.h +++ b/examples/c_contract/hotpocket_contract.h @@ -10,6 +10,7 @@ #include #include #include "json.h" +#include // Private constants. #define __HP_MMAP_BLOCK_SIZE 4096 @@ -277,6 +278,7 @@ int hp_deinit_contract() // Send termination control message. __hp_write_control_msg("{\"type\":\"contract_end\"}", 23); close(__hpc.control_fd); + return 0; } const struct hp_contract_context *hp_get_context() @@ -546,7 +548,7 @@ int hp_update_config(const struct hp_config *config) */ void hp_set_config_string(char **config_str, const char *value, const size_t value_size) { - *config_str = realloc(*config_str, value_size); + *config_str = (char *)realloc(*config_str, value_size); strncpy(*config_str, value, value_size); } @@ -559,7 +561,7 @@ void hp_set_config_string(char **config_str, const char *value, const size_t val void hp_set_config_unl(struct hp_config *config, const struct hp_unl_node *new_unl, const size_t new_unl_count) { const size_t mem_size = sizeof(struct hp_unl_node) * new_unl_count; - config->unl.list = realloc(config->unl.list, mem_size); + config->unl.list = (struct hp_unl_node *)realloc(config->unl.list, mem_size); memcpy(config->unl.list, new_unl, mem_size); config->unl.count = new_unl_count; }