1
0
Fork 0
mirror of https://github.com/tailix/kernel.git synced 2024-12-11 11:35:39 -05:00

Improve code

This commit is contained in:
Alex Kotov 2020-11-26 16:56:28 +05:00
parent c0d7abc6c8
commit 562c5bbe03
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
2 changed files with 17 additions and 17 deletions

View file

@ -2,19 +2,6 @@
#include "stdlib.h"
static enum KernelMQ_Process_List_InitResult create_kernel_process(
struct KernelMQ_Process *process,
const struct KernelMQ_Info *kinfo
)
__attribute__((nonnull));
static enum KernelMQ_Process_List_InitResult create_module_process(
struct KernelMQ_Process *process,
const struct KernelMQ_Info *kinfo,
unsigned int module_index
)
__attribute__((nonnull));
enum KernelMQ_Process_List_InitResult KernelMQ_Process_List_init(
KernelMQ_Process_List *const process_list,
const struct KernelMQ_Info *const kinfo
@ -22,7 +9,7 @@ enum KernelMQ_Process_List_InitResult KernelMQ_Process_List_init(
kmemset(process_list, 0, sizeof(*process_list));
const enum KernelMQ_Process_List_InitResult create_kernel_process_result =
create_kernel_process(&(*process_list)[0], kinfo);
KernelMQ_Process_create_from_kernel(&(*process_list)[0], kinfo);
if (create_kernel_process_result != KERNELMQ_PROCESS_LIST_INIT_RESULT_OK) {
kmemset(process_list, 0, sizeof(*process_list));
@ -38,7 +25,7 @@ enum KernelMQ_Process_List_InitResult KernelMQ_Process_List_init(
for (unsigned int mod_index = 0; mod_index < modules_length; ++mod_index) {
const enum KernelMQ_Process_List_InitResult create_mod_process_result =
create_module_process(
KernelMQ_Process_create_from_module(
&(*process_list)[mod_index + 1],
kinfo,
mod_index
@ -53,7 +40,7 @@ enum KernelMQ_Process_List_InitResult KernelMQ_Process_List_init(
return KERNELMQ_PROCESS_LIST_INIT_RESULT_OK;
}
enum KernelMQ_Process_List_InitResult create_kernel_process(
enum KernelMQ_Process_List_InitResult KernelMQ_Process_create_from_kernel(
struct KernelMQ_Process *const process,
const struct KernelMQ_Info *const kinfo
) {
@ -93,7 +80,7 @@ enum KernelMQ_Process_List_InitResult create_kernel_process(
return KERNELMQ_PROCESS_LIST_INIT_RESULT_OK;
}
enum KernelMQ_Process_List_InitResult create_module_process(
enum KernelMQ_Process_List_InitResult KernelMQ_Process_create_from_module(
struct KernelMQ_Process *const process,
const struct KernelMQ_Info *const kinfo,
const unsigned int module_index

View file

@ -53,6 +53,19 @@ enum KernelMQ_Process_List_InitResult KernelMQ_Process_List_init(
)
__attribute__((nonnull));
enum KernelMQ_Process_List_InitResult KernelMQ_Process_create_from_kernel(
struct KernelMQ_Process *process,
const struct KernelMQ_Info *kinfo
)
__attribute__((nonnull));
enum KernelMQ_Process_List_InitResult KernelMQ_Process_create_from_module(
struct KernelMQ_Process *process,
const struct KernelMQ_Info *kinfo,
unsigned int module_index
)
__attribute__((nonnull));
#ifdef __cplusplus
}
#endif