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.devel Subject: Re: master d995429e7bc: Use SBYTES instead of strlen in treesit.c Date: Mon, 22 Jul 2024 15:22:56 +0300 Message-ID: <86zfq9aa5b.fsf@gnu.org> References: <172164369582.30827.14373383262408294645@vcs2.savannah.gnu.org> <20240722102136.6C9D6C3534A@vcs2.savannah.gnu.org> <87o76pyb5h.fsf@yahoo.com> <8634o1br4c.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26361"; mail-complaints-to="usenet@ciao.gmane.io" Cc: casouri@gmail.com, luangruo@yahoo.com, emacs-devel@gnu.org To: Stefan Kangas Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jul 22 14:23:58 2024 Return-path: Envelope-to: ged-emacs-devel@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 1sVs58-0006ju-1n for ged-emacs-devel@m.gmane-mx.org; Mon, 22 Jul 2024 14:23:58 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sVs4J-0004Nb-48; Mon, 22 Jul 2024 08:23:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sVs4D-00042L-Nk for emacs-devel@gnu.org; Mon, 22 Jul 2024 08:23:03 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sVs4B-0002dM-Ta; Mon, 22 Jul 2024 08:23:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=t0BFXp5r5KQZnLAJZGB6k4EETBXbHNrB/UeO8EWUvy0=; b=oFZVNk4+YfJc q4A60CogsF7NS2/iYalkdN0h6d+a0lJoWml+MS1GSo7m2D9nu+FBv32422yJ+/6VUNsA62IItDA84 Na2NTHiSoJEQ6btQA05p8Kwd6NLcbuONQihfcao1cYZG9DetNhUTtIHE2ScJCw3oOrw64SiCSddsU 2L7bl+uP/2KxKg4XgMwCirYX14oEjk3+L7zwOqPBj+rbaUZl9/kpTuu2DO5+kfoGfsZ8mojt92yCj ZAo2nqNTrFYrrPxpr54iwUQf84CfkWD0sgnkrw01ZhiAMjcoR9huvXbmJyXlRSw9PKvyZHsq8hbfA RAegnZolodD5ac7FHzNbPA==; In-Reply-To: (message from Stefan Kangas on Mon, 22 Jul 2024 04:55:00 -0700) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:321937 Archived-At: > From: Stefan Kangas > Date: Mon, 22 Jul 2024 04:55:00 -0700 > Cc: luangruo@yahoo.com, emacs-devel@gnu.org > > Eli Zaretskii writes: > > >> > Have you verified that these functions accept strings holding '\0'? > >> > >> AFAIK, SBYTES returns the string length excluding '\0', same as strlen. > > > > That's not the issue here. The issue is that Emacs Lisp strings can > > include embedded null bytes, which strlen will exclude, but SBYTES > > will not. > > We avoid that when they are converted from a sexp (see > treesit_query_string_string). > > Perhaps we should do the same when we get a string? If that is what tree-sitter expects, yes. But does it?