mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
...
This commit is contained in:
parent
aa3b5398e1
commit
aa3b09e77c
@ -102,7 +102,7 @@ bad_entity:
|
|||||||
if (!num) goto bad_entity;
|
if (!num) goto bad_entity;
|
||||||
return num;
|
return num;
|
||||||
} else {
|
} 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;
|
if (!s) goto bad_entity;
|
||||||
ans = strlen(s->val);
|
ans = strlen(s->val);
|
||||||
memcpy(output, s->val, ans);
|
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 */
|
/* 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,$' */
|
/* Computed positions: -k'1-7,10,12,$' */
|
||||||
|
|
||||||
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
|
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
|
||||||
@ -30,6 +30,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct html_entity { const char *name, *val; };
|
struct html_entity { const char *name, *val; };
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define TOTAL_KEYWORDS 2127
|
#define TOTAL_KEYWORDS 2127
|
||||||
#define MIN_WORD_LENGTH 2
|
#define MIN_WORD_LENGTH 2
|
||||||
@ -48,7 +49,7 @@ inline
|
|||||||
static unsigned int
|
static unsigned int
|
||||||
hash (register const char *str, register size_t len)
|
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,
|
||||||
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]];
|
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)
|
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
|
import subprocess
|
||||||
with open(__file__.replace('.py', '.h'), 'wb') as f:
|
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:
|
if cp.returncode != 0:
|
||||||
raise SystemExit(cp.returncode)
|
raise SystemExit(cp.returncode)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user