libpkgconf dependency module

The dependency module provides support for building dependency lists (the basic component of the overall dependency graph) and dependency nodes which store dependency information.

pkgconf_dependency_t *pkgconf_dependency_add(pkgconf_list_t *list, const char *package, const char *version, pkgconf_pkg_comparator_t compare)

Adds a parsed dependency to a dependency list as a dependency node.

Parameters:
  • client (pkgconf_client_t*) – The client object that owns the package this dependency list belongs to.
  • list (pkgconf_list_t*) – The dependency list to add a dependency node to.
  • package (char*) – The package atom to set on the dependency node.
  • version (char*) – The package version to set on the dependency node.
  • compare (pkgconf_pkg_comparator_t) – The comparison operator to set on the dependency node.
  • flags (uint) – Any flags to attach to the dependency node.
Returns:

A dependency node.

Return type:

pkgconf_dependency_t *

void pkgconf_dependency_append(pkgconf_list_t *list, pkgconf_dependency_t *tail)

Adds a dependency node to a pre-existing dependency list.

Parameters:
  • list (pkgconf_list_t*) – The dependency list to add a dependency node to.
  • tail (pkgconf_dependency_t*) – The dependency node to add to the tail of the dependency list.
Returns:

nothing

void pkgconf_dependency_free_one(pkgconf_dependency_t *dep)

Frees a dependency node.

Parameters:
  • dep (pkgconf_dependency_t*) – The dependency node to free.
Returns:

nothing

pkgconf_dependency_t *pkgconf_dependency_ref(pkgconf_client_t *owner, pkgconf_dependency_t *dep)

Increases a dependency node’s refcount.

Parameters:
  • owner (pkgconf_client_t*) – The client object which owns the memory of this dependency node.
  • dep (pkgconf_dependency_t*) – The dependency to increase the refcount of.
Returns:

the dependency node on success, else NULL

void pkgconf_dependency_unref(pkgconf_client_t *owner, pkgconf_dependency_t *dep)

Decreases a dependency node’s refcount and frees it if necessary.

Parameters:
  • owner (pkgconf_client_t*) – The client object which owns the memory of this dependency node.
  • dep (pkgconf_dependency_t*) – The dependency to decrease the refcount of.
Returns:

nothing

void pkgconf_dependency_free(pkgconf_list_t *list)

Release a dependency list and it’s child dependency nodes.

Parameters:
  • list (pkgconf_list_t*) – The dependency list to release.
Returns:

nothing

void pkgconf_dependency_parse_str(pkgconf_list_t *deplist_head, const char *depends)

Parse a dependency declaration into a dependency list. Commas are counted as whitespace to allow for constructs such as @SUBSTVAR@, zlib being processed into , zlib.

Parameters:
  • client (pkgconf_client_t*) – The client object that owns the package this dependency list belongs to.
  • deplist_head (pkgconf_list_t*) – The dependency list to populate with dependency nodes.
  • depends (char*) – The dependency data to parse.
  • flags (uint) – Any flags to attach to the dependency nodes.
Returns:

nothing

void pkgconf_dependency_parse(const pkgconf_client_t *client, pkgconf_pkg_t *pkg, pkgconf_list_t *deplist, const char *depends)

Preprocess dependency data and then process that dependency declaration into a dependency list. Commas are counted as whitespace to allow for constructs such as @SUBSTVAR@, zlib being processed into , zlib.

Parameters:
  • client (pkgconf_client_t*) – The client object that owns the package this dependency list belongs to.
  • pkg (pkgconf_pkg_t*) – The package object that owns this dependency list.
  • deplist (pkgconf_list_t*) – The dependency list to populate with dependency nodes.
  • depends (char*) – The dependency data to parse.
  • flags (uint) – Any flags to attach to the dependency nodes.
Returns:

nothing

pkgconf_dependency_t *pkgconf_dependency_copy(pkgconf_client_t *client, const pkgconf_dependency_t *dep)

Copies a dependency node to a new one.

Parameters:
  • client (pkgconf_client_t*) – The client object that will own this dependency.
  • dep (pkgconf_dependency_t*) – The dependency node to copy.
Returns:

a pointer to a new dependency node, else NULL