From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.comp.lib.gnulib.bugs,gmane.emacs.devel Subject: [PATCH 4/4] dfa: minor simplification with emptyset Date: Tue, 10 Jan 2017 02:13:32 -0800 Message-ID: <20170110101332.15354-4-eggert@cs.ucla.edu> References: <20170110101332.15354-1-eggert@cs.ucla.edu> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1484043259 30101 195.159.176.226 (10 Jan 2017 10:14:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 10 Jan 2017 10:14:19 +0000 (UTC) Cc: Paul Eggert To: bug-gnulib@gnu.org, emacs-devel@gnu.org Original-X-From: bug-gnulib-bounces+gnu-bug-gnulib=m.gmane.org@gnu.org Tue Jan 10 11:14:16 2017 Return-path: Envelope-to: gnu-bug-gnulib@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cQtRM-00063u-2M for gnu-bug-gnulib@m.gmane.org; Tue, 10 Jan 2017 11:14:04 +0100 Original-Received: from localhost ([::1]:46114 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cQtRQ-0007JN-Gg for gnu-bug-gnulib@m.gmane.org; Tue, 10 Jan 2017 05:14:08 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49941) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cQtR7-0007I6-41 for bug-gnulib@gnu.org; Tue, 10 Jan 2017 05:13:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cQtR6-0002pY-Dg for bug-gnulib@gnu.org; Tue, 10 Jan 2017 05:13:49 -0500 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:57552) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cQtR6-0002pE-7D; Tue, 10 Jan 2017 05:13:48 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 4C14B160110; Tue, 10 Jan 2017 02:13:47 -0800 (PST) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id UjI_MrbX-Q7f; Tue, 10 Jan 2017 02:13:46 -0800 (PST) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 27104160101; Tue, 10 Jan 2017 02:13:46 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 7l0PZvY8laNY; Tue, 10 Jan 2017 02:13:46 -0800 (PST) Original-Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 07A751600F3; Tue, 10 Jan 2017 02:13:46 -0800 (PST) X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170110101332.15354-1-eggert@cs.ucla.edu> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 131.179.128.68 X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+gnu-bug-gnulib=m.gmane.org@gnu.org Original-Sender: "bug-gnulib" Xref: news.gmane.org gmane.comp.lib.gnulib.bugs:36713 gmane.emacs.devel:211183 Archived-At: * lib/dfa.c (build_state): Simplify by using emptyset. --- ChangeLog | 5 +++++ lib/dfa.c | 5 +---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e0b73b5..8fda293 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2017-01-10 Paul Eggert + + dfa: minor simplification with emptyset + * lib/dfa.c (build_state): Simplify by using emptyset. + 2017-01-09 Paul Eggert dfa: shrink constraints from 4 bits to 3 diff --git a/lib/dfa.c b/lib/dfa.c index 28678c2..5df27ea 100644 --- a/lib/dfa.c +++ b/lib/dfa.c @@ -2760,10 +2760,7 @@ build_state (state_num s, struct dfa *d, unsigned char uc) matches.w[j] &= d->syntax.letters.w[j] | d->syntax.newline.w[j]; /* If there are no characters left, there's no point in going on. */ - size_t j; - for (j = 0; j < CHARCLASS_WORDS && !matches.w[j]; j++) - continue; - if (j == CHARCLASS_WORDS) + if (emptyset (&matches)) continue; /* If we have reset the bit that made us declare "matched", reset -- 2.9.3