aboutsummaryrefslogtreecommitdiffstats
path: root/libexec_destroy_document.c
blob: aee6298966cab3fef3cbab293d47c07d5670c2ab (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
/* See LICENSE file for copyright and license details. */
#include "common.h"
#ifndef TEST


int
libexec_destroy_document(struct libexec_document *doc)
{
	int ret = 0;

	if (!doc)
		return 0;

	free(doc->text);
	doc->text = NULL;
	doc->length = 0;
	doc->offset = 0;
	if (doc->fd >= 0) {
		ret = close(doc->fd);
		doc->fd = -1;
	}
	return ret;
}


#else
LIBEXEC_CONST__ int main(void) {return 0;} /* TODO test */
#endif