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 49e243c0c85: Avoid resizing mutation in subst-char-in-string, take two Date: Mon, 13 May 2024 20:53:44 +0300 Message-ID: <865xvhy4wn.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5016"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Mattias =?iso-8859-1?Q?Engdeg=E5rd?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon May 13 19:54:43 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 1s6Zso-00018T-Uo for ged-emacs-devel@m.gmane-mx.org; Mon, 13 May 2024 19:54:42 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s6Zs4-0006fU-8A; Mon, 13 May 2024 13:53:56 -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 1s6Zs2-0006fA-JH for emacs-devel@gnu.org; Mon, 13 May 2024 13:53:54 -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 1s6Zs0-0001uZ-Rh; Mon, 13 May 2024 13:53:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:Subject:To:From:Date:in-reply-to: references; bh=YKbUyWuZWMcuQOUxV1wgX9gLQvebbjX0G5KFKvHe34g=; b=nyAXHv6HdVftRu LIgHMR7QsK9wj5buDqWdMoxqDHBx1kGUJabH3HOE+MkxIywY0M1hLGgy0VkAx+9td3Y3UlhAKC65Q bA+GNMbODO/GZrzMCVzXbYsBDUUiPWDhbNEXfRfui36gKZUJl1RDmjxiOQ7oKYssS6tHk30qZKE2J R9D1BLXJS1+5kQvqtoSKJTcq+9G9/GNr26C9ats8R6Xqth44wqfbNBmlrzHGiBR2mnk4UZ7haRpJO w07cshhL7eaLM33Z/otvbTyGvG/QKjnVpWzD3DtEes5cI1vSbwZlHB9rZ9sHD0YTNy5AUvhyiWWGT Fk8SdvbF1ytm3P2LJu7Q==; 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:319205 Archived-At: > + (if (and (not inplace) > + (if (multibyte-string-p string) > + (> (max fromchar tochar) 127) > + (> tochar 255))) Is the above condition correct? My reading of it is that if INPLACE is non-nil, we use aset (which will resize a string) even if TOCHAR needs more bytes than FROMCHAR. Which seems to be in contradiction with the goal of the change, as advertised by the log message: "avoid resizing mutation". Did I miss something? Btw, why, in the case of a multibyte STRING, does the code look at the codepoints of FROMCHAR and TOCHAR and not at the number of bytes they take in the internal Emacs representation of the characters?