mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
...
This commit is contained in:
parent
aa3b5398e1
commit
aa3b09e77c
@ -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);
|
||||
|
9
src/calibre/ebooks/html_entities.h
generated
9
src/calibre/ebooks/html_entities.h
generated
@ -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[] =
|
||||
{
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user