From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#47408: [PATCH] Etags support for Mercury -- fix explicit tags for existentially-quantified procedures Date: Mon, 14 Jun 2021 19:04:04 +0300 Message-ID: <83lf7c5t6z.fsf@gnu.org> References: <46bb9128-8bf5-e24c-2172-1cbb4202ee1d@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11015"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 47408@debbugs.gnu.org To: fabrice nicol Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jun 14 18:05:40 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lsp5o-0002j0-1g for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 14 Jun 2021 18:05:40 +0200 Original-Received: from localhost ([::1]:46844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lsp5n-0006ec-0r for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 14 Jun 2021 12:05:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60472) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lsp5C-0006cy-OG for bug-gnu-emacs@gnu.org; Mon, 14 Jun 2021 12:05:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36135) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lsp5C-0006sE-Hg for bug-gnu-emacs@gnu.org; Mon, 14 Jun 2021 12:05:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lsp5C-0004zt-5A for bug-gnu-emacs@gnu.org; Mon, 14 Jun 2021 12:05:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 14 Jun 2021 16:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47408 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 47408-submit@debbugs.gnu.org id=B47408.162368666019134 (code B ref 47408); Mon, 14 Jun 2021 16:05:02 +0000 Original-Received: (at 47408) by debbugs.gnu.org; 14 Jun 2021 16:04:20 +0000 Original-Received: from localhost ([127.0.0.1]:47681 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lsp4V-0004yY-OP for submit@debbugs.gnu.org; Mon, 14 Jun 2021 12:04:19 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:34280) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lsp4U-0004yF-DK for 47408@debbugs.gnu.org; Mon, 14 Jun 2021 12:04:18 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:49886) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lsp4O-0006RG-BH; Mon, 14 Jun 2021 12:04:12 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1074 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lsp4K-0006gs-Fb; Mon, 14 Jun 2021 12:04:12 -0400 In-Reply-To: <46bb9128-8bf5-e24c-2172-1cbb4202ee1d@gmail.com> (message from fabrice nicol on Mon, 14 Jun 2021 17:10:26 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:208510 Archived-At: > From: fabrice nicol > Date: Mon, 14 Jun 2021 17:10:26 +0200 > > I'm sending the announced patch, which enables existentially-quantified > procedures for both etags and ctags in Mercury etags/ctags support. > > Taking advantage of this to revise my prior contribution, I fixed an > incidental issue (single-word declarations, which are very rare, were > not tagged). Thanks. I didn't yet try to apply and run the patch, but one aspect of the patch caused me to raise mu brow: > + char *name = xnew (pos + 1, char); > + size_t namelength = position.namelength; > + if (stop_at_rule && offset) --offset; > + > + /* Left-trim type definitions. */ > + > + while (pos > namelength + offset > + && c_isspace (s[pos - namelength - offset])) > + --offset; > + > + memcpy (name, s + pos - namelength - offset, namelength); > + > + /* There is no need to correct namelength or call notinname. */ > + name[namelength - 1] = '\0'; > + > + make_tag (name, namelength, true, s, pos, lineno, linecharno); > + free (name); Why do you copy the identifier's name into a newly-allocated buffer, instead of just passing 's + pos - namelength - offset' and 'namelength' as the first 2 arguments of make_tag? Isn't this xnew+memcpy+free dance here redundant? Or what did I miss?