From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Garbage collect one pair of needless parentheses in SQL code
Date: Thu, 17 Apr 2014 15:20:01 -0400 (EDT) [thread overview]
Message-ID: <201404171920.s3HJK1wk019902@krisdoz.my.domain> (raw)
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
reply other threads:[~2014-04-17 19:20 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=201404171920.s3HJK1wk019902@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).