From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (schwarze@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.5/8.14.5) with ESMTP id s3HJK11I002357 for ; Thu, 17 Apr 2014 15:20:01 -0400 (EDT) Received: (from schwarze@localhost) by krisdoz.my.domain (8.14.5/8.14.3/Submit) id s3HJK1wk019902; Thu, 17 Apr 2014 15:20:01 -0400 (EDT) Date: Thu, 17 Apr 2014 15:20:01 -0400 (EDT) Message-Id: <201404171920.s3HJK1wk019902@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Garbage collect one pair of needless parentheses in SQL code X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 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