2016-12-01 21:31:09 +00:00
|
|
|
/*
|
|
|
|
* client.c
|
|
|
|
* libpkgconf consumer lifecycle management
|
|
|
|
*
|
|
|
|
* Copyright (c) 2016 pkgconf authors (see AUTHORS).
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* This software is provided 'as is' and without any warranty, express or
|
|
|
|
* implied. In no event shall the authors be liable for any damages arising
|
|
|
|
* from the use of this software.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <libpkgconf/libpkgconf.h>
|
|
|
|
|
|
|
|
void
|
|
|
|
pkgconf_client_init(pkgconf_client_t *client, pkgconf_error_handler_func_t error_handler)
|
|
|
|
{
|
|
|
|
client->error_handler = error_handler;
|
2016-12-02 06:34:48 +00:00
|
|
|
client->auditf = NULL;
|
2016-12-01 21:31:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pkgconf_client_t *
|
|
|
|
pkgconf_client_new(pkgconf_error_handler_func_t error_handler)
|
|
|
|
{
|
|
|
|
pkgconf_client_t *out = calloc(sizeof(pkgconf_client_t), 1);
|
|
|
|
pkgconf_client_init(out, error_handler);
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
pkgconf_client_deinit(pkgconf_client_t *client)
|
|
|
|
{
|
2016-12-10 02:41:39 +00:00
|
|
|
if (client->sysroot_dir != NULL)
|
|
|
|
free(client->sysroot_dir);
|
|
|
|
|
|
|
|
if (client->buildroot_dir != NULL)
|
|
|
|
free(client->buildroot_dir);
|
|
|
|
|
2016-12-01 21:31:09 +00:00
|
|
|
pkgconf_tuple_free_global(client);
|
2016-12-02 06:04:43 +00:00
|
|
|
pkgconf_path_free(&client->dir_list);
|
2016-12-02 06:48:26 +00:00
|
|
|
pkgconf_cache_free(client);
|
2016-12-01 21:31:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
pkgconf_client_free(pkgconf_client_t *client)
|
|
|
|
{
|
|
|
|
pkgconf_client_deinit(client);
|
|
|
|
free(client);
|
|
|
|
}
|
2016-12-10 02:41:39 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|