# HG changeset patch
# User Paper <paper@paper.us.eu.org>
# Date 1712191731 14400
# Node ID 41b74137e2015671499ee8981e69763ca3a90bb6
# Parent  0cc2555db371178716cdb0d2f2ec059c24d5d9a2
include: make header guards sane

double underscores are reserved to the implementation by
the C standard

diff -r 0cc2555db371 -r 41b74137e201 include/datatypes.h
--- a/include/datatypes.h	Wed Mar 27 13:38:30 2024 -0400
+++ b/include/datatypes.h	Wed Apr 03 20:48:51 2024 -0400
@@ -1,5 +1,5 @@
-#ifndef __edl__internal__datatypes_h
-#define __edl__internal__datatypes_h
+#ifndef EDL_INTERNAL_DATATYPES_H_
+#define EDL_INTERNAL_DATATYPES_H_
 
 #include <stddef.h>
 #include "edl.h" /* EDL_media_type_t */
@@ -16,4 +16,4 @@
 int EDL_internal_append_bool_to_string(EDL_internal_string* str, bool value);
 int EDL_internal_append_media_type_to_string(EDL_internal_string* str, EDL_media_type_t value);
 
-#endif /* __edl__internal__datatypes_h */
+#endif /* EDL_INTERNAL_DATATYPES_H_ */
diff -r 0cc2555db371 -r 41b74137e201 include/edl.h
--- a/include/edl.h	Wed Mar 27 13:38:30 2024 -0400
+++ b/include/edl.h	Wed Apr 03 20:48:51 2024 -0400
@@ -1,5 +1,5 @@
-#ifndef __edl__edl_h
-#define __edl__edl_h
+#ifndef EDL_EDL_H_
+#define EDL_EDL_H_
 
 #ifdef __cplusplus
 extern "C" {
@@ -68,4 +68,4 @@
 }
 #endif
 
-#endif
+#endif /* EDL_EDL_H_ */
diff -r 0cc2555db371 -r 41b74137e201 include/str.h
--- a/include/str.h	Wed Mar 27 13:38:30 2024 -0400
+++ b/include/str.h	Wed Apr 03 20:48:51 2024 -0400
@@ -1,5 +1,5 @@
-#ifndef __edl__internal__str_h
-#define __edl__internal__str_h
+#ifndef EDL_INTERNAL_STR_H_
+#define EDL_INTERNAL_STR_H_
 
 #include <stddef.h>
 
@@ -14,4 +14,4 @@
 int EDL_internal_string_append(EDL_internal_string* str, const char* data, const size_t length);
 void EDL_internal_string_free(EDL_internal_string* str);
 
-#endif /* __edl__internal__str_h */
+#endif /* EDL_INTERNAL_STR_H_ */
diff -r 0cc2555db371 -r 41b74137e201 include/util.h
--- a/include/util.h	Wed Mar 27 13:38:30 2024 -0400
+++ b/include/util.h	Wed Apr 03 20:48:51 2024 -0400
@@ -1,5 +1,5 @@
-#ifndef __edl__internal__util_h
-#define __edl__internal__util_h
+#ifndef EDL_INTERNAL_UTIL_H_
+#define EDL_INTERNAL_UTIL_H_
 
 #include <stddef.h>
 
@@ -7,4 +7,4 @@
 char* EDL_internal_strnchr(const char* haystack, char needle, size_t length);
 char* EDL_internal_strdup(const char* s);
 
-#endif /* __edl__internal__util_h */
+#endif /* EDL_INTERNAL_UTIL_H_ */
diff -r 0cc2555db371 -r 41b74137e201 src/edl.c
--- a/src/edl.c	Wed Mar 27 13:38:30 2024 -0400
+++ b/src/edl.c	Wed Apr 03 20:48:51 2024 -0400
@@ -98,7 +98,7 @@
 		if (!ln)
 			return -1;
 
-		newline = ln - &data[offset];
+		newline = ln ? (ln - &data[offset]) : length;
 	}
 
 	EDL_internal_header_reallocate(header, 32);
@@ -404,10 +404,9 @@
 	EDL_internal_string_append(&ret, order_str, strlen(order_str));
 
 	{
-		/* how? */
 		EDL_header header = {0};
 		if (EDL_internal_parse_header(&header, order_str, 0, strlen(order_str)) < 0)
-			return NULL;
+			return NULL; /* how? */
 
 		size_t i;
 		for (i = 0; i < edl->size; i++)