rename xxx_create() / xxx_destory() -> xxx_new() / xxx_free()

This commit is contained in:
luwenpeng
2024-03-08 14:20:36 +08:00
parent 9d562ffee6
commit c945931620
56 changed files with 330 additions and 330 deletions

View File

@@ -207,14 +207,14 @@ static int thread_context_init(struct stellar_context *ctx, uint8_t nr_threads)
threads_ctx->need_exit = 0;
threads_ctx->is_runing = 0;
threads_ctx->sess_mgr = session_manager_create(sess_mgr_cfg);
threads_ctx->sess_mgr = session_manager_new(sess_mgr_cfg);
if (threads_ctx->sess_mgr == NULL)
{
STELLAR_LOG_ERROR("unable to create session manager");
return -1;
}
threads_ctx->ip_mgr = ip_reassembly_create(ip_reass_cfg);
threads_ctx->ip_mgr = ip_reassembly_new(ip_reass_cfg);
if (threads_ctx->ip_mgr == NULL)
{
STELLAR_LOG_ERROR("unable to create ip reassemble manager");
@@ -233,13 +233,13 @@ static void thread_context_free(struct stellar_context *ctx, uint8_t nr_threads)
if (ATOMIC_READ(&threads_ctx->is_runing) == 0)
{
STELLAR_LOG_STATE("wait worker thread %d free context", i);
session_manager_destroy(threads_ctx->sess_mgr);
ip_reassembly_destory(threads_ctx->ip_mgr);
session_manager_free(threads_ctx->sess_mgr);
ip_reassembly_free(threads_ctx->ip_mgr);
}
}
}
static int thread_create(struct thread_context threads_ctx[], uint8_t nr_threads)
static int thread_new(struct thread_context threads_ctx[], uint8_t nr_threads)
{
for (uint8_t i = 0; i < nr_threads; i++)
{
@@ -254,7 +254,7 @@ static int thread_create(struct thread_context threads_ctx[], uint8_t nr_threads
return 0;
}
static void thread_destroy(struct thread_context threads_ctx[], uint8_t nr_threads)
static void thread_free(struct thread_context threads_ctx[], uint8_t nr_threads)
{
for (uint8_t i = 0; i < nr_threads; i++)
{
@@ -307,7 +307,7 @@ int main(int argc, char **argv)
// TODO load plugin
uint8_t nr_threads = pkt_io_cfg->nr_threads;
stellar_ctx->packet_io = packet_io_create(pkt_io_cfg);
stellar_ctx->packet_io = packet_io_new(pkt_io_cfg);
if (stellar_ctx->packet_io == NULL)
{
STELLAR_LOG_ERROR("unable to create packet io");
@@ -320,7 +320,7 @@ int main(int argc, char **argv)
goto error_out;
}
if (thread_create(stellar_ctx->threads_ctx, nr_threads) != 0)
if (thread_new(stellar_ctx->threads_ctx, nr_threads) != 0)
{
STELLAR_LOG_ERROR("unable to create worker thread");
goto error_out;
@@ -333,9 +333,9 @@ int main(int argc, char **argv)
}
error_out:
thread_destroy(stellar_ctx->threads_ctx, nr_threads);
thread_free(stellar_ctx->threads_ctx, nr_threads);
thread_context_free(stellar_ctx, nr_threads);
packet_io_destroy(stellar_ctx->packet_io);
packet_io_free(stellar_ctx->packet_io);
// TODO free plugin