version 1.63, 2013/06/06 15:15:07 |
version 1.64, 2013/06/06 17:51:31 |
Line 157 static int set_basedir(const char *); |
|
Line 157 static int set_basedir(const char *); |
|
static void putkey(const struct of *, |
static void putkey(const struct of *, |
const char *, uint64_t); |
const char *, uint64_t); |
static void putkeys(const struct of *, |
static void putkeys(const struct of *, |
const char *, int, uint64_t); |
const char *, size_t, uint64_t); |
static void putmdockey(const struct of *, |
static void putmdockey(const struct of *, |
const struct mdoc_node *, uint64_t); |
const struct mdoc_node *, uint64_t); |
static void say(const char *, const char *, ...); |
static void say(const char *, const char *, ...); |
static char *stradd(const char *); |
static char *stradd(const char *); |
static char *straddbuf(const char *, size_t); |
static char *stradds(const char *, size_t); |
static int treescan(void); |
static int treescan(void); |
static size_t utf8(unsigned int, char [7]); |
static size_t utf8(unsigned int, char [7]); |
static void utf8key(struct mchars *, struct str *); |
static void utf8key(struct mchars *, struct str *); |
static void wordaddbuf(const struct of *, |
|
const char *, size_t, uint64_t); |
|
|
|
static char *progname; |
static char *progname; |
static int use_all; /* use all found files */ |
static int use_all; /* use all found files */ |
Line 1154 putkey(const struct of *of, const char *value, uint64_ |
|
Line 1152 putkey(const struct of *of, const char *value, uint64_ |
|
{ |
{ |
|
|
assert(NULL != value); |
assert(NULL != value); |
wordaddbuf(of, value, strlen(value), type); |
putkeys(of, value, strlen(value), type); |
} |
} |
|
|
/* |
/* |
* Like putkey() but for unterminated strings. |
|
*/ |
|
static void |
|
putkeys(const struct of *of, const char *value, int sz, uint64_t type) |
|
{ |
|
|
|
wordaddbuf(of, value, sz, type); |
|
} |
|
|
|
/* |
|
* Grok all nodes at or below a certain mdoc node into putkey(). |
* Grok all nodes at or below a certain mdoc node into putkey(). |
*/ |
*/ |
static void |
static void |
Line 1537 parse_mdoc_body(struct of *of, const struct mdoc_node |
|
Line 1525 parse_mdoc_body(struct of *of, const struct mdoc_node |
|
} |
} |
|
|
/* |
/* |
* See straddbuf(). |
* See stradds(). |
*/ |
*/ |
static char * |
static char * |
stradd(const char *cp) |
stradd(const char *cp) |
{ |
{ |
|
|
return(straddbuf(cp, strlen(cp))); |
return(stradds(cp, strlen(cp))); |
} |
} |
|
|
/* |
/* |
Line 1553 stradd(const char *cp) |
|
Line 1541 stradd(const char *cp) |
|
* In using it, we avoid having thousands of (e.g.) "cat1" string |
* In using it, we avoid having thousands of (e.g.) "cat1" string |
* allocations for the "of" table. |
* allocations for the "of" table. |
* We also have a layer atop the string table for keeping track of words |
* We also have a layer atop the string table for keeping track of words |
* in a parse sequence (see wordaddbuf()). |
* in a parse sequence (see putkeys()). |
*/ |
*/ |
static char * |
static char * |
straddbuf(const char *cp, size_t sz) |
stradds(const char *cp, size_t sz) |
{ |
{ |
struct str *s; |
struct str *s; |
unsigned int index; |
unsigned int index; |
Line 1596 hashget(const char *cp, size_t sz) |
|
Line 1584 hashget(const char *cp, size_t sz) |
|
* of its entries without conflict. |
* of its entries without conflict. |
*/ |
*/ |
static void |
static void |
wordaddbuf(const struct of *of, |
putkeys(const struct of *of, const char *cp, size_t sz, uint64_t v) |
const char *cp, size_t sz, uint64_t v) |
|
{ |
{ |
struct str *s; |
struct str *s; |
unsigned int index; |
unsigned int index; |