From b7984a795c5599e2094183c3e8bcb2a5f4886705 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Thu, 1 Dec 2016 15:31:09 -0600 Subject: [PATCH] libpkgconf: commit missing client.c --- libpkgconf/client.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 libpkgconf/client.c diff --git a/libpkgconf/client.c b/libpkgconf/client.c new file mode 100644 index 0000000..7220bc4 --- /dev/null +++ b/libpkgconf/client.c @@ -0,0 +1,43 @@ +/* + * 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 + +void +pkgconf_client_init(pkgconf_client_t *client, pkgconf_error_handler_func_t error_handler) +{ + client->error_handler = error_handler; +} + +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) +{ + pkgconf_tuple_free_global(client); +} + +void +pkgconf_client_free(pkgconf_client_t *client) +{ + pkgconf_client_deinit(client); + free(client); +}