2 * Copyright Timo Hirvonen
15 /* we need stat information for symlink targets */
17 /* stat() information. ie. for the symlink target */
22 int dir_open(struct directory
*dir
, const char *name
);
23 void dir_close(struct directory
*dir
);
24 const char *dir_read(struct directory
*dir
);
28 /* allocated with malloc(). contains pointers */
34 /* ptr_array.ptrs is either char ** or struct dir_entry ** */
40 #define PTR_ARRAY(name) struct ptr_array name = { NULL, 0, 0 }
42 void ptr_array_add(struct ptr_array
*array
, void *ptr
);
44 static inline void ptr_array_plug(struct ptr_array
*array
)
46 ptr_array_add(array
, NULL
);
50 static inline void ptr_array_sort(struct ptr_array
*array
,
51 int (*cmp
)(const void *a
, const void *b
))
53 int count
= array
->count
;
55 qsort(array
->ptrs
, count
, sizeof(void *), cmp
);