all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Kangas <stefankangas@gmail.com>
Cc: angelo.g0@libero.it, emacs-devel@gnu.org
Subject: Re: About the new frame title
Date: Sat, 14 Nov 2020 09:26:07 +0200	[thread overview]
Message-ID: <83eekwwga8.fsf@gnu.org> (raw)
In-Reply-To: <CADwFkmmKRxsEn9-AehT=oCJEdkA9Ga7stzQqgcxrTMXSCtPuhA@mail.gmail.com> (message from Stefan Kangas on Fri, 13 Nov 2020 15:10:27 -0800)

> From: Stefan Kangas <stefankangas@gmail.com>
> 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.



  parent reply	other threads:[~2020-11-14  7:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-14  8:27 About the new frame title Angelo Graziosi
2020-09-14 15:17 ` Eli Zaretskii
2020-09-14 15:52   ` Angelo Graziosi
2020-09-19 13:21     ` Stefan Kangas
2020-09-19 14:39       ` Eli Zaretskii
2020-09-24  8:57         ` Stefan Kangas
2020-09-24 14:46           ` Eli Zaretskii
2020-09-25 12:38             ` Angelo Graziosi
2020-09-25 12:41               ` Eli Zaretskii
2020-09-25 13:31                 ` Angelo Graziosi
2020-09-25 13:42                   ` Eli Zaretskii
2020-11-13 23:10             ` Stefan Kangas
2020-11-13 23:51               ` Andrea Corallo via Emacs development discussions.
2020-11-14  7:26               ` Eli Zaretskii [this message]
2020-11-14 14:47                 ` Stefan Kangas
2020-11-14 15:10                   ` Eli Zaretskii
2020-11-15  1:44                     ` Stefan Kangas
2020-09-19 21:22       ` Angelo Graziosi
2020-09-24  8:37         ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83eekwwga8.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=angelo.g0@libero.it \
    --cc=emacs-devel@gnu.org \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.