emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About the new frame title


From: Eli Zaretskii
Subject: Re: About the new frame title
Date: Sat, 14 Nov 2020 09:26:07 +0200

> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]