summaryrefslogtreecommitdiffstats
path: root/mandocdb.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-10-06 18:32:19 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-10-06 18:32:19 +0000
commitcdd9965f2080354017315270cbc3dc2da6378df9 (patch)
treeabceb46c894355584ad94178001ebb10ff35db04 /mandocdb.c
parent2c5e2d1085930e82ce52bf9402182a0630e8f39d (diff)
downloadmandoc-cdd9965f2080354017315270cbc3dc2da6378df9.tar.gz
modernize style: "return" is not a function
Diffstat (limited to 'mandocdb.c')
-rw-r--r--mandocdb.c84
1 files changed, 42 insertions, 42 deletions
diff --git a/mandocdb.c b/mandocdb.c
index ae888494..6add97c0 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -547,7 +547,7 @@ out:
mpages_free();
ohash_delete(&mpages);
ohash_delete(&mlinks);
- return(exitcode);
+ return exitcode;
usage:
fprintf(stderr, "usage: %s [-aDnpQ] [-C file] [-Tutf8]\n"
" %s [-aDnpQ] [-Tutf8] dir ...\n"
@@ -557,7 +557,7 @@ usage:
progname, progname, progname,
progname, progname);
- return((int)MANDOCLEVEL_BADARG);
+ return (int)MANDOCLEVEL_BADARG;
}
/*
@@ -594,7 +594,7 @@ treescan(void)
if (NULL == f) {
exitcode = (int)MANDOCLEVEL_SYSERR;
say("", "&fts_open");
- return(0);
+ return 0;
}
dsec = arch = NULL;
@@ -763,7 +763,7 @@ treescan(void)
}
fts_close(f);
- return(1);
+ return 1;
}
/*
@@ -1604,7 +1604,7 @@ parse_mdoc_Fd(struct mpage *mpage, const struct roff_meta *meta,
if (SEC_SYNOPSIS != n->sec ||
NULL == (n = n->child) ||
n->type != ROFFT_TEXT)
- return(0);
+ return 0;
/*
* Only consider those `Fd' macro fields that begin with an
@@ -1612,10 +1612,10 @@ parse_mdoc_Fd(struct mpage *mpage, const struct roff_meta *meta,
*/
if (strcmp("#include", n->string))
- return(0);
+ return 0;
if ((n = n->next) == NULL || n->type != ROFFT_TEXT)
- return(0);
+ return 0;
/*
* Strip away the enclosing angle brackets and make sure we're
@@ -1627,7 +1627,7 @@ parse_mdoc_Fd(struct mpage *mpage, const struct roff_meta *meta,
start++;
if (0 == (sz = strlen(start)))
- return(0);
+ return 0;
end = &start[(int)sz - 1];
if ('>' == *end || '"' == *end)
@@ -1635,7 +1635,7 @@ parse_mdoc_Fd(struct mpage *mpage, const struct roff_meta *meta,
if (end > start)
putkeys(mpage, start, end - start + 1, TYPE_In);
- return(0);
+ return 0;
}
static void
@@ -1665,7 +1665,7 @@ parse_mdoc_Fn(struct mpage *mpage, const struct roff_meta *meta,
{
if (n->child == NULL)
- return(0);
+ return 0;
parse_mdoc_fname(mpage, n->child);
@@ -1673,7 +1673,7 @@ parse_mdoc_Fn(struct mpage *mpage, const struct roff_meta *meta,
if (n->type == ROFFT_TEXT)
putkey(mpage, n->string, TYPE_Fa);
- return(0);
+ return 0;
}
static int
@@ -1682,12 +1682,12 @@ parse_mdoc_Fo(struct mpage *mpage, const struct roff_meta *meta,
{
if (n->type != ROFFT_HEAD)
- return(1);
+ return 1;
if (n->child != NULL)
parse_mdoc_fname(mpage, n->child);
- return(0);
+ return 0;
}
static int
@@ -1697,17 +1697,17 @@ parse_mdoc_Xr(struct mpage *mpage, const struct roff_meta *meta,
char *cp;
if (NULL == (n = n->child))
- return(0);
+ return 0;
if (NULL == n->next) {
putkey(mpage, n->string, TYPE_Xr);
- return(0);
+ return 0;
}
mandoc_asprintf(&cp, "%s(%s)", n->string, n->next->string);
putkey(mpage, cp, TYPE_Xr);
free(cp);
- return(0);
+ return 0;
}
static int
@@ -1717,7 +1717,7 @@ parse_mdoc_Nd(struct mpage *mpage, const struct roff_meta *meta,
if (n->type == ROFFT_BODY)
deroff(&mpage->desc, n);
- return(0);
+ return 0;
}
static int
@@ -1739,7 +1739,7 @@ parse_mdoc_Nm(struct mpage *mpage, const struct roff_meta *meta,
putkey(mpage, n->child->string, ROFFT_HEAD);
mpage->name_head_done = 1;
}
- return(0);
+ return 0;
}
static int
@@ -1747,7 +1747,7 @@ parse_mdoc_Sh(struct mpage *mpage, const struct roff_meta *meta,
const struct roff_node *n)
{
- return(n->sec == SEC_CUSTOM && n->type == ROFFT_HEAD);
+ return n->sec == SEC_CUSTOM && n->type == ROFFT_HEAD;
}
static int
@@ -1755,7 +1755,7 @@ parse_mdoc_head(struct mpage *mpage, const struct roff_meta *meta,
const struct roff_node *n)
{
- return(n->type == ROFFT_HEAD);
+ return n->type == ROFFT_HEAD;
}
static int
@@ -1763,7 +1763,7 @@ parse_mdoc_body(struct mpage *mpage, const struct roff_meta *meta,
const struct roff_node *n)
{
- return(n->type == ROFFT_BODY);
+ return n->type == ROFFT_BODY;
}
/*
@@ -1868,10 +1868,10 @@ utf8(unsigned int cp, char out[7])
out[4] = (cp >> 6 & 63) | 128;
out[5] = (cp & 63) | 128;
} else
- return(0);
+ return 0;
out[rc] = '\0';
- return(rc);
+ return rc;
}
/*
@@ -1995,9 +1995,9 @@ render_string(char **public, size_t *psz)
--*psz;
if (dst != NULL) {
(*public)[*psz] = '\0';
- return(1);
+ return 1;
} else
- return(0);
+ return 0;
}
static void
@@ -2264,7 +2264,7 @@ dbopen(int real)
int rc, ofl;
if (nodb)
- return(1);
+ return 1;
*tempfilename = '\0';
ofl = SQLITE_OPEN_READWRITE;
@@ -2275,7 +2275,7 @@ dbopen(int real)
exitcode = (int)MANDOCLEVEL_SYSERR;
if (SQLITE_CANTOPEN != rc)
say(MANDOC_DB, "%s", sqlite3_errstr(rc));
- return(0);
+ return 0;
}
goto prepare_statements;
}
@@ -2289,7 +2289,7 @@ dbopen(int real)
if (MPARSE_QUICK & mparse_options) {
exitcode = (int)MANDOCLEVEL_SYSERR;
say(MANDOC_DB "~", "%s", sqlite3_errstr(rc));
- return(0);
+ return 0;
}
(void)strlcpy(tempfilename, "/tmp/mandocdb.XXXXXX",
@@ -2297,7 +2297,7 @@ dbopen(int real)
if (NULL == mkdtemp(tempfilename)) {
exitcode = (int)MANDOCLEVEL_SYSERR;
say("", "&%s", tempfilename);
- return(0);
+ return 0;
}
(void)strlcat(tempfilename, "/" MANDOC_DB,
sizeof(tempfilename));
@@ -2305,7 +2305,7 @@ dbopen(int real)
if (SQLITE_OK != rc) {
exitcode = (int)MANDOCLEVEL_SYSERR;
say("", "%s: %s", tempfilename, sqlite3_errstr(rc));
- return(0);
+ return 0;
}
create_tables:
@@ -2344,7 +2344,7 @@ create_tables:
exitcode = (int)MANDOCLEVEL_SYSERR;
say(MANDOC_DB, "%s", sqlite3_errmsg(db));
sqlite3_close(db);
- return(0);
+ return 0;
}
prepare_statements:
@@ -2354,7 +2354,7 @@ prepare_statements:
say(MANDOC_DB, "PRAGMA foreign_keys: %s",
sqlite3_errmsg(db));
sqlite3_close(db);
- return(0);
+ return 0;
}
sql = "DELETE FROM mpages WHERE pageid IN "
@@ -2388,25 +2388,25 @@ prepare_statements:
say(MANDOC_DB, "PRAGMA synchronous: %s",
sqlite3_errmsg(db));
sqlite3_close(db);
- return(0);
+ return 0;
}
#endif
- return(1);
+ return 1;
}
static void *
hash_calloc(size_t n, size_t sz, void *arg)
{
- return(mandoc_calloc(n, sz));
+ return mandoc_calloc(n, sz);
}
static void *
hash_alloc(size_t sz, void *arg)
{
- return(mandoc_malloc(sz));
+ return mandoc_malloc(sz);
}
static void
@@ -2455,12 +2455,12 @@ set_basedir(const char *targetdir, int report_baddir)
if (2 == getcwd_status) {
exitcode = (int)MANDOCLEVEL_SYSERR;
say("", "getcwd: %s", startdir);
- return(0);
+ return 0;
}
if (-1 == chdir(startdir)) {
exitcode = (int)MANDOCLEVEL_SYSERR;
say("", "&chdir %s", startdir);
- return(0);
+ return 0;
}
}
@@ -2474,13 +2474,13 @@ set_basedir(const char *targetdir, int report_baddir)
exitcode = (int)MANDOCLEVEL_BADARG;
say("", "&%s: realpath", targetdir);
}
- return(0);
+ return 0;
} else if (-1 == chdir(basedir)) {
if (report_baddir || errno != ENOENT) {
exitcode = (int)MANDOCLEVEL_BADARG;
say("", "&chdir");
}
- return(0);
+ return 0;
}
chdir_status = 1;
cp = strchr(basedir, '\0');
@@ -2488,12 +2488,12 @@ set_basedir(const char *targetdir, int report_baddir)
if (cp - basedir >= PATH_MAX - 1) {
exitcode = (int)MANDOCLEVEL_SYSERR;
say("", "Filename too long");
- return(0);
+ return 0;
}
*cp++ = '/';
*cp = '\0';
}
- return(1);
+ return 1;
}
static void