summaryrefslogtreecommitdiff
path: root/src/includes
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-04-23 20:53:24 +0000
committerRoy Marples <roy@marples.name>2009-04-23 20:53:24 +0000
commit69534746553adb52d3ede38a4cf8cd3630c97091 (patch)
tree42eac1299075058628aff4cc28711d1eaa064cec /src/includes
parentd231a2f0d95e3ba7d2228fad4d5cda612ef755a9 (diff)
downloadopenrc-69534746553adb52d3ede38a4cf8cd3630c97091.tar.gz
openrc-69534746553adb52d3ede38a4cf8cd3630c97091.tar.bz2
openrc-69534746553adb52d3ede38a4cf8cd3630c97091.tar.xz
Style
Diffstat (limited to 'src/includes')
-rw-r--r--src/includes/rc-misc.h40
1 files changed, 26 insertions, 14 deletions
diff --git a/src/includes/rc-misc.h b/src/includes/rc-misc.h
index 4244715..fc0a6f2 100644
--- a/src/includes/rc-misc.h
+++ b/src/includes/rc-misc.h
@@ -1,7 +1,7 @@
/*
- rc-misc.h
- This is private to us and not for user consumption
- */
+ rc-misc.h
+ This is private to us and not for user consumption
+*/
/*
* Copyright 2007-2009 Roy Marples <roy@marples.name>
@@ -68,20 +68,20 @@
/* Some libc implemntations don't have these */
#ifndef TAILQ_CONCAT
-#define TAILQ_CONCAT(head1, head2, field) do { \
- if (!TAILQ_EMPTY(head2)) { \
- *(head1)->tqh_last = (head2)->tqh_first; \
- (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
- (head1)->tqh_last = (head2)->tqh_last; \
- TAILQ_INIT((head2)); \
- } \
-} while (0)
+#define TAILQ_CONCAT(head1, head2, field) do { \
+ if (!TAILQ_EMPTY(head2)) { \
+ *(head1)->tqh_last = (head2)->tqh_first; \
+ (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
+ (head1)->tqh_last = (head2)->tqh_last; \
+ TAILQ_INIT((head2)); \
+ } \
+ } while (0)
#endif
#ifndef TAILQ_FOREACH_SAFE
-#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
- for ((var) = TAILQ_FIRST((head)); \
- (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
+#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
+ for ((var) = TAILQ_FIRST((head)); \
+ (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
(var) = (tvar))
#endif
@@ -91,6 +91,18 @@
# endif
#endif
+#ifndef timespecsub
+#define timespecsub(tsp, usp, vsp) \
+ do { \
+ (vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \
+ (vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \
+ if ((vsp)->tv_nsec < 0) { \
+ (vsp)->tv_sec--; \
+ (vsp)->tv_nsec += 1000000000L; \
+ } \
+ } while (/* CONSTCOND */ 0)
+#endif
+
_unused static void *xmalloc (size_t size)
{
void *value = malloc(size);