summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--watch_list.c18
-rw-r--r--watch_list.h2
2 files changed, 10 insertions, 10 deletions
diff --git a/watch_list.c b/watch_list.c
index 81b850f..4339b85 100644
--- a/watch_list.c
+++ b/watch_list.c
@@ -42,8 +42,8 @@ void watch_list_clear(watch_list_t* list)
watch_list_element_t* tmp;
tmp = list->first_;
list->first_ = tmp->next_;
- if(tmp->string_)
- free(tmp->string_);
+ if(tmp->path_)
+ free(tmp->path_);
free(tmp);
}
}
@@ -60,8 +60,8 @@ int watch_list_add(watch_list_t* list, int watch_fd, const char* string)
list->first_->next_ = 0;
list->first_->watch_fd_ = watch_fd;
- list->first_->string_ = strdup(string);
- if(!list->first_->string_) {
+ list->first_->path_ = strdup(string);
+ if(!list->first_->path_) {
free(list->first_);
list->first_ = NULL;
return -2;
@@ -78,8 +78,8 @@ int watch_list_add(watch_list_t* list, int watch_fd, const char* string)
tmp->next_->next_ = 0;
tmp->next_->watch_fd_ = watch_fd;
- tmp->next_->string_ = strdup(string);
- if(!tmp->next_->string_) {
+ tmp->next_->path_ = strdup(string);
+ if(!tmp->next_->path_) {
free(list->first_);
list->first_ = NULL;
return -2;
@@ -110,8 +110,8 @@ int watch_list_find_fd(watch_list_t* list, const char* path)
watch_list_element_t* tmp = list->first_;
while(tmp) {
- if(tmp->path && !strcmp(path, tmp->path))
- return tmp->path_;
+ if(tmp->path_ && !strcmp(path, tmp->path_))
+ return tmp->watch_fd_;
tmp = tmp->next_;
}
@@ -125,7 +125,7 @@ void watch_list_print(watch_list_t* list, const char* head, const char* sep, con
watch_list_element_t* tmp = list->first_;
while(tmp) {
- printf("%s%d%s%s%s", head, tmp->watch_fd_, sep, tmp->string_, tail);
+ printf("%s%d%s%s%s", head, tmp->watch_fd_, sep, tmp->path_, tail);
tmp = tmp->next_;
}
}
diff --git a/watch_list.h b/watch_list.h
index 931b656..5a695e6 100644
--- a/watch_list.h
+++ b/watch_list.h
@@ -23,7 +23,7 @@
#define RHDROPBOX_watch_list_h_INCLUDED
struct watch_list_element_struct {
- char* string_;
+ char* path_;
int watch_fd_;
struct watch_list_element_struct* next_;
};