From 8e6b3c4aea9c7a701aedbd4688a732855952185c Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Tue, 17 Sep 2024 17:10:20 -0700 Subject: [PATCH] Use strchr() instead of deprecated index() Fixes build failures on Solaris with gcc 14 since the legacy index() function is only defined in the legacy strings.h header, but these files only include the standard string.h header which defines the standard strchr() function. Signed-off-by: Alan Coopersmith --- src/clients/say/say.c | 6 +++--- src/modules/espeak.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/clients/say/say.c b/src/clients/say/say.c index e08157dc..fcb8ed54 100644 --- a/src/clients/say/say.c +++ b/src/clients/say/say.c @@ -131,13 +131,13 @@ int main(int argc, char **argv) printf("Invalid language!\n"); } else { char *locale = strdup(setlocale(LC_MESSAGES, NULL)); - char *dot = index(locale, '.'); + char *dot = strchr(locale, '.'); if (dot) *dot = 0; - char *at = index(locale, '@'); + char *at = strchr(locale, '@'); if (at) *at = 0; - char *underscore = index(locale, '_'); + char *underscore = strchr(locale, '_'); if (underscore) *underscore = '-'; if (spd_set_language(conn, locale)) diff --git a/src/modules/espeak.c b/src/modules/espeak.c index c19201bc..471b0c06 100644 --- a/src/modules/espeak.c +++ b/src/modules/espeak.c @@ -906,7 +906,7 @@ static SPDVoice **espeak_list_synthesis_voices() if (!strncmp(identifier, "mb/mb-", 6)) { voicename = g_strdup(identifier + 6); - dash = index(voicename, '-'); + dash = strchr(voicename, '-'); if (dash) /* Ignore "-en" language specification */ *dash = 0;