agendafs

A filesystem for your calendar.

git clone git://mccd.space/agendafs
commit 6f6775e865f06ed44a1e95db7c135a13f57020b1
parent 1f5ab87ac09db1a857f5df0a22c2b7130b305092
Author: Marc Coquand <marc@coquand.email>
Date:   Mon, 14 Jul 2025 15:54:31 +0200

Assert no EOF

Probably at some point it might be worth handling checks for OOM
centrally.

It is not impossible for it to happen with a filesystem afterall.

Diffstat:
Mjournal_entry.c | 21+++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/journal_entry.c b/journal_entry.c
@@ -656,17 +656,14 @@ static int
 append_category_to_memstream(FILE *memstream, const char *category,
 			     bool is_first_category)
 {
+	int res = 0;
 	if (!is_first_category) {
-		if (fputs(",", memstream) == EOF) {
-			LOG("FPUTS FAILED");
-			return -1;
-		}
+		res = fputs(",", memstream);
+		assert(res != EOF);
 	}
 
-	if (fputs(category, memstream) == EOF) {
-		LOG("FPUTS FAILED");
-		return -1;
-	}
+	res = fputs(category, memstream);
+	assert(res != EOF);
 	return 0; // Success
 }
 
@@ -693,12 +690,8 @@ get_node_categories(const struct tree_node *node)
 	bool first_category = true;
 	while (catp) {
 		const char *category = icalproperty_get_categories(catp);
-		if (append_category_to_memstream(memstream, category,
-						 first_category) == -1) {
-			fclose(memstream);
-			free(result_buffer);
-			return NULL;
-		}
+		append_category_to_memstream(memstream, category,
+					     first_category);
 		catp = icalcomponent_get_next_property(
 		    inner, ICAL_CATEGORIES_PROPERTY);