emacs-devel
[Top][All Lists]
Advanced

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

Re: Stylistic changes to tree-sitter code


From: Po Lu
Subject: Re: Stylistic changes to tree-sitter code
Date: Sat, 29 Oct 2022 13:44:55 +0800
User-agent: Gnus/5.13 (Gnus v5.13)

Yuan Fu <casouri@gmail.com> writes:

> Ah, yes, the patch compiles fine, though there is a segfault: I
> believe you forgot to initialized the tem variable.
>
> @@ -449,21 +453,28 @@ treesit_symbol_to_c_name (char *symbol_name)
>  treesit_find_override_name (Lisp_Object language_symbol, Lisp_Object *name,
>                           Lisp_Object *c_symbol)
>  {
> +  Lisp_Object tem;
> +
>    CHECK_LIST (Vtreesit_load_name_override_list);
> -  for (Lisp_Object list = Vtreesit_load_name_override_list;
> -       !NILP (list); list = XCDR (list))
> +
> +  FOR_EACH_TAIL (tem)
>      {
> -      Lisp_Object lang = XCAR (XCAR (list));
> +      Lisp_Object lang = XCAR (XCAR (tem));
>        CHECK_SYMBOL (lang);
> +
>        if (EQ (lang, language_symbol))
>       {
> -       *name = Fnth (make_fixnum (1), XCAR (list));
> +       *name = Fnth (make_fixnum (1), XCAR (tem));
>         CHECK_STRING (*name);
> -       *c_symbol = Fnth (make_fixnum (2), XCAR (list));
> +       *c_symbol = Fnth (make_fixnum (2), XCAR (tem));
>         CHECK_STRING (*c_symbol);
> +
>         return true;
>       }
>      }
> +
> +  CHECK_LIST_END (tem, Vtreesit_load_name_override_list);
> +
>    return false;
>  }

Right, so if you add "tem = Vtreesit_load_name_override_list" above
"FOR_EACH_TAIL (tem)", does it work?

> Also, out of curiosity, I thought active voice is good and passive
> voice is bad? Though the subject here doesn’t add any useful
> information, I recon.

But not in comments and documentation.  IME, a very important point in
writing documentation and comments is to avoid the use of pronouns
unless absolutely necessary: "I", "you", "we", et cetera.  Especially
"we", which is also so hard to avoid even I make the mistake of using it
occasionally.

Thanks.


reply via email to

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