aboutsummaryrefslogblamecommitdiffstats
path: root/libexec_destroy_document.c
blob: aee6298966cab3fef3cbab293d47c07d5670c2ab (plain) (tree)



























                                                          
/* 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