Archived
1
0
Fork 0

inotify-map: inotify_map_get_path: return a list of struct watch* instead of char **

This commit is contained in:
Henrik Hautakoski 2011-02-20 10:05:06 +01:00
parent 658bc8b9ad
commit ab91625700
4 changed files with 29 additions and 33 deletions

View file

@ -12,7 +12,6 @@
#include <string.h>
#include "xalloc.h"
#include "rbtree.h"
#include "list.h"
#include "path.h"
#include "inotify-watch.h"
#include "inotify-map.h"
@ -192,23 +191,12 @@ int inotify_map_get_wd(const char *path) {
return 0;
}
char** inotify_map_get_path(int wd) {
struct list* inotify_map_get_path(int wd) {
char **out = NULL;
struct list *list;
list = wd_lookup(wd);
if (list && list->nr) {
int i;
out = xmalloc(list->nr + 1);
for(i=0; i < list->nr; i++) {
struct watch *w = list->items[i];
out[i] = (char *)w->path;
}
out[list->nr] = NULL;
}
return out;
struct list *list = wd_lookup(wd);
if (list)
return list_copy(list);
return NULL;
}
int inotify_map_isempty() {