changeset 13:41b74137e201

include: make header guards sane double underscores are reserved to the implementation by the C standard
author Paper <paper@paper.us.eu.org>
date Wed, 03 Apr 2024 20:48:51 -0400
parents 0cc2555db371
children 2d7c810a1ac2
files include/datatypes.h include/edl.h include/str.h include/util.h src/edl.c
diffstat 5 files changed, 14 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- 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_ */
--- 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_ */
--- 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_ */
--- 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_ */
--- 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++)