/* Adds any events that should occur given a read from the specified * filename. * * This destroys the contents of filename. */ static void add_events(char* filename) { #ifdef DEBUG add_one_event(event_print, filename); #endif if (parent_dir(filename)) { if (!hs_test(directories_read, filename)) { add_one_event(event_read_siblings, filename); hs_put(directories_read, filename); } do { if (!hs_test(directories_traversed, filename)) { add_one_event(event_iterate_directory, filename); hs_put(directories_traversed, filename); } } while (parent_dir(filename)); } }
static struct _upnode* get_node(struct upTree* ut, long long key) { struct _upnode** out = (struct _upnode**) hs_get(ut->hs, key); if(out == NULL) { struct _upnode* new_node = malloc(sizeof(struct _upnode)); new_node->i = key; new_node->up = NULL; hs_put(ut->hs, key, new_node); out = (struct _upnode**) hs_get(ut->hs, key); assert(*out != NULL); } return *out; }