diff --git a/libpkgconf/client.c b/libpkgconf/client.c index 503aa43..5fb3ce4 100644 --- a/libpkgconf/client.c +++ b/libpkgconf/client.c @@ -33,6 +33,12 @@ pkgconf_client_new(pkgconf_error_handler_func_t error_handler) void pkgconf_client_deinit(pkgconf_client_t *client) { + if (client->sysroot_dir != NULL) + free(client->sysroot_dir); + + if (client->buildroot_dir != NULL) + free(client->buildroot_dir); + pkgconf_tuple_free_global(client); pkgconf_path_free(&client->dir_list); pkgconf_cache_free(client); @@ -44,3 +50,33 @@ pkgconf_client_free(pkgconf_client_t *client) pkgconf_client_deinit(client); free(client); } + +const char * +pkgconf_client_get_sysroot_dir(const pkgconf_client_t *client) +{ + return client->sysroot_dir; +} + +void +pkgconf_client_set_sysroot_dir(pkgconf_client_t *client, const char *sysroot_dir) +{ + if (client->sysroot_dir != NULL) + free(client->sysroot_dir); + + client->sysroot_dir = sysroot_dir != NULL ? strdup(sysroot_dir) : NULL; +} + +const char * +pkgconf_client_get_buildroot_dir(const pkgconf_client_t *client) +{ + return client->buildroot_dir; +} + +void +pkgconf_client_set_buildroot_dir(pkgconf_client_t *client, const char *buildroot_dir) +{ + if (client->buildroot_dir != NULL) + free(client->buildroot_dir); + + client->buildroot_dir = buildroot_dir != NULL ? strdup(buildroot_dir) : NULL; +} diff --git a/libpkgconf/libpkgconf.h b/libpkgconf/libpkgconf.h index 57e59e2..3bb8c6a 100644 --- a/libpkgconf/libpkgconf.h +++ b/libpkgconf/libpkgconf.h @@ -147,6 +147,9 @@ struct pkgconf_client_ { pkgconf_error_handler_func_t error_handler; FILE *auditf; + + char *sysroot_dir; + char *buildroot_dir; }; /* client.c */ @@ -154,6 +157,10 @@ void pkgconf_client_init(pkgconf_client_t *client, pkgconf_error_handler_func_t pkgconf_client_t *pkgconf_client_new(pkgconf_error_handler_func_t error_handler); void pkgconf_client_deinit(pkgconf_client_t *client); void pkgconf_client_free(pkgconf_client_t *client); +const char *pkgconf_client_get_sysroot_dir(const pkgconf_client_t *client); +void pkgconf_client_set_sysroot_dir(pkgconf_client_t *client, const char *sysroot_dir); +const char *pkgconf_client_get_buildroot_dir(const pkgconf_client_t *client); +void pkgconf_client_set_buildroot_dir(pkgconf_client_t *client, const char *buildroot_dir); #define PKGCONF_IS_MODULE_SEPARATOR(c) ((c) == ',' || isspace ((unsigned int)(c))) #define PKGCONF_IS_OPERATOR_CHAR(c) ((c) == '<' || (c) == '>' || (c) == '!' || (c) == '=')