1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-06 11:50:51 -08:00

Simplify make_formatted_string API

From a suggestion by Pip Cet.
* src/alloc.c (make_formatted_string): Omit first argument,
to simplify the calling convention.  All callers changed.
* src/doprnt.c (doprnt): Also support %u.  Update doc.
This commit is contained in:
Paul Eggert 2025-01-26 22:15:48 -08:00
parent bcfd4d21b0
commit f885806fdf
8 changed files with 44 additions and 58 deletions

View file

@ -1283,8 +1283,6 @@ static struct frame *
make_terminal_frame (struct terminal *terminal, Lisp_Object parent,
Lisp_Object params)
{
char name[sizeof "F" + INT_STRLEN_BOUND (tty_frame_count)];
if (!terminal->name)
error ("Terminal is not live, can't create new frames on it");
@ -1364,7 +1362,7 @@ make_terminal_frame (struct terminal *terminal, Lisp_Object parent,
XSETFRAME (frame, f);
Vframe_list = Fcons (frame, Vframe_list);
fset_name (f, make_formatted_string (name, "F%"PRIdMAX, ++tty_frame_count));
fset_name (f, make_formatted_string ("F%"PRIdMAX, ++tty_frame_count));
SET_FRAME_VISIBLE (f, true);
@ -3504,14 +3502,12 @@ set_term_frame_name (struct frame *f, Lisp_Object name)
/* If NAME is nil, set the name to F<num>. */
if (NILP (name))
{
char namebuf[sizeof "F" + INT_STRLEN_BOUND (tty_frame_count)];
/* Check for no change needed in this very common case
before we do any consing. */
if (frame_name_fnn_p (SSDATA (f->name), SBYTES (f->name)))
return;
name = make_formatted_string (namebuf, "F%"PRIdMAX, ++tty_frame_count);
name = make_formatted_string ("F%"PRIdMAX, ++tty_frame_count);
}
else
{
@ -4938,7 +4934,6 @@ gui_report_frame_params (struct frame *f, Lisp_Object *alistptr)
{
Lisp_Object tem;
uintmax_t w;
char buf[INT_BUFSIZE_BOUND (w)];
/* Represent negative positions (off the top or left screen edge)
in a way that Fmodify_frame_parameters will understand correctly. */
@ -4989,7 +4984,7 @@ gui_report_frame_params (struct frame *f, Lisp_Object *alistptr)
warnings. */
w = (uintptr_t) FRAME_NATIVE_WINDOW (f);
store_in_alist (alistptr, Qwindow_id,
make_formatted_string (buf, "%"PRIuMAX, w));
make_formatted_string ("%"PRIuMAX, w));
#ifdef HAVE_X_WINDOWS
#ifdef USE_X_TOOLKIT
/* Tooltip frame may not have this widget. */
@ -4997,7 +4992,7 @@ gui_report_frame_params (struct frame *f, Lisp_Object *alistptr)
#endif
w = (uintptr_t) FRAME_OUTER_WINDOW (f);
store_in_alist (alistptr, Qouter_window_id,
make_formatted_string (buf, "%"PRIuMAX, w));
make_formatted_string ("%"PRIuMAX, w));
#endif
store_in_alist (alistptr, Qicon_name, f->icon_name);
store_in_alist (alistptr, Qvisibility,