chore: de-dunder module_database

main
Sean McBride 5 years ago
parent a70a83326c
commit 0bd22a2e9c

@ -3,11 +3,11 @@
#include <module.h>
struct module *module_database__find_by_name(char *name);
struct module *module_database__find_by_socket_descriptor(int socket_descriptor);
struct module *module_database_find_by_name(char *name);
struct module *module_database_find_by_socket_descriptor(int socket_descriptor);
extern struct module *module_database[];
extern int module_database__free_offset;
extern int module_database_free_offset;
/**
* Adds a module to the in-memory module DB
@ -16,12 +16,12 @@ extern int module_database__free_offset;
* @return 0 on success. Aborts program on failure
**/
static inline int
module_database__add(struct module *module)
module_database_add(struct module *module)
{
assert(module->socket_descriptor == -1);
// __sync_fetch_and_add is provided by GCC
int f = __sync_fetch_and_add(&module_database__free_offset, 1);
int f = __sync_fetch_and_add(&module_database_free_offset, 1);
assert(f < MODULE__MAX_MODULE_COUNT);
module_database[f] = module;

@ -160,7 +160,7 @@ module_new(char *name, char *path, i32 argument_count, u32 stack_size, u32 max_m
module_indirect_table = cache_tbl;
// Add the module to the in-memory module DB
module_database__add(module);
module_database_add(module);
// Start listening for requests
module_initialize_as_server(module);

@ -8,7 +8,7 @@
// In-memory representation of all active modules
struct module *module_database[MODULE__MAX_MODULE_COUNT] = { NULL };
// First free in module
int module_database__free_offset = 0;
int module_database_free_offset = 0;
/**
* Given a name, find the associated module
@ -16,9 +16,9 @@ int module_database__free_offset = 0;
* @return module or NULL if no match found
**/
struct module *
module_database__find_by_name(char *name)
module_database_find_by_name(char *name)
{
int f = module_database__free_offset;
int f = module_database_free_offset;
for (int i = 0; i < f; i++) {
assert(module_database[i]);
if (strcmp(module_database[i]->name, name) == 0) return module_database[i];
@ -32,9 +32,9 @@ module_database__find_by_name(char *name)
* @return module or NULL if no match found
**/
struct module *
module_database__find_by_socket_descriptor(int socket_descriptor)
module_database_find_by_socket_descriptor(int socket_descriptor)
{
int f = module_database__free_offset;
int f = module_database_free_offset;
for (int i = 0; i < f; i++) {
assert(module_database[i]);
if (module_database[i]->socket_descriptor == socket_descriptor) return module_database[i];

Loading…
Cancel
Save