summaryrefslogtreecommitdiffstats
path: root/src/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h43
1 files changed, 0 insertions, 43 deletions
diff --git a/src/utils.h b/src/utils.h
index b5cab3f..ce3b2e0 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -43,49 +43,6 @@ void fdlist_add(struct fdlist *list, enum fdowner owner, int fd, short events);
43void fdlist_free(struct fdlist *list); 43void fdlist_free(struct fdlist *list);
44void fdlist_reset(struct fdlist *list); 44void fdlist_reset(struct fdlist *list);
45 45
46struct collection {
47 void **list;
48 int capacity;
49};
50
51void collection_init(struct collection *col);
52void collection_add(struct collection *col, void *element);
53void collection_remove(struct collection *col, void *element);
54int collection_count(struct collection *col);
55void collection_free(struct collection *col);
56void collection_copy(struct collection *dest, struct collection *src);
57
58#define MERGE_(a,b) a ## _ ## b
59#define LABEL_(a,b) MERGE_(a, b)
60#define UNIQUE_VAR(a) LABEL_(a, __LINE__)
61
62#define FOREACH(var, col) \
63 do { \
64 int UNIQUE_VAR(_iter); \
65 for(UNIQUE_VAR(_iter)=0; UNIQUE_VAR(_iter)<(col)->capacity; UNIQUE_VAR(_iter)++) { \
66 if(!(col)->list[UNIQUE_VAR(_iter)]) continue; \
67 var = (col)->list[UNIQUE_VAR(_iter)];
68
69#define ENDFOREACH \
70 } \
71 } while(0);
72
73#ifndef HAVE_STPCPY
74char *stpcpy(char * s1, const char * s2);
75#endif
76char *string_concat(const char *str, ...);
77
78int buffer_read_from_filename(const char *filename, char **buffer, uint64_t *length);
79int buffer_write_to_filename(const char *filename, const char *buffer, uint64_t length);
80
81enum plist_format_t {
82 PLIST_FORMAT_XML,
83 PLIST_FORMAT_BINARY
84};
85
86int plist_read_from_filename(plist_t *plist, const char *filename);
87int plist_write_to_filename(plist_t plist, const char *filename, enum plist_format_t format);
88
89uint64_t mstime64(void); 46uint64_t mstime64(void);
90void get_tick_count(struct timeval * tv); 47void get_tick_count(struct timeval * tv);
91 48