aboutsummaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-01-22 14:58:07 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-01-22 14:58:07 +0100
commitb0def51bf3ad5c176e05e9e93fb5b303c9b0d6ee (patch)
tree2c1658de6ef4055395a565fce62aa583d297b85b /parse.c
parentMakefile now places .o files in subdir. (diff)
downloadcalp-b0def51bf3ad5c176e05e9e93fb5b303c9b0d6ee.tar.gz
calp-b0def51bf3ad5c176e05e9e93fb5b303c9b0d6ee.tar.xz
Clean up a number of comments, and remove TODO's.
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c35
1 files changed, 11 insertions, 24 deletions
diff --git a/parse.c b/parse.c
index 66d35a15..2850a51c 100644
--- a/parse.c
+++ b/parse.c
@@ -1,19 +1,10 @@
#include "parse.h"
-#include "macro.h"
-
-
-/*
- * TODO currently not all pointers inside strbufs are reset correctly,
- * leading to old garbage data being read way to much.
- *
- * A better ERR macro would solve most problems,
- * along with the introduction of a MSG macro.
- */
-
#include <errno.h>
#include <string.h>
+#include "macro.h"
+
int parse_file(FILE* f, vcalendar* cal) {
int segments = 1;
SNEW(strbuf, str, segments * SEGSIZE);
@@ -26,7 +17,6 @@ int parse_file(FILE* f, vcalendar* cal) {
int line = 0;
- // TODO these are never freed.
NEW(vevent, ev);
SNEW(content_line, cline, keylen, vallen);
@@ -47,24 +37,21 @@ int parse_file(FILE* f, vcalendar* cal) {
if (s[0] != '\n') { ERR("expected newline after CR", line); }
else if (s[1] == ' ' || s[1] == '\t') {
- /*
- * Folded line, increase size of key and continue.
- */
+ /* Folded line, increase size of key and continue. */
- // TODO check return value
- // TODO segments is always incremented here, meaning
- // that segment grows larger for every multi line
- // encountered.
- if (strbuf_realloc(&str, ++segments * SEGSIZE) != 0) { /* TODO signal error */
+ /* TODO segments is always incremented here, meaning
+ * that segment grows larger for every multi line
+ * encountered.
+ */
+ if (strbuf_realloc(&str, ++segments * SEGSIZE) != 0) {
ERR("Failed to realloc strbuf", line);
exit (1);
}
continue;
} else {
- /*
- * Actuall end of line, handle values.
- */
- if (ungetc(s[1], f) != s[1]) { /* TODO signal error */
+ /* Actuall end of line, handle values. */
+ if (ungetc(s[1], f) != s[1]) {
+ ERR("Failed to put character back on FILE", line);
exit (2);
}