aboutsummaryrefslogtreecommitdiff
path: root/src/resources.c
diff options
context:
space:
mode:
authorJan Sucan <jan@jansucan.com>2021-05-02 10:19:23 +0200
committerJan Sucan <jan@jansucan.com>2021-05-02 10:20:29 +0200
commit02ffe0ed4113e7b479197d0ba1b160e6280b4099 (patch)
treec7a3573039ba02983eec38267d61d86e1965bbab /src/resources.c
parent36a92af6ee3c20c93835a34ddeb148c34ccf023c (diff)
Move the source files to a src directory
Diffstat (limited to 'src/resources.c')
-rw-r--r--src/resources.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/resources.c b/src/resources.c
new file mode 100644
index 0000000..3eebd1c
--- /dev/null
+++ b/src/resources.c
@@ -0,0 +1,44 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "resources.h"
+
+void
+resources_init(resources_t *const res)
+{
+ res->in_file = NULL;
+ res->ref_file = NULL;
+ res->out_file = NULL;
+ res->in_buffer = NULL;
+ res->ref_buffer = NULL;
+ res->out_buffer = NULL;
+}
+
+void
+resources_free(resources_t *const res)
+{
+ if (res->in_file != NULL) {
+ fclose(res->in_file);
+ res->in_file = NULL;
+ }
+ if (res->ref_file != NULL) {
+ fclose(res->ref_file);
+ res->ref_file = NULL;
+ }
+ if (res->out_file != NULL) {
+ fclose(res->out_file);
+ res->out_file = NULL;
+ }
+ if (res->in_buffer != NULL) {
+ free(res->in_buffer);
+ res->in_buffer = NULL;
+ }
+ if (res->ref_buffer != NULL) {
+ free(res->ref_buffer);
+ res->ref_buffer = NULL;
+ }
+ if (res->out_buffer != NULL) {
+ free(res->out_buffer);
+ res->out_buffer = NULL;
+ }
+}