cmake: Allow override of install directories
[project/uci.git] / uci.h
diff --git a/uci.h b/uci.h
index eea730378dd97c900b52b9f971ee5b4955f2933e..b385e2be964fc4a891833ede584fba6c8fa208cb 100644 (file)
--- a/uci.h
+++ b/uci.h
@@ -34,6 +34,7 @@ extern "C" {
 #include <setjmp.h>
 #include <stdio.h>
 #include <stdint.h>
+#include <stddef.h>
 
 #define UCI_CONFDIR "/etc/config"
 #define UCI_SAVEDIR "/tmp/.uci"
@@ -370,7 +371,7 @@ enum uci_option_type {
 enum uci_flags {
        UCI_FLAG_STRICT =        (1 << 0), /* strict mode for the parser */
        UCI_FLAG_PERROR =        (1 << 1), /* print parser error messages */
-       UCI_FLAG_EXPORT_NAME =   (1 << 2), /* when exporting, name unnamed sections [unused] */
+       UCI_FLAG_EXPORT_NAME =   (1 << 2), /* when exporting, name unnamed sections */
        UCI_FLAG_SAVED_DELTA = (1 << 3), /* store the saved delta in memory as well */
 };
 
@@ -435,7 +436,6 @@ struct uci_package
        struct uci_backend *backend;
        void *priv;
        int n_section;
-       int name_index;
        struct uci_list delta;
        struct uci_list saved_delta;
 };
@@ -510,11 +510,6 @@ struct uci_parse_option {
 };
 
 
-/* linked list handling */
-#ifndef offsetof
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
-
 /**
  * container_of - cast a member of a structure out to the containing structure
  * @ptr:    the pointer to the member.
@@ -690,6 +685,15 @@ uci_lookup_option_string(struct uci_context *ctx, struct uci_section *s, const c
        return o->v.string;
 }
 
+#ifndef BITS_PER_LONG
+#define BITS_PER_LONG (8 * sizeof(unsigned long))
+#endif
+
+static inline void uci_bitfield_set(unsigned long *bits, int bit)
+{
+       bits[bit / BITS_PER_LONG] |= (1UL << (bit % BITS_PER_LONG));
+}
+
 #ifdef __cplusplus
 }
 #endif