version 1.85, 2013/12/27 15:48:09 |
version 1.87, 2013/12/27 16:40:35 |
Line 142 static void filescan(const char *); |
|
Line 142 static void filescan(const char *); |
|
static void *hash_alloc(size_t, void *); |
static void *hash_alloc(size_t, void *); |
static void hash_free(void *, size_t, void *); |
static void hash_free(void *, size_t, void *); |
static void *hash_halloc(size_t, void *); |
static void *hash_halloc(size_t, void *); |
static int inocheck(const struct stat *); |
|
static void mlink_add(struct mlink *, const struct stat *); |
static void mlink_add(struct mlink *, const struct stat *); |
static void mlink_free(struct mlink *); |
static void mlink_free(struct mlink *); |
static void mpages_free(void); |
static void mpages_free(void); |
|
|
if (warnings) |
if (warnings) |
say(path, "Extraneous file"); |
say(path, "Extraneous file"); |
continue; |
continue; |
} else if (inocheck(ff->fts_statp)) { |
|
if (warnings) |
|
say(path, "Duplicate file"); |
|
continue; |
|
} else if (NULL == (fsec = |
} else if (NULL == (fsec = |
strrchr(ff->fts_name, '.'))) { |
strrchr(ff->fts_name, '.'))) { |
if ( ! use_all) { |
if ( ! use_all) { |
Line 711 filescan(const char *file) |
|
Line 706 filescan(const char *file) |
|
exitcode = (int)MANDOCLEVEL_BADARG; |
exitcode = (int)MANDOCLEVEL_BADARG; |
say(file, "Not a regular file"); |
say(file, "Not a regular file"); |
return; |
return; |
} else if (inocheck(&st)) { |
|
if (warnings) |
|
say(file, "Duplicate file"); |
|
return; |
|
} |
} |
start = buf + strlen(basedir); |
start = buf + strlen(basedir); |
mlink = mandoc_calloc(1, sizeof(struct mlink)); |
mlink = mandoc_calloc(1, sizeof(struct mlink)); |
Line 771 filescan(const char *file) |
|
Line 762 filescan(const char *file) |
|
mlink_add(mlink, &st); |
mlink_add(mlink, &st); |
} |
} |
|
|
static int |
|
inocheck(const struct stat *st) |
|
{ |
|
struct inodev inodev; |
|
uint32_t hash; |
|
|
|
memset(&inodev, 0, sizeof(inodev)); |
|
inodev.st_ino = hash = st->st_ino; |
|
inodev.st_dev = st->st_dev; |
|
|
|
return(NULL != ohash_find(&mpages, ohash_lookup_memory( |
|
&mpages, (char *)&inodev, sizeof(inodev), hash))); |
|
} |
|
|
|
static void |
static void |
mlink_add(struct mlink *mlink, const struct stat *st) |
mlink_add(struct mlink *mlink, const struct stat *st) |
{ |
{ |
Line 1787 utf8key(struct mchars *mc, struct str *key) |
|
Line 1764 utf8key(struct mchars *mc, struct str *key) |
|
static void |
static void |
dbindex(const struct mpage *mpage, struct mchars *mc) |
dbindex(const struct mpage *mpage, struct mchars *mc) |
{ |
{ |
|
struct mlink *mlink; |
struct str *key; |
struct str *key; |
const char *desc; |
const char *desc; |
int64_t recno; |
int64_t recno; |
Line 1826 dbindex(const struct mpage *mpage, struct mchars *mc) |
|
Line 1804 dbindex(const struct mpage *mpage, struct mchars *mc) |
|
recno = sqlite3_last_insert_rowid(db); |
recno = sqlite3_last_insert_rowid(db); |
sqlite3_reset(stmts[STMT_INSERT_PAGE]); |
sqlite3_reset(stmts[STMT_INSERT_PAGE]); |
|
|
i = 1; |
for (mlink = mpage->mlinks; mlink; mlink = mlink->next) { |
SQL_BIND_TEXT(stmts[STMT_INSERT_LINK], i, mpage->mlinks->dsec); |
i = 1; |
SQL_BIND_TEXT(stmts[STMT_INSERT_LINK], i, mpage->mlinks->arch); |
SQL_BIND_TEXT(stmts[STMT_INSERT_LINK], i, mlink->dsec); |
SQL_BIND_TEXT(stmts[STMT_INSERT_LINK], i, mpage->mlinks->file); |
SQL_BIND_TEXT(stmts[STMT_INSERT_LINK], i, mlink->arch); |
SQL_BIND_INT64(stmts[STMT_INSERT_LINK], i, recno); |
SQL_BIND_TEXT(stmts[STMT_INSERT_LINK], i, mlink->file); |
SQL_STEP(stmts[STMT_INSERT_LINK]); |
SQL_BIND_INT64(stmts[STMT_INSERT_LINK], i, recno); |
sqlite3_reset(stmts[STMT_INSERT_LINK]); |
SQL_STEP(stmts[STMT_INSERT_LINK]); |
|
sqlite3_reset(stmts[STMT_INSERT_LINK]); |
|
} |
|
|
for (key = ohash_first(&strings, &slot); NULL != key; |
for (key = ohash_first(&strings, &slot); NULL != key; |
key = ohash_next(&strings, &slot)) { |
key = ohash_next(&strings, &slot)) { |