When uniquifying properties, also sort them on the owning package.
This ensures that whenever two packages provide or (or require, obsolete
or conflict) the same property, they appear in the same order in the
propertys list of packages.
1 #ifndef _RAZOR_INTERNAL_H_
2 #define _RAZOR_INTERNAL_H_
7 void *zalloc(size_t size);
14 void array_init(struct array *array);
15 void array_release(struct array *array);
16 void *array_add(struct array *array, int size);
20 uint32_t list_ptr : 24;
29 void list_set_empty(struct list_head *head);
30 void list_set_ptr(struct list_head *head, uint32_t ptr);
31 void list_set_array(struct list_head *head, struct array *pool, struct array *items, int force_indirect);
33 struct list *list_first(struct list_head *head, struct array *pool);
34 struct list *list_next(struct list *list);
36 void list_remap_pool(struct array *pool, uint32_t *map);
37 void list_remap_head(struct list_head *list, uint32_t *map);
45 void hashtable_init(struct hashtable *table, struct array *pool);
46 void hashtable_release(struct hashtable *table);
47 uint32_t hashtable_insert(struct hashtable *table, const char *key);
48 uint32_t hashtable_lookup(struct hashtable *table, const char *key);
49 uint32_t hashtable_tokenize(struct hashtable *table, const char *string);
52 struct razor_set_section {
58 struct razor_set_header {
61 struct razor_set_section sections[0];
64 #define RAZOR_MAGIC 0x7a7a7a7a
65 #define RAZOR_VERSION 1
67 #define RAZOR_STRING_POOL 0
68 #define RAZOR_PACKAGES 1
69 #define RAZOR_PROPERTIES 2
71 #define RAZOR_PACKAGE_POOL 4
72 #define RAZOR_PROPERTY_POOL 5
73 #define RAZOR_FILE_POOL 6
75 struct razor_package {
80 struct list_head properties;
81 struct list_head files;
84 struct razor_property {
88 struct list_head packages;
95 struct list_head packages;
98 #define RAZOR_ENTRY_LAST 0x80
101 struct array string_pool;
102 struct array packages;
103 struct array properties;
105 struct array package_pool;
106 struct array property_pool;
107 struct array file_pool;
108 struct razor_set_header *header;
111 struct import_entry {
116 struct import_directory {
117 uint32_t name, count;
119 struct array packages;
120 struct import_directory *last;
123 struct razor_importer {
124 struct razor_set *set;
125 struct hashtable table;
126 struct razor_package *package;
127 struct array properties;
129 struct array file_requires;
132 struct razor_package_iterator {
133 struct razor_set *set;
134 struct razor_package *package, *end;
140 razor_package_iterator_init_for_property(struct razor_package_iterator *pi,
141 struct razor_set *set,
142 struct razor_property *property);
144 struct razor_property_iterator {
145 struct razor_set *set;
146 struct razor_property *property, *end;
150 #define ALIGN(value, base) (((value) + (base - 1)) & ~((base) - 1))
153 razor_set_find_entry(struct razor_set *set,
154 struct razor_entry *dir, const char *pattern);
156 struct razor_merger *
157 razor_merger_create(struct razor_set *set1, struct razor_set *set2);
159 razor_merger_add_package(struct razor_merger *merger,
160 struct razor_package *package);
162 razor_merger_finish(struct razor_merger *merger);
164 /* Utility functions */
166 int razor_create_dir(const char *root, const char *path);
167 int razor_write(int fd, const void *data, size_t size);
170 typedef int (*razor_compare_with_data_func_t)(const void *p1,
174 razor_qsort_with_data(void *base, size_t nelem, size_t size,
175 razor_compare_with_data_func_t compare, void *data);
177 #endif /* _RAZOR_INTERNAL_H_ */