From: Po Lu <luangruo@yahoo.com>
To: Yuan Fu <casouri@gmail.com>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: feature/tree-sitter 3069849bd4 4/4: * src/treesit.c (treesit_load_language): Fix uninitialized uses.
Date: Mon, 21 Nov 2022 19:59:28 +0800 [thread overview]
Message-ID: <87ilj85xi7.fsf@yahoo.com> (raw)
In-Reply-To: <A9F22D1E-776A-4082-80F4-BF77481DE330@gmail.com> (Yuan Fu's message of "Mon, 21 Nov 2022 01:37:13 -0800")
Yuan Fu <casouri@gmail.com> writes:
> branch: feature/tree-sitter
> commit 3069849bd4c1048a8f8c0467d26560fad939e791
> Author: Po Lu <luangruo@yahoo.com>
> Commit: Po Lu <luangruo@yahoo.com>
>
> * src/treesit.c (treesit_load_language): Fix uninitialized uses.
> ---
> src/treesit.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/src/treesit.c b/src/treesit.c
> index 291698e4e4..599a9b883e 100644
> --- a/src/treesit.c
> +++ b/src/treesit.c
> @@ -554,9 +554,11 @@ treesit_load_language (Lisp_Object language_symbol,
> when succeed, record the error message and try the next one when
> fail. */
> dynlib_handle_ptr handle;
> - char const *error;
> + const char *error;
>
> tail = path_candidates;
> + error = NULL;
> + handle = NULL;
>
> FOR_EACH_TAIL (tail)
> {
> @@ -568,6 +570,9 @@ treesit_load_language (Lisp_Object language_symbol,
> break;
> }
>
> + /* ??? */
> + eassume (handle != NULL);
> +
> if (error != NULL)
> {
> *signal_symbol = Qtreesit_load_language_error;
>
> Thanks for working on this. What does ??? mean? Why do we assume
> handle is not NULL?
handle can only be set if tail is non-nil, but I do not think that is
always the case.
The code below seemed to call dynlib_sym (handle, c_name) without any
checks. I was going to ask about it, but I forgot.
next prev parent reply other threads:[~2022-11-21 11:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-21 9:37 feature/tree-sitter 3069849bd4 4/4: * src/treesit.c (treesit_load_language): Fix uninitialized uses Yuan Fu
2022-11-21 11:59 ` Po Lu [this message]
2022-11-23 1:52 ` Yuan Fu
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=87ilj85xi7.fsf@yahoo.com \
--to=luangruo@yahoo.com \
--cc=casouri@gmail.com \
--cc=emacs-devel@gnu.org \
/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).