Lines Matching full:client
32 * A cache is tied to a specific pkgconf client object, so package objects should not
61 cache_dump(const pkgconf_client_t *client) in cache_dump() argument
65 PKGCONF_TRACE(client, "dumping package cache contents"); in cache_dump()
67 for (i = 0; i < client->cache_count; i++) in cache_dump()
69 const pkgconf_pkg_t *pkg = client->cache_table[i]; in cache_dump()
71 PKGCONF_TRACE(client, SIZE_FMT_SPECIFIER": %p(%s)", in cache_dump()
79 …* .. c:function:: pkgconf_pkg_t *pkgconf_cache_lookup(const pkgconf_client_t *client, const char *…
85 * :param pkgconf_client_t* client: The client object to access.
86 * :param char* id: The package atom to look up in the client object's cache.
91 pkgconf_cache_lookup(pkgconf_client_t *client, const char *id) in pkgconf_cache_lookup() argument
93 if (client->cache_table == NULL) in pkgconf_cache_lookup()
98 pkg = bsearch(id, client->cache_table, in pkgconf_cache_lookup()
99 client->cache_count, sizeof (void *), in pkgconf_cache_lookup()
104 PKGCONF_TRACE(client, "found: %s @%p", id, *pkg); in pkgconf_cache_lookup()
105 return pkgconf_pkg_ref(client, *pkg); in pkgconf_cache_lookup()
108 PKGCONF_TRACE(client, "miss: %s", id); in pkgconf_cache_lookup()
115 * .. c:function:: void pkgconf_cache_add(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
120 * :param pkgconf_client_t* client: The client object to modify.
121 * :param pkgconf_pkg_t* pkg: The package object to add to the client object's cache.
125 pkgconf_cache_add(pkgconf_client_t *client, pkgconf_pkg_t *pkg) in pkgconf_cache_add() argument
130 pkgconf_pkg_ref(client, pkg); in pkgconf_cache_add()
137 ++client->cache_count; in pkgconf_cache_add()
138 new_table = pkgconf_reallocarray(client->cache_table, in pkgconf_cache_add()
139 client->cache_count, sizeof (void *)); in pkgconf_cache_add()
144 --client->cache_count; in pkgconf_cache_add()
146 pkgconf_pkg_unref(client, pkg); in pkgconf_cache_add()
150 client->cache_table = new_table; in pkgconf_cache_add()
151 client->cache_table[client->cache_count - 1] = pkg; in pkgconf_cache_add()
153 qsort(client->cache_table, client->cache_count, in pkgconf_cache_add()
156 PKGCONF_TRACE(client, "added @%p to cache", pkg); in pkgconf_cache_add()
162 * .. c:function:: void pkgconf_cache_remove(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
164 * Deletes a package from the client object's package cache.
166 * :param pkgconf_client_t* client: The client object to modify.
167 * :param pkgconf_pkg_t* pkg: The package object to remove from the client object's cache.
171 pkgconf_cache_remove(pkgconf_client_t *client, pkgconf_pkg_t *pkg) in pkgconf_cache_remove() argument
173 if (client->cache_table == NULL) in pkgconf_cache_remove()
182 PKGCONF_TRACE(client, "removed @%p from cache", pkg); in pkgconf_cache_remove()
186 slot = bsearch(pkg->id, client->cache_table, in pkgconf_cache_remove()
187 client->cache_count, sizeof (void *), in pkgconf_cache_remove()
194 pkgconf_pkg_unref(client, *slot); in pkgconf_cache_remove()
197 qsort(client->cache_table, client->cache_count, in pkgconf_cache_remove()
200 if (client->cache_table[client->cache_count - 1] != NULL) in pkgconf_cache_remove()
202 PKGCONF_TRACE(client, "end of cache table refers to %p, not NULL", in pkgconf_cache_remove()
203 client->cache_table[client->cache_count - 1]); in pkgconf_cache_remove()
204 cache_dump(client); in pkgconf_cache_remove()
208 client->cache_count--; in pkgconf_cache_remove()
209 if (client->cache_count > 0) in pkgconf_cache_remove()
211 pkgconf_pkg_t **new_table = pkgconf_reallocarray(client->cache_table, in pkgconf_cache_remove()
212 client->cache_count, sizeof(void *)); in pkgconf_cache_remove()
215 client->cache_table = new_table; in pkgconf_cache_remove()
219 free(client->cache_table); in pkgconf_cache_remove()
220 client->cache_table = NULL; in pkgconf_cache_remove()
227 * .. c:function:: void pkgconf_cache_free(pkgconf_client_t *client)
229 * Releases all resources related to a client object's package cache.
230 * This function should only be called to clear a client object's package cache,
233 * :param pkgconf_client_t* client: The client object to modify.
236 pkgconf_cache_free(pkgconf_client_t *client) in pkgconf_cache_free() argument
238 if (client->cache_table == NULL) in pkgconf_cache_free()
241 while (client->cache_count > 0) in pkgconf_cache_free()
242 pkgconf_cache_remove(client, client->cache_table[0]); in pkgconf_cache_free()
244 free(client->cache_table); in pkgconf_cache_free()
245 client->cache_table = NULL; in pkgconf_cache_free()
246 client->cache_count = 0; in pkgconf_cache_free()
248 PKGCONF_TRACE(client, "cleared package cache"); in pkgconf_cache_free()