-/* $Id: mansearch.c,v 1.57 2015/04/01 12:48:33 schwarze Exp $ */
+/* $Id: mansearch.c,v 1.58 2015/10/06 18:32:19 schwarze Exp $ */
/*
* Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
if (start) {
if (NULL != pagecache) {
fprintf(stderr, "pagecache already enabled\n");
- return((int)MANDOCLEVEL_BADARG);
+ return (int)MANDOCLEVEL_BADARG;
}
pagecache = mmap(NULL, PC_PAGESIZE * PC_NUMPAGES,
if (MAP_FAILED == pagecache) {
perror("mmap");
pagecache = NULL;
- return((int)MANDOCLEVEL_SYSERR);
+ return (int)MANDOCLEVEL_SYSERR;
}
c = sqlite3_config(SQLITE_CONFIG_PAGECACHE,
pagecache, PC_PAGESIZE, PC_NUMPAGES);
if (SQLITE_OK == c)
- return((int)MANDOCLEVEL_OK);
+ return (int)MANDOCLEVEL_OK;
fprintf(stderr, "pagecache: %s\n", sqlite3_errstr(c));
} else if (NULL == pagecache) {
fprintf(stderr, "pagecache missing\n");
- return((int)MANDOCLEVEL_BADARG);
+ return (int)MANDOCLEVEL_BADARG;
}
if (-1 == munmap(pagecache, PC_PAGESIZE * PC_NUMPAGES)) {
perror("munmap");
pagecache = NULL;
- return((int)MANDOCLEVEL_SYSERR);
+ return (int)MANDOCLEVEL_SYSERR;
}
pagecache = NULL;
- return((int)MANDOCLEVEL_OK);
+ return (int)MANDOCLEVEL_OK;
}
int
if (argc == 0 || (e = exprcomp(search, argc, argv)) == NULL) {
*sz = 0;
- return(0);
+ return 0;
}
info.calloc = hash_calloc;
exprfree(e);
free(sql);
*sz = cur;
- return(1);
+ return 1;
}
void
mp1 = vp1;
mp2 = vp2;
- return( (diff = mp2->bits - mp1->bits) ? diff :
- (diff = mp1->sec - mp2->sec) ? diff :
- strcasecmp(mp1->names, mp2->names));
+ return (diff = mp2->bits - mp1->bits) ? diff :
+ (diff = mp1->sec - mp2->sec) ? diff :
+ strcasecmp(mp1->names, mp2->names);
}
static void
if (SQLITE_DONE != c)
fprintf(stderr, "%s\n", sqlite3_errmsg(db));
sqlite3_reset(s);
- return(output);
+ return output;
}
/*
needop = 1;
}
- return(sql);
+ return sql;
}
/*
toopen = logic = igncase = 0;
}
if ( ! (toopen || logic || igncase || toclose))
- return(first);
+ return first;
fail:
if (NULL != first)
exprfree(first);
- return(NULL);
+ return NULL;
}
static struct expr *
int i, irc;
if ('\0' == *buf)
- return(NULL);
+ return NULL;
e = mandoc_calloc(1, sizeof(struct expr));
e->bits = TYPE_Nm;
e->substr = buf;
e->equal = 1;
- return(e);
+ return e;
}
/*
regerror(irc, &e->regexp, errbuf, sizeof(errbuf));
fprintf(stderr, "regcomp: %s\n", errbuf);
free(e);
- return(NULL);
+ return NULL;
}
}
if (e->bits)
- return(e);
+ return e;
/*
* Parse out all possible fields.
if (i == mansearch_keymax) {
if (strcasecmp(key, "any")) {
free(e);
- return(NULL);
+ return NULL;
}
e->bits |= ~0ULL;
}
}
- return(e);
+ return e;
}
static void
hash_calloc(size_t nmemb, size_t sz, void *arg)
{
- return(mandoc_calloc(nmemb, sz));
+ return mandoc_calloc(nmemb, sz);
}
static void *
hash_alloc(size_t sz, void *arg)
{
- return(mandoc_malloc(sz));
+ return mandoc_malloc(sz);
}
static void