* mdocml: Garbage collect one pair of needless parentheses in SQL code
@ 2014-04-17 19:20 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-04-17 19:20 UTC (permalink / raw)
To: source
Log Message:
-----------
Garbage collect one pair of needless parentheses in SQL code generation;
note this doesn't affect performance, SQLite generates the same byte code.
While here, make the calls to exprspec() easier to understand.
Modified Files:
--------------
mdocml:
mansearch.c
Revision Data
-------------
Index: mansearch.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mansearch.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -Lmansearch.c -Lmansearch.c -u -p -r1.32 -r1.33
--- mansearch.c
+++ mansearch.c
@@ -590,7 +590,7 @@ exprcomp(const struct mansearch *search,
first = cur = NULL;
logic = igncase = toclose = 0;
- toopen = 1;
+ toopen = NULL != search->sec || NULL != search->arch;
for (i = 0; i < argc; i++) {
if (0 == strcmp("(", argv[i])) {
@@ -659,9 +659,12 @@ exprcomp(const struct mansearch *search,
if (toopen || logic || igncase || toclose)
goto fail;
- cur->close++;
- cur = exprspec(cur, TYPE_arch, search->arch, "^(%s|any)$");
- exprspec(cur, TYPE_sec, search->sec, "^%s$");
+ if (NULL != search->sec || NULL != search->arch)
+ cur->close++;
+ if (NULL != search->arch)
+ cur = exprspec(cur, TYPE_arch, search->arch, "^(%s|any)$");
+ if (NULL != search->sec)
+ exprspec(cur, TYPE_sec, search->sec, "^%s$");
return(first);
@@ -678,9 +681,6 @@ exprspec(struct expr *cur, uint64_t key,
char errbuf[BUFSIZ];
char *cp;
int irc;
-
- if (NULL == value)
- return(cur);
mandoc_asprintf(&cp, format, value);
cur->next = mandoc_calloc(1, sizeof(struct expr));
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-04-17 19:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-17 19:20 mdocml: Garbage collect one pair of needless parentheses in SQL code schwarze
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).