enable warnings and cleanup
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "types.h"
|
||||
#include "array/array.h"
|
||||
#include "common.h"
|
||||
#include "logger/logger.h"
|
||||
@@ -66,14 +67,6 @@ static hiFileEvent create_file_event(const struct inotify_event *event) {
|
||||
return hievent;
|
||||
}
|
||||
|
||||
static hiFileEvent copy_file_event(const hiFileEvent *event) {
|
||||
hiFileEvent cpy = *event;
|
||||
// Copy the file string, so this can be destroyed without destroying the
|
||||
// original
|
||||
cpy.file = strdup(event->file);
|
||||
return cpy;
|
||||
}
|
||||
|
||||
void hi_file_event_free(hiFileEvent *event) {
|
||||
if (event) {
|
||||
free((void *)event->file);
|
||||
@@ -108,7 +101,7 @@ static HiloadResult file_events_init(hiFileEvents *events) {
|
||||
|
||||
static void file_events_destroy(hiFileEvents *events) {
|
||||
if (events) {
|
||||
for (int i = 0; i < sc_array_size(&events->events); ++i) {
|
||||
for (size_t i = 0; i < sc_array_size(&events->events); ++i) {
|
||||
hi_file_event_free(&sc_array_at(&events->events, i));
|
||||
}
|
||||
sc_array_term(&events->events);
|
||||
@@ -170,7 +163,7 @@ static HiloadResult watch_path_remove(hiWatchPaths *paths, const char *path) {
|
||||
|
||||
bool found = false;
|
||||
{
|
||||
for (int i = 0; i < sc_array_size(&paths->watches); ++i) {
|
||||
for (size_t i = 0; i < sc_array_size(&paths->watches); ++i) {
|
||||
WatchPath *wp = &sc_array_at(&paths->watches, i);
|
||||
if (strcmp(wp->path, path) == 0) {
|
||||
watch_path_destroy(paths->fd, wp);
|
||||
@@ -196,7 +189,7 @@ static HiloadResult watch_paths_init(hiWatchPaths *paths) {
|
||||
|
||||
static void watch_paths_destroy(hiWatchPaths *paths) {
|
||||
if (paths) {
|
||||
for (int i = 0; i < sc_array_size(&paths->watches); i++) {
|
||||
for (size_t i = 0; i < sc_array_size(&paths->watches); i++) {
|
||||
WatchPath *wp = &sc_array_at(&paths->watches, i);
|
||||
watch_path_destroy(paths->fd, wp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user