This commit is contained in:
Kovid Goyal 2024-09-12 20:59:47 +05:30
parent aa3b5398e1
commit aa3b09e77c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 7 additions and 6 deletions

View File

@ -102,7 +102,7 @@ bad_entity:
if (!num) goto bad_entity;
return num;
} else {
struct html_entity *s = in_word_set(entity, elen);
const struct html_entity *s = in_word_set(entity, elen);
if (!s) goto bad_entity;
ans = strlen(s->val);
memcpy(output, s->val, ans);

View File

@ -1,5 +1,5 @@
/* ANSI-C code produced by gperf version 3.1 */
/* Command-line: gperf -t */
/* Command-line: gperf -t --readonly --includes */
/* Computed positions: -k'1-7,10,12,$' */
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
@ -30,6 +30,7 @@
#endif
struct html_entity { const char *name, *val; };
#include <string.h>
#define TOTAL_KEYWORDS 2127
#define MIN_WORD_LENGTH 2
@ -48,7 +49,7 @@ inline
static unsigned int
hash (register const char *str, register size_t len)
{
static unsigned short asso_values[] =
static const unsigned short asso_values[] =
{
20839, 20839, 20839, 20839, 20839, 20839, 20839, 20839, 20839, 20839,
20839, 20839, 20839, 20839, 20839, 20839, 20839, 20839, 20839, 20839,
@ -115,10 +116,10 @@ hash (register const char *str, register size_t len)
return hval + asso_values[(unsigned char)str[len - 1]];
}
struct html_entity *
const struct html_entity *
in_word_set (register const char *str, register size_t len)
{
static struct html_entity wordlist[] =
static const struct html_entity wordlist[] =
{
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},

View File

@ -2170,6 +2170,6 @@ struct html_entity { const char *name, *val; }
import subprocess
with open(__file__.replace('.py', '.h'), 'wb') as f:
cp = subprocess.run(['gperf', '-t'], input='\n'.join(native_lines).encode(), stdout=f)
cp = subprocess.run(['gperf', '--struct-type', '--readonly', '--includes'], input='\n'.join(native_lines).encode(), stdout=f)
if cp.returncode != 0:
raise SystemExit(cp.returncode)