Skip to content

Commit

Permalink
Replace homegrown linked list implementation with queue(3) macroses.
Browse files Browse the repository at this point in the history
While here combine filename and inode number into common structure named
dep_item to reduce memory required for shallow list copy

Structures introduced in this commit have following meaning:
 * dep-list - dependency list head
 * dep-node - linked list node refering to next node and item itself (file)
 * dep-item - dependency list item payload
  • Loading branch information
wulf7 committed Jan 29, 2015
1 parent 6c30885 commit 632734b
Show file tree
Hide file tree
Showing 6 changed files with 286 additions and 200 deletions.
19 changes: 19 additions & 0 deletions compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,27 @@

#include "config.h"

#ifdef BUILD_LIBRARY
#include <sys/types.h>
#include <sys/queue.h>
#endif /* BUILD_LIBRARY */
#include <pthread.h>

#ifdef BUILD_LIBRARY
#ifndef SLIST_FOREACH_SAFE
#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
for ((var) = SLIST_FIRST((head)); \
(var) && ((tvar) = SLIST_NEXT((var), field), 1); \
(var) = (tvar))
#endif
#ifndef SLIST_REMOVE_AFTER
#define SLIST_REMOVE_AFTER(elm, field) do { \
SLIST_NEXT(elm, field) = \
SLIST_NEXT(SLIST_NEXT(elm, field), field); \
} while (0)
#endif
#endif /* BUILD_LIBRARY */

#ifndef HAVE_PTHREAD_BARRIER
typedef struct {
int count; /* the number of threads to wait on a barrier */
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ AC_CHECK_HEADERS([sys/event.h],
[
AC_CHECK_FUNCS(kqueue,,AC_MSG_ERROR(No kqueue detected in your system!))
AC_CHECK_FUNCS(kevent,,AC_MSG_ERROR(No kevent detected in your system!))
AC_DEFINE([BUILD_LIBRARY],[1],[Define to 1 if libinotify is built])
kqueue_support=yes
],
[
Expand Down
Loading

0 comments on commit 632734b

Please sign in to comment.