Add Strlen(), a strlen(3) that panics if string is stupid long and returns unsigned.

First batch of changes to use it to suppress warnings.
This commit is contained in:
nhkeni
2022-03-06 20:23:04 -05:00
parent 1e31fee0df
commit ff1289e828
16 changed files with 45 additions and 32 deletions

View File

@@ -748,7 +748,7 @@ str2role(const char *str)
return ROLE_NONE;
/* Match as much of str as is provided */
len = strlen(str);
len = Strlen(str);
for (i = 0; roles[i].name.m; i++) {
/* Does it match the male name? */
if (!strncmpi(str, roles[i].name.m, len))
@@ -878,7 +878,7 @@ str2gend(const char *str)
return ROLE_NONE;
/* Match as much of str as is provided */
len = strlen(str);
len = Strlen(str);
for (i = 0; i < ROLE_GENDERS; i++) {
/* Does it match the adjective? */
if (!strncmpi(str, genders[i].adj, len))
@@ -941,7 +941,7 @@ str2align(const char *str)
return ROLE_NONE;
/* Match as much of str as is provided */
len = strlen(str);
len = Strlen(str);
for (i = 0; i < ROLE_ALIGNS; i++) {
/* Does it match the adjective? */
if (!strncmpi(str, aligns[i].adj, len))
@@ -1530,7 +1530,7 @@ build_plselection_prompt(
Strcat(tmpbuf, "a ");
/* <your> */
(void) root_plselection_prompt(eos(tmpbuf), buflen - strlen(tmpbuf),
(void) root_plselection_prompt(eos(tmpbuf), buflen - Strlen(tmpbuf),
rolenum, racenum, gendnum, alignnum);
/* "Shall I pick a character's role, race, gender, and alignment for you?"
plus " [ynaq] (y)" is a little too long for a conventional 80 columns;