blob: 6a3fa0901362a53969f524f2467b332566f9066e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/* See LICENSE file for copyright and license details. */
#include "common.h"
#ifndef TEST
int
liblog_destroy_context(struct liblog_context *ctx)
{
int ret = 0;
if (!ctx)
return 0;
while (ctx->noutputs)
ret |= liblog_destroy_output(&ctx->outputs[--ctx->noutputs]);
free(ctx->outputs);
ctx->outputs = NULL;
if (ctx->internal_state) {
free(ctx->internal_state->msg.prefix);
free(ctx->internal_state->msg.text);
free(ctx->internal_state);
ctx->internal_state = NULL;
}
return ret;
}
#else
int
main(void)
{
struct liblog_context ctx;
char *nullenv[] = {NULL};
environ = nullenv;
ASSERT_ZERO(liblog_destroy_context(NULL));
ASSERT_ZERO(liblog_init_context(&ctx));
ASSERT_ZERO(liblog_destroy_context(&ctx));
return 0;
}
#endif
|