version 1.38, 2011/12/25 13:08:12 |
version 1.41, 2011/12/25 19:31:25 |
Line 575 index_merge(const struct of *of, struct mparse *mp, |
|
Line 575 index_merge(const struct of *of, struct mparse *mp, |
|
uint64_t mask; |
uint64_t mask; |
size_t sv; |
size_t sv; |
unsigned seq; |
unsigned seq; |
struct db_val vbuf; |
uint64_t vbuf[2]; |
char type; |
char type; |
|
|
rec = 0; |
rec = 0; |
Line 714 index_merge(const struct of *of, struct mparse *mp, |
|
Line 714 index_merge(const struct of *of, struct mparse *mp, |
|
recs->last = 0; |
recs->last = 0; |
} else |
} else |
rec++; |
rec++; |
vbuf.rec = htobe32(rec); |
vbuf[1] = htobe64(rec); |
|
|
/* |
/* |
* Copy from the in-memory hashtable of pending |
* Copy from the in-memory hashtable of pending |
Line 726 index_merge(const struct of *of, struct mparse *mp, |
|
Line 726 index_merge(const struct of *of, struct mparse *mp, |
|
seq = R_NEXT; |
seq = R_NEXT; |
assert(sizeof(uint64_t) == val.size); |
assert(sizeof(uint64_t) == val.size); |
memcpy(&mask, val.data, val.size); |
memcpy(&mask, val.data, val.size); |
vbuf.mask = htobe64(mask); |
vbuf[0] = htobe64(mask); |
val.size = sizeof(struct db_val); |
val.size = sizeof(vbuf); |
val.data = &vbuf; |
val.data = &vbuf; |
dbt_put(mdb->db, mdb->dbn, &key, &val); |
dbt_put(mdb->db, mdb->dbn, &key, &val); |
} |
} |
Line 768 index_prune(const struct of *ofile, struct mdb *mdb, s |
|
Line 768 index_prune(const struct of *ofile, struct mdb *mdb, s |
|
{ |
{ |
const struct of *of; |
const struct of *of; |
const char *fn; |
const char *fn; |
struct db_val *vbuf; |
uint64_t vbuf[2]; |
unsigned seq, sseq; |
unsigned seq, sseq; |
DBT key, val; |
DBT key, val; |
int ch; |
int ch; |
Line 817 index_prune(const struct of *ofile, struct mdb *mdb, s |
|
Line 817 index_prune(const struct of *ofile, struct mdb *mdb, s |
|
while (0 == (ch = (*mdb->db->seq)(mdb->db, |
while (0 == (ch = (*mdb->db->seq)(mdb->db, |
&key, &val, sseq))) { |
&key, &val, sseq))) { |
sseq = R_NEXT; |
sseq = R_NEXT; |
if (sizeof(struct db_val) != val.size) |
if (sizeof(vbuf) != val.size) |
break; |
break; |
|
|
vbuf = val.data; |
memcpy(vbuf, val.data, val.size); |
if (recs->last != betoh32(vbuf->rec)) |
if (recs->last != betoh64(vbuf[1])) |
continue; |
continue; |
|
|
if ((ch = (*mdb->db->del)(mdb->db, |
if ((ch = (*mdb->db->del)(mdb->db, |
|
|
ofile_argbuild(int argc, char *argv[], struct of **of) |
ofile_argbuild(int argc, char *argv[], struct of **of) |
{ |
{ |
char buf[MAXPATHLEN]; |
char buf[MAXPATHLEN]; |
char *sec, *arch, *title, *p; |
const char *sec, *arch, *title; |
|
char *p; |
int i, src_form; |
int i, src_form; |
struct of *nof; |
struct of *nof; |
|
|
Line 1538 ofile_argbuild(int argc, char *argv[], struct of **of) |
|
Line 1539 ofile_argbuild(int argc, char *argv[], struct of **of) |
|
* Recursively build up a list of files to parse. |
* Recursively build up a list of files to parse. |
* We use this instead of ftw() and so on because I don't want global |
* We use this instead of ftw() and so on because I don't want global |
* variables hanging around. |
* variables hanging around. |
* This ignores the mandoc.db and mandoc.index files, but assumes that |
* This ignores the whatis.db and whatis.index files, but assumes that |
* everything else is a manual. |
* everything else is a manual. |
* Pass in a pointer to a NULL structure for the first invocation. |
* Pass in a pointer to a NULL structure for the first invocation. |
*/ |
*/ |
Line 1756 ofile_dirbuild(const char *dir, const char* psec, cons |
|
Line 1757 ofile_dirbuild(const char *dir, const char* psec, cons |
|
|
|
if (verb > 1) |
if (verb > 1) |
printf("%s: scheduling\n", buf); |
printf("%s: scheduling\n", buf); |
|
|
if (NULL == *of) { |
if (NULL == *of) { |
*of = nof; |
*of = nof; |
(*of)->first = nof; |
(*of)->first = nof; |
Line 1774 ofile_free(struct of *of) |
|
Line 1776 ofile_free(struct of *of) |
|
{ |
{ |
struct of *nof; |
struct of *nof; |
|
|
while (of) { |
if (NULL != of) |
|
of = of->first; |
|
|
|
while (NULL != of) { |
nof = of->next; |
nof = of->next; |
free(of->fname); |
free(of->fname); |
free(of->sec); |
free(of->sec); |