bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#47408: [PATCH] Etags support for Mercury -- fix explicit tags for ex


From: Eli Zaretskii
Subject: bug#47408: [PATCH] Etags support for Mercury -- fix explicit tags for existentially-quantified procedures
Date: Mon, 14 Jun 2021 19:04:04 +0300

> 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?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]