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: Mon, 22 Jul 2024 04:55:00 -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="26048"; mail-complaints-to="usenet@ciao.gmane.io" Cc: luangruo@yahoo.com, emacs-devel@gnu.org To: Eli Zaretskii , Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jul 22 13:55:53 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 1sVrdw-0006Yb-BE for ged-emacs-devel@m.gmane-mx.org; Mon, 22 Jul 2024 13:55:52 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sVrdG-0006Nr-56; Mon, 22 Jul 2024 07:55:10 -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 1sVrdB-00067s-NW for emacs-devel@gnu.org; Mon, 22 Jul 2024 07:55:05 -0400 Original-Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sVrd9-00052J-Nd; Mon, 22 Jul 2024 07:55:05 -0400 Original-Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-595856e2336so4661703a12.1; Mon, 22 Jul 2024 04:55:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721649301; x=1722254101; 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=5xJpo84bzbhh7mMligwtYyvZj6bNtxQiSIDJEfzsSzA=; b=hPDLHO3oi2fGaIJ5iX/98kiRD6xhsbF6Q/ndtfmC9jZ3BVEEZp+n6zPPyUjAIOa2ZT OyvvB6Y+EUUxzI7oz1JauLo4wSM1D0Sm4NRDbSD4tG7QAcrMYZtbYdZXINzy3IBSbyzd wbyrOXkc+wH+3imZlJuXwSn/1XkQxt9RgEfYREvca9cA8JKRKnO92ZqPLBRifYs61tq0 AAakbdH0KnKoG3eOEUCRQboSKfl3B6HXEuBazWFToMHFBXujXNf1rh2iDX5RFzhJbwoZ Jw8Z6kr68tp5TUZ4nE6xaScRNhYtIFpO6mNPCEwhjd7p7Dj9S4E07D3HHXA77tG/w7Kh JVIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721649301; x=1722254101; 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=5xJpo84bzbhh7mMligwtYyvZj6bNtxQiSIDJEfzsSzA=; b=hg+XNqra5lfX0h0R+N9y+sfe/K/l8nMEQu4jw1S3VgOp3+hJf2cmAq7PLs6SCjJLLA x2L+l8FQIe6MnMo2Ahw69YAHMBpkilxQwmGlOsqV+IF5PrB4uCdTiBbVNhz0fRLBzXa8 cEuPw6u9DTJMAyCbkXZ4r9neZ0XjcubuBxi/n3+ebpCouMtgds3UsRPzYeGGOfdlMLQV 0KRColWNVQaWnPdx545VF0+UW1F4oR+adbiTRk/01ijHCzOfRl5eJWofN5GyonZ6nadS Vajh44LsMy3NkTlXau6gsyP2vGVEUmggGTEPMw0vvguNKSaO5EHoV1jkpdQ9Mkv1OrY1 qr/Q== X-Forwarded-Encrypted: i=1; AJvYcCVwm37JLkYd6yssiL7a8zJM5vdJzD+Lr0jQRWQXOcUdIcly96w4uvW9jIwhi5nk5Rjc2zfLOtjgetRK7CT4BhtlhTeq X-Gm-Message-State: AOJu0Yzbv0YndqSCp8UeGfk6za50Jf1ziu7ZMcwWy3DPRrTL9cq5bfq6 AFNcSc5HuHAqGMjEcDrnfeuLZhGLU4xOSHMen4EgrTATun4a73AELKTf7veuGAbO7AqEsGsW86r pSLmKyjLctN3iaEM3nLRYVR2gmJlt3/RK X-Google-Smtp-Source: AGHT+IE5fbi0Rqjw4hh6ZJD1S3GZ+cygNbiRgEdULjpBFF7Bhj3fkgikEJzvAaaRT1/IEz5rMQMenJNcQcndewfhynE= X-Received: by 2002:a50:9f6d:0:b0:59e:bd8b:53eb with SMTP id 4fb4d7f45d1cf-5a40cf09a02mr6125912a12.9.1721649301200; Mon, 22 Jul 2024 04:55:01 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 22 Jul 2024 04:55:00 -0700 In-Reply-To: <8634o1br4c.fsf@gnu.org> Received-SPF: pass client-ip=2a00:1450:4864:20::52f; envelope-from=stefankangas@gmail.com; helo=mail-ed1-x52f.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:321935 Archived-At: 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?