shithub: rgbds

Download patch

ref: e5552e27f2fc438eaf6582481ef696e09415f20d
parent: 438963fb24141f8e98e097df0b58657f72ad6d18
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Wed Nov 17 17:47:05 EST 2021

`strrstr` can take and return `char const *`

--- a/src/asm/parser.y
+++ b/src/asm/parser.y
@@ -72,7 +72,7 @@
 	return r;
 }
 
-static char *strrstr(char *s1, char *s2)
+static char const *strrstr(char const *s1, char const *s2)
 {
 	size_t len1 = strlen(s1);
 	size_t len2 = strlen(s2);
@@ -80,7 +80,7 @@
 	if (len2 > len1)
 		return NULL;
 
-	for (char *p = s1 + len1 - len2; p >= s1; p--)
+	for (char const *p = s1 + len1 - len2; p >= s1; p--)
 		if (!strncmp(p, s2, len2))
 			return p;
 
@@ -1533,12 +1533,12 @@
 			rpn_Number(&$$, strcmp($3, $5));
 		}
 		| T_OP_STRIN T_LPAREN string T_COMMA string T_RPAREN {
-			char *p = strstr($3, $5);
+			char const *p = strstr($3, $5);
 
 			rpn_Number(&$$, p ? p - $3 + 1 : 0);
 		}
 		| T_OP_STRRIN T_LPAREN string T_COMMA string T_RPAREN {
-			char *p = strrstr($3, $5);
+			char const *p = strrstr($3, $5);
 
 			rpn_Number(&$$, p ? p - $3 + 1 : 0);
 		}