diff --git a/src/inotify-map.c b/src/inotify-map.c index 968065b..bf6c1dd 100644 --- a/src/inotify-map.c +++ b/src/inotify-map.c @@ -192,7 +192,7 @@ int inotify_map_get_wd(const char *path) { return 0; } -char** inotify_map_lookup(int wd) { +char** inotify_map_get_path(int wd) { char **out = NULL; struct list *list; @@ -215,7 +215,7 @@ char** inotify_map_lookup_by_path(const char *path) { int wd = inotify_map_get_wd(path); if (wd) - return inotify_map_lookup(wd); + return inotify_map_get_path(wd); return NULL; } diff --git a/src/inotify-map.h b/src/inotify-map.h index ad333ac..a136444 100644 --- a/src/inotify-map.h +++ b/src/inotify-map.h @@ -21,7 +21,7 @@ void inotify_unmap_all(); int inotify_map_get_wd(const char *path); -char** inotify_map_lookup(int wd); +char** inotify_map_get_path(int wd); char** inotify_map_lookup_by_path(const char *path); diff --git a/src/inotify.c b/src/inotify.c index 2d95abf..f23bd2c 100644 --- a/src/inotify.c +++ b/src/inotify.c @@ -143,7 +143,7 @@ static void proc_event(inoev *iev) { } /* lookup the watch descriptor in rbtree */ - paths = inotify_map_lookup(iev->wd); + paths = inotify_map_get_path(iev->wd); if (!paths) { logmsg(LOG_WARN, "-- IGNORING EVENT -- invalid watchdescriptor %i", iev->wd); diff --git a/test/t_inotify-map.c b/test/t_inotify-map.c index edfedb7..5a94e8b 100644 --- a/test/t_inotify-map.c +++ b/test/t_inotify-map.c @@ -97,30 +97,16 @@ void test_inotify_map_get_wd() { teardown(); } -void test_inotify_map_lookup() { +void test_inotify_map_get_path() { int i; setup(); for(i=0; i < 4; i++) - validate_list(i, inotify_map_lookup(wdref[i])); + validate_list(i, inotify_map_get_path(wdref[i])); - assert(inotify_map_lookup(25) == NULL); - - teardown(); -} - -void test_inotify_map_lookup_by_path() { - - int i; - - setup(); - - for(i=0; i < 4; i++) - validate_list(i, inotify_map_lookup_by_path(pathref[i])); - - assert(inotify_map_lookup_by_path("do not exist") == NULL); + assert(inotify_map_get_path(25) == NULL); teardown(); } @@ -131,8 +117,7 @@ int main() { test_inotify_unmap_wd(); test_inotify_unmap_all(); test_inotify_map_get_wd(); - test_inotify_map_lookup(); - test_inotify_map_lookup_by_path(); + test_inotify_map_get_path(); return 0; }