From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.devel Subject: Re: master d995429e7bc: Use SBYTES instead of strlen in treesit.c Date: Tue, 23 Jul 2024 13:42:55 -0700 Message-ID: References: <172164369582.30827.14373383262408294645@vcs2.savannah.gnu.org> <20240722102136.6C9D6C3534A@vcs2.savannah.gnu.org> <87o76pyb5h.fsf@yahoo.com> <8634o1br4c.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16956"; mail-complaints-to="usenet@ciao.gmane.io" Cc: luangruo@yahoo.com, emacs-devel@gnu.org, =?UTF-8?Q?Mattias_Engdeg=C3=A5rd?= To: Eli Zaretskii , Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jul 23 22:44:07 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 1sWMMh-0004LU-6h for ged-emacs-devel@m.gmane-mx.org; Tue, 23 Jul 2024 22:44:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sWMLe-0000ps-N2; Tue, 23 Jul 2024 16:43:02 -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 1sWMLc-0000Vd-T4 for emacs-devel@gnu.org; Tue, 23 Jul 2024 16:43:00 -0400 Original-Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sWMLa-0004hI-Hy; Tue, 23 Jul 2024 16:42:59 -0400 Original-Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5a156557026so5379394a12.2; Tue, 23 Jul 2024 13:42:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721767377; x=1722372177; darn=gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=HF9EPezy3kra34OTa1ecRdkPc20fFT/QH9IHvSAyLYc=; b=gQRfADIAHCY6mlAlKOKtIuWvupqQ9ipJYT1mq1/JRR0vWj6ATm3Ca5Oau1iHzlGkIq IqZARlXqiru67A5pT1BqHZEj8sGsBRkSTllfabRrFBfRLha5gG82LKF5niUVapmE0S0W 2wWDVlr5pii9a9Cx9/bgSlbhFFkW7NQXPaV48MSIhJRK2gdUGKRyGyALdqC9iAW9rzu4 IUdqh/RVWP3vgqoesiYzC/ZMDsYC0shKW4a7HuNBGyninFbyhklRrvGyKCWb/twdCaUi tNg4RkKDlb7qfry8K10Skpg4qBacDUpoRe7o4I8b57wUc4WzyjfIUM0U7QpoE0KjlaQ9 NVTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721767377; x=1722372177; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HF9EPezy3kra34OTa1ecRdkPc20fFT/QH9IHvSAyLYc=; b=IEiPBacazOCQGcNGKK7lvqr34USlKCG/mQuTWGJYWS6juR+2L4Tevc9Zzvu5DulLho /G4F98RAZgUJgw4c+P4ojTzKv419qVLJaK05XCmhoio1vmy++bev5HjBDjQ49qdcSKLD olaQl3kzDGqMXyWcn6mwEi7JD7kS1Ca1T8YLM99AY7u3nigIuOBjdx47u7xJPYEEQUiN hyybxa2Vt/ktMv89FQ9+9ZjNzSJqATyvgSggjS6FKNGhnUq3WKgAzapeQc4MTtECaRS6 rvt2cMiy6XME+1FdKJPeRrUmW+eYq+akiKXUoHRSRUVYDnYcArBDzvQprG9dJ3qhqpX7 pxow== X-Forwarded-Encrypted: i=1; AJvYcCWEiI3+85reOCPsEytBJJ57gKWBz+W4/DZbhAacEJ0EjPAgOjURWWhIacAZe6o6+EHuyNn8w0jIvk7jRiuYeRSeAdlC X-Gm-Message-State: AOJu0YyyTPi9VKDMOQNPPi5jWAHyDqqEUOZPY1iTwLKAZITo84tPCapk kn8ITv+uqHp+U/O+xRtN4JBJeqdAPynfeC95Lpuxp8JIbYMpTxsIIpOWtP5CcoNwnsfIQjn5tpy G1pgvdEZJGXF72/DLqiLHt2Ha7o65eleW X-Google-Smtp-Source: AGHT+IGCV1C8b8jZMtDr5c/RLhATsflFLD7hRC71XVJBAVw7b+8L8b0sC/WAi8ovbkzbvQeGSBzTInwumzZWLXnHC9k= X-Received: by 2002:a05:6402:350e:b0:595:71c7:39dd with SMTP id 4fb4d7f45d1cf-5a47ac0949emr8700173a12.34.1721767376522; Tue, 23 Jul 2024 13:42:56 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 23 Jul 2024 13:42:55 -0700 In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::52c; envelope-from=stefankangas@gmail.com; helo=mail-ed1-x52c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:322019 Archived-At: Stefan Kangas writes: > 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? Mattias, I see you introduced treesit_query_string_string. Do you have any thoughts about this?