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: About the new frame title Date: Sat, 14 Nov 2020 09:26:07 +0200 Message-ID: <83eekwwga8.fsf@gnu.org> References: <963461223.1300042.1600072070148@mail1.libero.it> <83sgbk9ylm.fsf@gnu.org> <152448855.1272757.1600098758378@mail1.libero.it> <83imc93k5d.fsf@gnu.org> <83sgb7tepo.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36275"; mail-complaints-to="usenet@ciao.gmane.io" Cc: angelo.g0@libero.it, emacs-devel@gnu.org To: Stefan Kangas Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 14 08:26:53 2020 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 1kdpxV-0009Lo-Kn for ged-emacs-devel@m.gmane-mx.org; Sat, 14 Nov 2020 08:26:53 +0100 Original-Received: from localhost ([::1]:45338 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdpxU-0003at-Li for ged-emacs-devel@m.gmane-mx.org; Sat, 14 Nov 2020 02:26:52 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56914) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdpx0-0003AR-7m for emacs-devel@gnu.org; Sat, 14 Nov 2020 02:26:22 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:51184) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdpwz-0001KK-IJ; Sat, 14 Nov 2020 02:26:21 -0500 Original-Received: from [176.228.60.248] (port=3905 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kdpwy-0002hO-NT; Sat, 14 Nov 2020 02:26:21 -0500 In-Reply-To: (message from Stefan Kangas on Fri, 13 Nov 2020 15:10:27 -0800) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.devel:259162 Archived-At: > From: Stefan Kangas > Date: Fri, 13 Nov 2020 15:10:27 -0800 > Cc: angelo.g0@libero.it, emacs-devel@gnu.org > > Please find attached a fixed patch. Thanks. In addition to comments from Andrea, I have a few minor nits below. > if (STRINGP (Vsystem_name)) > { > - dpyinfo->w32_id_name = xmalloc (SCHARS (Vinvocation_name) > - + SCHARS (Vsystem_name) + 2); > - sprintf (dpyinfo->w32_id_name, "%s@%s", > - SDATA (Vinvocation_name), SDATA (Vsystem_name)); > + static char const title[] = "GNU Emacs at "; > + dpyinfo->w32_id_name = xmalloc (sizeof title + SCHARS (Vsystem_name)); > + sprintf (dpyinfo->w32_id_name, "%s%s", title, SDATA (Vsystem_name)); > } > else > - dpyinfo->w32_id_name = xlispstrdup (Vinvocation_name); > + { > + static char const title[] = "GNU Emacs"; > + dpyinfo->w32_id_name = xmalloc (sizeof title); > + sprintf (dpyinfo->w32_id_name, "%s", title); > + } Can we have just one const char variable with "GNU Emacs" and another with " at "? I think this would be somewhat cleaner, and also save us a tiny amount of memory. And the same in xterm.c. > if (STRINGP (system_name)) > { > - *nametail++ = '@'; > - lispstpcpy (nametail, system_name); > + static char const title[] = "GNU Emacs at "; > + ptrdiff_t nbytes = sizeof title; > + if (INT_ADD_WRAPV (nbytes, SBYTES (system_name), &nbytes)) > + memory_full (SIZE_MAX); I see no reason to use INT_ADD_WRAPV in xterm.c, but not in w32term.c. Let's do the same either in both places or in none of them.