diff src/datatypes.c @ 14:2d7c810a1ac2 default tip

*: misc. cleanup
author Paper <paper@paper.us.eu.org>
date Fri, 03 May 2024 22:40:28 -0400
parents 0cc2555db371
children
line wrap: on
line diff
--- a/src/datatypes.c	Wed Apr 03 20:48:51 2024 -0400
+++ b/src/datatypes.c	Fri May 03 22:40:28 2024 -0400
@@ -21,31 +21,29 @@
 }
 
 size_t EDL_internal_parse_int(const char* input, size_t offset, size_t length, int* int_return) {
+	char* ptr_return = input;
+
 	if (offset > length)
 		return 0;
 
-	{
-		char* ptr_return;
-		*int_return = strtol(&input[offset], &ptr_return, 10);
+	*int_return = strtol(&input[offset], &ptr_return, 10);
 
-		if (!ptr_return)
-			return 0;
-	}
+	if (ptr_return == input)
+		return 0;
 
 	return EDL_internal_append_offset(input, offset, length);
 }
 
 size_t EDL_internal_parse_double(const char* input, size_t offset, size_t length, double* double_return) {
+	char* ptr_return = input;
+
 	if (offset > length)
 		return 0;
 
-	{
-		char* ptr_return;
-		*double_return = strtod(&input[offset], &ptr_return);
+	*double_return = strtod(&input[offset], &ptr_return);
 
-		if (!ptr_return)
-			return 0;
-	}
+	if (ptr_return == input)
+		return 0;
 
 	return EDL_internal_append_offset(input, offset, length);
 }
@@ -79,7 +77,7 @@
 size_t EDL_internal_parse_string(const char* input, size_t offset, size_t length, char** string_return) {
 	size_t start, s_length;
 
-	/* will most definitely break on good filesystems */
+	/* will definitely break on any good filesystem */
 	if (offset > length)
 		return 0;