diff options
Diffstat (limited to 'ncurses/tty/hashmap.c')
| -rw-r--r-- | ncurses/tty/hashmap.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/ncurses/tty/hashmap.c b/ncurses/tty/hashmap.c index e50b63847b99..1498f5fdee28 100644 --- a/ncurses/tty/hashmap.c +++ b/ncurses/tty/hashmap.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2019-2020,2023 Thomas E. Dickey * + * Copyright 2019-2024,2025 Thomas E. Dickey * * Copyright 1998-2015,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -74,7 +74,7 @@ AUTHOR #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: hashmap.c,v 1.71 2023/09/16 16:28:53 tom Exp $") +MODULE_ID("$Id: hashmap.c,v 1.75 2025/07/26 19:48:34 tom Exp $") #ifdef HASHDEBUG @@ -120,15 +120,14 @@ static NCURSES_CH_T newtext[MAXLINES][TEXTWIDTH(sp)]; static const NCURSES_CH_T blankchar = NewChar(BLANK_TEXT); static NCURSES_INLINE unsigned long -hash(SCREEN *sp, NCURSES_CH_T *text) +hash(SCREEN *sp, const NCURSES_CH_T *text) { int i; - NCURSES_CH_T ch; unsigned long result = 0; (void) sp; for (i = TEXTWIDTH(sp); i > 0; i--) { - ch = *text++; + NCURSES_CH_T ch = *text++; result += (result << 5) + (unsigned long) HASH_VAL(ch); } return result; @@ -312,10 +311,10 @@ NCURSES_SP_NAME(_nc_hash_map) (NCURSES_SP_DCL0) } } else { /* re-hash all */ - if (oldhash(SP_PARM) == 0) + if (oldhash(SP_PARM) == NULL) oldhash(SP_PARM) = typeCalloc(unsigned long, (size_t) screen_lines(SP_PARM)); - if (newhash(SP_PARM) == 0) + if (newhash(SP_PARM) == NULL) newhash(SP_PARM) = typeCalloc(unsigned long, (size_t) screen_lines(SP_PARM)); if (!oldhash(SP_PARM) || !newhash(SP_PARM)) { @@ -504,7 +503,8 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) for (n = 0; n < screen_lines(sp); n++) { reallines[n] = n; oldnums[n] = _NEWINDEX; - CharOf(oldtext[n][0]) = CharOf(newtext[n][0]) = '.'; + SetChar(oldtext[n][0], '.', A_NORMAL); + SetChar(newtext[n][0], '.', A_NORMAL); } if (NC_ISATTY(fileno(stdin))) @@ -533,27 +533,27 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) do { oldnums[n++] = atoi(st); } while - ((st = strtok((char *) NULL, " ")) != 0); + ((st = strtok((char *) NULL, " ")) != NULL); break; case 'n': /* use following letters as text of new lines */ for (n = 0; n < screen_lines(sp); n++) - CharOf(newtext[n][0]) = '.'; + SetChar(newtext[n][0], '.', A_NORMAL); for (n = 0; n < screen_lines(sp); n++) if (line[n + 1] == '\n') break; else - CharOf(newtext[n][0]) = line[n + 1]; + SetChar(newtext[n][0], line[n + 1], A_NORMAL); break; case 'o': /* use following letters as text of old lines */ for (n = 0; n < screen_lines(sp); n++) - CharOf(oldtext[n][0]) = '.'; + SetChar(oldtext[n][0], '.', A_NORMAL); for (n = 0; n < screen_lines(sp); n++) if (line[n + 1] == '\n') break; else - CharOf(oldtext[n][0]) = line[n + 1]; + SetChar(oldtext[n][0], line[n + 1], A_NORMAL); break; case 'd': /* dump state of test arrays */ |
