diff options
author | Blue Swirl <blauwirbel@gmail.com> | 2009-09-12 07:36:22 +0000 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2009-09-12 07:36:22 +0000 |
commit | 72cf2d4f0e181d0d3a3122e04129c58a95da713e (patch) | |
tree | 4d13c505a692104406090e94dd654fd1e98ec34e /envlist.c | |
parent | 620150dc9c1827cdddfa64a0fada7af5f7ee405b (diff) |
Fix sys-queue.h conflict for good
Problem: Our file sys-queue.h is a copy of the BSD file, but there are
some additions and it's not entirely compatible. Because of that, there have
been conflicts with system headers on BSD systems. Some hacks have been
introduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896,
f40d753718c72693c5f520f0d9899f6e50395e94,
96555a96d724016e13190b28cffa3bc929ac60dc and
3990d09adf4463eca200ad964cc55643c33feb50 but the fixes were fragile.
Solution: Avoid the conflict entirely by renaming the functions and the
file. Revert the previous hacks.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'envlist.c')
-rw-r--r-- | envlist.c | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -1,20 +1,19 @@ -#include <sys/queue.h> - #include <assert.h> #include <errno.h> #include <stdlib.h> #include <string.h> #include <unistd.h> +#include "qemu-queue.h" #include "envlist.h" struct envlist_entry { const char *ev_var; /* actual env value */ - LIST_ENTRY(envlist_entry) ev_link; + QLIST_ENTRY(envlist_entry) ev_link; }; struct envlist { - LIST_HEAD(, envlist_entry) el_entries; /* actual entries */ + QLIST_HEAD(, envlist_entry) el_entries; /* actual entries */ size_t el_count; /* number of entries */ }; @@ -33,7 +32,7 @@ envlist_create(void) if ((envlist = malloc(sizeof (*envlist))) == NULL) return (NULL); - LIST_INIT(&envlist->el_entries); + QLIST_INIT(&envlist->el_entries); envlist->el_count = 0; return (envlist); @@ -51,7 +50,7 @@ envlist_free(envlist_t *envlist) while (envlist->el_entries.lh_first != NULL) { entry = envlist->el_entries.lh_first; - LIST_REMOVE(entry, ev_link); + QLIST_REMOVE(entry, ev_link); free((char *)entry->ev_var); free(entry); @@ -159,7 +158,7 @@ envlist_setenv(envlist_t *envlist, const char *env) } if (entry != NULL) { - LIST_REMOVE(entry, ev_link); + QLIST_REMOVE(entry, ev_link); free((char *)entry->ev_var); free(entry); } else { @@ -172,7 +171,7 @@ envlist_setenv(envlist_t *envlist, const char *env) free(entry); return (errno); } - LIST_INSERT_HEAD(&envlist->el_entries, entry, ev_link); + QLIST_INSERT_HEAD(&envlist->el_entries, entry, ev_link); return (0); } @@ -205,7 +204,7 @@ envlist_unsetenv(envlist_t *envlist, const char *env) break; } if (entry != NULL) { - LIST_REMOVE(entry, ev_link); + QLIST_REMOVE(entry, ev_link); free((char *)entry->ev_var); free(entry); |