Commit Graph

374 Commits (90232914cd2044ddc51b1515075f827c8e2e3f9b)

Author SHA1 Message Date
Dylan Baker 576ef1b949 pkg: prevent circular ownership
Otherwise in a case where A references B, and B references A, A and B
will have mutual ownership of each other and prevent each other from
being free'd.
2022-08-04 15:21:52 -07:00
Dylan Baker d3237407c4 queue: free unused dependencies when flattening 2022-08-04 15:21:52 -07:00
Dylan Baker 3bcf96dd01 dependency: zero list after freeing 2022-08-04 15:19:19 -07:00
Dylan Baker 1ac1cb51af dependency: add debug information for dependency refcounting 2022-08-04 15:19:19 -07:00
Dylan Baker c8933409aa pkg: add name of pkg being refed/unrefed to debug outpu 2022-08-04 15:19:19 -07:00
Dylan Baker f083d8d448 queue: when collecting dependents don't iterate private twice
Currently, the private field is iterated collecting private deps and
normal deps. It should only be iterated when collecting private deps.
2022-08-04 15:19:14 -07:00
Dylan Baker 7fe770bec7 pkg: use goto cleanup idiom 2022-08-04 15:19:05 -07:00
Dylan Baker 2133830c21 cache: clear the cache with pkgconf_cache_remove
Which results in more code re-use.
2022-08-04 15:19:05 -07:00
Dylan Baker 2b310c570f queue: when flattening do nothing if the flattened deps are empty 2022-08-04 15:19:05 -07:00
Dylan Baker 43d5328575 queue: unref dependency in all cases 2022-08-04 15:19:05 -07:00
Dylan Baker 04a3346b8e queue: ensure cleanup happens when applying 2022-08-04 15:19:05 -07:00
Dylan Baker 388bd61a61 dependency: Fix reference counting of dependency_addraw
We only want a reference to be added for the value inserted into the
list, not the one returned. The returned one is unowned until it reaches
the public dependency_add function, which returns an owned pointer
instead. This makes things semantically more correct.

Unfortunately, this means in a few cases we have to write some ugly
code like:
```c
pkgconf_dependency_t *dep = pkgcond_dependency_add("args");
pkgconf_dependency_unref(dep->owner, dep);
```
2022-08-04 15:19:05 -07:00
Dylan Baker e41e464152 cache: when removing a package from the cache unset the cached flag 2022-08-03 15:53:16 -07:00
Dylan Baker 01c3e6f8b5 cache: free the cache table when it is empty and set to NULL
We do the latter for the benefit of libpkgconf. This cleans up a
significant number of memory leaks in the cache handling.
2022-08-03 15:53:16 -07:00
Dylan Baker 96c61cbab0 libpkgconf: remove trailing ; from macro definition
GCC has a lovely bug (which I will report as soon as I have an account),
which causes -Wmisleading-indentation to miss cases of misleading
indentation after a `;;`, since the macro adds `;`, and in call cases
the caller also adds `;`, we end up with a double macro and gcc fails to
warn.
2022-08-03 12:03:15 -07:00
Ariadne Conill 6c70781aad introduce PKG_CONFIG_PKGCONF1_SYSROOT_RULES for legacy pkgconf behavior 2022-07-26 18:00:22 +00:00
Ariadne Conill f8aefea7ec pkg: add flags argument to pkgconf_pkg_new_from_file 2022-07-26 17:13:15 +00:00
Ariadne Conill 297e18f2c8 tuple: add flags parameter to pkgconf_tuple_parse 2022-07-26 17:08:48 +00:00
Ariadne Conill b0802cb3d1 Revert "pkgconf_pkg_parser_value_set(): fix code-path ordering bug."
ci/woodpecker/push/woodpecker Pipeline was successful Details
This reverts commit 13fe4c8c58.
2022-06-26 19:41:31 +00:00
Ariadne Conill 72e429ae70 tuple: use ${pc_sysrootdir} instead of client->sysroot_dir where relevant
ci/woodpecker/push/woodpecker Pipeline was successful Details
2022-06-26 19:35:19 +00:00
Ariadne Conill a61193c723 pkg: fix sysroot_dir logic for github 213
ci/woodpecker/push/woodpecker Pipeline was successful Details
2022-06-26 19:16:00 +00:00
Ariadne Conill d68a867dc0 tuple: fall back to using globals rather than preferring them 2022-06-26 19:15:07 +00:00
Ariadne Conill fdd7d192e0 queue: fix ISO C conformance for fallthrough label
ci/woodpecker/push/woodpecker Pipeline failed Details
2022-06-26 18:39:00 +00:00
Ariadne Conill a1a415111f queue: handle pkgconf_pkg_verify_dependency failure while flattening
ci/woodpecker/push/woodpecker Pipeline failed Details
2022-06-26 18:09:22 +00:00
Ariadne Conill 9bc6d80e61 queue: push new unresolved dependencies to the front of the queue, rather than the tail 2022-06-26 18:06:04 +00:00
Ariadne Conill fe4db3aad9 queue: skip dependency collection for root node 2022-06-26 18:04:42 +00:00
Ariadne Conill 5a82a259ac queue: use maxdepth after flattening
ci/woodpecker/push/woodpecker Pipeline failed Details
2022-06-26 15:17:08 +00:00
Ariadne Conill a416dc1fd6 queue: advance client serial when walking requires.private for flattening 2022-06-26 15:16:36 +00:00
Ariadne Conill 197fcadd4c queue: add flattening code 2022-06-26 15:02:37 +00:00
Ariadne Conill 5817e8848f pkg: track the number of hits a package has gotten while solving for dependencies
ci/woodpecker/push/woodpecker Pipeline failed Details
2022-06-26 07:22:56 +00:00
Ariadne Conill 6ae17bd0ef pkg: split pkgconf_pkg_traverse into a serial-modifying version 2022-06-26 06:05:40 +00:00
Ariadne Conill ffa0805d58 cache: use pkgconf_reallocarray stub
ci/woodpecker/push/woodpecker Pipeline was successful Details
2022-06-26 04:38:02 +00:00
Ariadne Conill c1579d381c bsdstubs: add pkgconf_reallocarray 2022-06-26 04:37:18 +00:00
Ariadne Conill 4c76f6bf01 meson: check for reallocarray
ci/woodpecker/push/woodpecker Pipeline was successful Details
it is needed for the new cache code
2022-06-26 04:33:47 +00:00
Ariadne Conill 464672404e cache: refactor to use a continguous table and bsearch
ci/woodpecker/push/woodpecker Pipeline was successful Details
cache functions are the hottest part of the pkgconf code when
profiled, by removing the linked list for lookups, we can turn
lookups into an O(k) operation
2022-06-26 04:30:35 +00:00
Dylan Baker c0fa7879b2 libpkgconf: zero path lists after freeing
ci/woodpecker/push/woodpecker Pipeline was successful Details
This is required to make the pointer safely re-usable after being freed,
otherwise the list still says that it has nodes, but they point nowhere.
This is particularly important for libpkgconf, if a caller needs to
re-enter the library after freeing a path in a static path (such as the
default personality)
2022-06-26 03:12:34 +00:00
Dylan Baker 2d201af326 libpkgconf: Add a helper to zero `pkgconf_list_t`s 2022-06-26 03:12:34 +00:00
Ariadne Conill cf48b61a59 stdinc: include strings.h on POSIX 2022-02-21 04:42:26 -06:00
Ariadne Conill 0995e49977
Merge branch 'master' into readme-meson 2022-02-21 04:27:11 -06:00
Ariadne Conill a45dbccc01
Merge pull request #242 from data-man/dirent_latest
Update dirent.h to latest
2022-02-21 04:25:36 -06:00
Ariadne Conill c6cfca6730
Merge pull request #245 from dcbaker/submit/remove-const
libpkgconf: remove const modifier from error_handler data pointer
2022-02-21 04:25:26 -06:00
Dylan Baker c581e24a67 personality: use an unsigned to track initializations
Instead of a bool. The latter will result in de-initing leaving the
library unable to init again, which works out for the cli, but is
problematic for other consumers (meson++ and muon).

v2: - Add docs that the functions are not thread safe
2022-02-14 21:22:05 -08:00
Dylan Baker f5d6bb71f8 libpkgconf: remove const modifier from error_handler data pointer
Currently, the data pointer is `const void *`, which means that the
handler can't modify the data without casting away the constness.
2022-02-07 09:34:09 -08:00
data-man b132ce8317 Update dirent.h to latest 2022-01-08 10:55:28 +05:00
Andrea Pappacoda 6109e06089
docs: mention Meson instead of CMake for Win build
Fixes #233
2021-12-11 14:49:19 +01:00
Ariadne Conill 2b82a4f63e use a serial instead of PKGCONF_PKG_PROPF_SEEN 2021-10-07 00:27:32 -06:00
Ariadne Conill 7d8cc1e4ce dependency: add pkgconf_dependency_copy() 2021-10-06 13:13:34 -06:00
Ariadne Conill c547edd07f deconst the client on pkgconf_dependency_add() 2021-10-06 11:52:18 -06:00
Ariadne Conill 4144d506bb implement dependency refcounting 2021-10-06 11:48:37 -06:00
Ariadne Conill 8130dd159e dependency: add pkgconf_dependency_free_one 2021-10-06 11:29:18 -06:00