From: Eli Zaretskii <eliz@gnu.org>
To: fabrice nicol <fabrnicol@gmail.com>
Cc: 47408@debbugs.gnu.org
Subject: bug#47408: [PATCH] Etags support for Mercury -- fix explicit tags for existentially-quantified procedures
Date: Mon, 14 Jun 2021 19:04:04 +0300 [thread overview]
Message-ID: <83lf7c5t6z.fsf@gnu.org> (raw)
In-Reply-To: <46bb9128-8bf5-e24c-2172-1cbb4202ee1d@gmail.com> (message from fabrice nicol on Mon, 14 Jun 2021 17:10:26 +0200)
> From: fabrice nicol <fabrnicol@gmail.com>
> 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?
next prev parent reply other threads:[~2021-06-14 16:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.12421.1623412982.2554.bug-gnu-emacs@gnu.org>
2021-06-14 15:10 ` bug#47408: [PATCH] Etags support for Mercury -- fix explicit tags for existentially-quantified procedures fabrice nicol
2021-06-14 16:04 ` Eli Zaretskii [this message]
2021-06-14 17:10 ` fabrice nicol
2021-06-14 17:42 ` Eli Zaretskii
2021-06-14 18:52 ` fabrice nicol
2021-06-17 10:50 ` Eli Zaretskii
2021-06-17 11:19 ` Fabrice Nicol
2021-06-17 11:42 ` Eli Zaretskii
2021-06-17 18:36 ` fabrice nicol
2021-06-18 11:29 ` Eli Zaretskii
2021-06-18 11:54 ` Francesco Potortì
2021-06-18 12:33 ` Eli Zaretskii
2021-06-18 13:53 ` fabrice nicol
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83lf7c5t6z.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=47408@debbugs.gnu.org \
--cc=fabrnicol@gmail.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).