Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Mon, 16 Oct 2023 20:52:22 UTC Commit: 1a7e2f5caca3f01ff171424fa5cea8e02f0b3331 https://github.com/geany/geany/commit/1a7e2f5caca3f01ff171424fa5cea8e02f0b33...
Log Message: ----------- Constify some arguments
Even GCC complains, given how it's used (assuming `-Wwrite-strings`):
../../../src/tagmanager/tm_parser.c: In function 'tm_parser_update_scope': ../../../src/tagmanager/tm_parser.c:1469:65: warning: passing argument 2 of 'replace_string_if_present' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 1469 | return replace_string_if_present(scope, "\", "::"); | ^~~~ ../../../src/tagmanager/tm_parser.c:1447:66: note: expected 'gchar *' {aka 'char *'} but argument is of type 'const char *' 1447 | static gchar *replace_string_if_present(gchar *haystack, gchar *needle, gchar *subst) | ~~~~~~~^~~~~~ ../../../src/tagmanager/tm_parser.c:1469:71: warning: passing argument 3 of 'replace_string_if_present' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 1469 | return replace_string_if_present(scope, "\", "::"); | ^~~~ ../../../src/tagmanager/tm_parser.c:1447:82: note: expected 'gchar *' {aka 'char *'} but argument is of type 'const char *' 1447 | static gchar *replace_string_if_present(gchar *haystack, gchar *needle, gchar *subst) | ~~~~~~~^~~~~
Modified Paths: -------------- src/tagmanager/tm_parser.c src/tagmanager/tm_parser.h
Modified: src/tagmanager/tm_parser.c 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -1425,7 +1425,7 @@ const gchar *tm_parser_get_constructor_method(TMParserType lang)
/* determine anonymous tags from tag names only when corresponding * ctags information is not available */ -gboolean tm_parser_is_anon_name(TMParserType lang, gchar *name) +gboolean tm_parser_is_anon_name(TMParserType lang, const gchar *name) { guint i; char dummy; @@ -1444,7 +1444,7 @@ gboolean tm_parser_is_anon_name(TMParserType lang, gchar *name) }
-static gchar *replace_string_if_present(gchar *haystack, gchar *needle, gchar *subst) +static gchar *replace_string_if_present(gchar *haystack, const gchar *needle, const gchar *subst) { if (strstr(haystack, needle)) {
Modified: src/tagmanager/tm_parser.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -153,7 +153,7 @@ gint tm_parser_scope_autocomplete_suffix(TMParserType lang, const gchar *str);
const gchar *tm_parser_get_constructor_method(TMParserType lang);
-gboolean tm_parser_is_anon_name(TMParserType lang, gchar *name); +gboolean tm_parser_is_anon_name(TMParserType lang, const gchar *name);
gchar *tm_parser_update_scope(TMParserType lang, gchar *scope);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).