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

@@ -21,32 +21,35 @@
* memory inside the file watcher struct.
*/
typedef struct {
const char *pathname; // Pathname given with the `hi_file_watcher_add` call.
const char *pathname; // Pathname given to a `hi_file_watcher_add` call.
// Do not free.
HiFileWatchType type;
} hiFileEvent;
FileWatchType type;
} FileEvent;
typedef struct FileWatcher FileWatcher;
struct hiFileWatcher;
/**
* FileEvents is a thread safe list of events.
*
* It is implemented as a stack, so the events will be popped
* in reverse chronological order.
* */
struct hiFileEvents;
typedef struct FileEvents FileEvents;
/**
* Create watcher and necessary data to run it.
*
* Will start the watcher thread immediately.
*/
struct hiFileWatcher *hi_file_watcher_create(void);
FileWatcher *hi_file_watcher_create(void);
/**
* Destroy a previously created file watcher context.
*
* Will join the thread and destroy event stack.
*/
void hi_file_watcher_destroy(struct hiFileWatcher *context);
void hi_file_watcher_destroy(FileWatcher *context);
/**
* Add a file to the watch list of a file watcher.
*
@@ -54,18 +57,18 @@ void hi_file_watcher_destroy(struct hiFileWatcher *context);
* @param pathname Absolute path to the file or directory
* @param flags The events that will be watched for
*/
HiloadResult hi_file_watcher_add(struct hiFileWatcher *context,
HiResult hi_file_watcher_add(FileWatcher *context,
const char *pathname, u32 flags);
/**
* Can be used to poke file watcher thread to make sure it empties
* events before doing something, e.g. for shutting it down.
*/
void hi_file_watcher_notify(struct hiFileWatcher *context);
void hi_file_watcher_notify(FileWatcher *context);
/**
* Pop an event from event stack. Call `hi_file_event_destroy` when done with
* it.
*/
hiFileEvent hi_file_event_pop(struct hiFileWatcher *ctx);
FileEvent hi_file_event_pop(FileWatcher *ctx);
#endif // HI_FILEWATCHER_H_