Type and naming cleanup

Do not use Hi prefic for things that shouldn't be visible to outside code
This commit is contained in:
2025-05-02 00:15:51 +03:00
parent 3baa45c32e
commit 5539596929
21 changed files with 263 additions and 242 deletions

View File

@@ -1,7 +1,10 @@
#ifndef HILOAD_H_
#define HILOAD_H_
#include "types.h"
#include "hitypes.h"
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
@@ -10,30 +13,26 @@ extern "C" {
#pragma GCC visibility push(default)
/**
* Initialiez the module. Must be called before anything else
* Must be called before other functions. Sets up filewatchers for the relevant
* files
* @n n Number of modules in @a enabled_modules
* @param enabled_modules The name of a module that should have its changes
* applied to the running process. A short form is expected, e.g.
* `libhiload.so`. An empty string denotes the executable of the running
* process.
*/
int hi_init(unsigned n, const char **enabled_modules);
int hi_init(size_t n, const char **enabled_modules);
/**
* Frees memory and cleans up
* Frees allocated memory. Call when hiload is no longer used.
*/
void hi_deinit(void);
/**
* Print a random assortment of information from current state
* Reload all enabled modules that have been changed since init or last
* invocation and apply changes to the running process.
*/
void hi_print_loaded_modules(void);
/**
* Reload shared library if it has changed since last reload or init was called
*/
HiloadResult hi_reload_solib(const char *module_name);
/**
* Reload all watched modules
*/
HiloadResult hi_reload();
HiResult hi_reload(void);
#pragma GCC visibility pop

9
include/hitypes.h Normal file
View File

@@ -0,0 +1,9 @@
#ifndef HITYPES_H_
#define HITYPES_H_
typedef enum { HI_FAIL = 0, HI_OK } HiResult;
#define HIOK(res) ((res) == HI_OK)
#endif // HITYPES_H_