From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: For the strings table, ohash_init is only called in ofmerge(),
Date: Tue, 2 Jul 2013 09:26:53 -0400 (EDT) [thread overview]
Message-ID: <201307021326.r62DQrs9018933@krisdoz.my.domain> (raw)
Log Message:
-----------
For the strings table, ohash_init is only called in ofmerge(),
so move the str_info structure into that function.
No functional change.
Modified Files:
--------------
mdocml:
mandocdb.c
Revision Data
-------------
Index: mandocdb.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandocdb.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.70 -r1.71
--- mandocdb.c
+++ mandocdb.c
@@ -140,8 +140,7 @@ static int inocheck(const struct stat *
static void ofadd(int, const char *, const char *, const char *,
const char *, const char *, const struct stat *);
static void offree(void);
-static void ofmerge(struct mchars *, struct mparse *,
- struct ohash_info*, int);
+static void ofmerge(struct mchars *, struct mparse *, int);
static void parse_catpage(struct of *);
static void parse_man(struct of *, const struct man_node *);
static void parse_mdoc(struct of *, const struct mdoc_node *);
@@ -316,21 +315,17 @@ main(int argc, char *argv[])
struct mchars *mc;
struct manpaths dirs;
struct mparse *mp;
- struct ohash_info ino_info, filename_info, str_info;
+ struct ohash_info ino_info, filename_info;
memset(stmts, 0, STMT__MAX * sizeof(sqlite3_stmt *));
memset(&dirs, 0, sizeof(struct manpaths));
- ino_info.halloc = filename_info.halloc =
- str_info.halloc = hash_halloc;
- ino_info.hfree = filename_info.hfree =
- str_info.hfree = hash_free;
- ino_info.alloc = filename_info.alloc =
- str_info.alloc = hash_alloc;
+ ino_info.alloc = filename_info.alloc = hash_alloc;
+ ino_info.halloc = filename_info.halloc = hash_halloc;
+ ino_info.hfree = filename_info.hfree = hash_free;
ino_info.key_offset = offsetof(struct of, id);
filename_info.key_offset = offsetof(struct of, file);
- str_info.key_offset = offsetof(struct str, key);
progname = strrchr(argv[0], '/');
if (progname == NULL)
@@ -427,7 +422,7 @@ main(int argc, char *argv[])
if (OP_TEST != op)
dbprune();
if (OP_DELETE != op)
- ofmerge(mc, mp, &str_info, 0);
+ ofmerge(mc, mp, 0);
dbclose(1);
} else {
/*
@@ -471,7 +466,7 @@ main(int argc, char *argv[])
if (0 == dbopen(0))
goto out;
- ofmerge(mc, mp, &str_info, warnings && !use_all);
+ ofmerge(mc, mp, warnings && !use_all);
dbclose(0);
if (j + 1 < dirs.sz) {
@@ -892,11 +887,10 @@ offree(void)
* and filename to determine whether the file is parsable or not.
*/
static void
-ofmerge(struct mchars *mc, struct mparse *mp,
- struct ohash_info *infop, int check_reachable)
+ofmerge(struct mchars *mc, struct mparse *mp, int check_reachable)
{
struct ohash title_table;
- struct ohash_info title_info;
+ struct ohash_info title_info, str_info;
char buf[PATH_MAX];
struct of *of;
struct mdoc *mdoc;
@@ -910,6 +904,11 @@ ofmerge(struct mchars *mc, struct mparse
unsigned int slot;
enum mandoclevel lvl;
+ str_info.alloc = hash_alloc;
+ str_info.halloc = hash_halloc;
+ str_info.hfree = hash_free;
+ str_info.key_offset = offsetof(struct str, key);
+
if (check_reachable) {
title_info.alloc = hash_alloc;
title_info.halloc = hash_halloc;
@@ -947,7 +946,7 @@ ofmerge(struct mchars *mc, struct mparse
}
}
- ohash_init(&strings, 6, infop);
+ ohash_init(&strings, 6, &str_info);
mparse_reset(mp);
mdoc = NULL;
man = NULL;
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
reply other threads:[~2013-07-02 13:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201307021326.r62DQrs9018933@krisdoz.my.domain \
--to=schwarze@mdocml.bsd.lv \
--cc=source@mdocml.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).