summaryrefslogtreecommitdiff
path: root/src/process.c
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2014-09-15 18:53:23 +0400
committerDmitry Antipov <dmantipov@yandex.ru>2014-09-15 18:53:23 +0400
commitedb0288b83b45d295df52ce7644e897613358971 (patch)
tree8f169c257e9752ca860764cc19ec232d287eb189 /src/process.c
parent497daa12743ed71a70e41f966631d1c8856248cc (diff)
downloademacs-edb0288b83b45d295df52ce7644e897613358971.tar.gz
emacs-edb0288b83b45d295df52ce7644e897613358971.tar.bz2
emacs-edb0288b83b45d295df52ce7644e897613358971.zip
If USE_LOCAL_ALLOCATORS, allocate some Lisp objects on stack.
* lisp.h (local_cons, local_list1, local_list2, local_list3) [USE_LOCAL_ALLOCATORS]: New macros. [!USE_LOCAL_ALLOCATORS]: Fall back to regular functions. (build_local_string): Avoid argument name expansion clash with make_local_string. * alloc.c (toplevel) [USE_LOCAL_ALLOCATORS && GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS]: Preprocessor guard to avoid impossible configuration. * charset.c (Ffind_charset_region, Ffind_charset_string): Use make_local_vector. * lread.c (read1, substitute_object_recurse): Use scoped_cons. * textprop.c (Fput_text_property, Fadd_face_text_property): Use scoped_list2. (copy_text_properties): Use local_cons and local_list3. * chartab.c (uniprop_table): * data.c (wrong_choice, wrong_range): * doc.c (get_doc_string): * editfns.c (format2): * fileio.c (Fexpand_file_name, auto_save_error): * fns.c (Fyes_or_no_p): * font.c (font_parse_xlfd, font_parse_family_registry, font_add_log): * fontset.c (Fset_fontset_font): * keyboard.c (echo_add_key, echo_dash, parse_menu_item) (read_char_minibuf_menu_prompt): * keymap.c (silly_event_symbol_error, describe_vector): * menu.c (single_menu_item): * minibuf.c (Fread_buffer): * process.c (status_message, Fformat_network_address) (server_accept_connection): Use make_local_string and build_local_string. Prefer compound literals where appropriate.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c71
1 files changed, 30 insertions, 41 deletions
diff --git a/src/process.c b/src/process.c
index ef9f295fd89..41ca66671a9 100644
--- a/src/process.c
+++ b/src/process.c
@@ -620,7 +620,7 @@ status_message (struct Lisp_Process *p)
if (c1 != c2)
Faset (string, make_number (0), make_number (c2));
}
- string2 = build_string (coredump ? " (core dumped)\n" : "\n");
+ string2 = build_local_string (coredump ? " (core dumped)\n" : "\n");
return concat2 (string, string2);
}
else if (EQ (symbol, Qexit))
@@ -630,14 +630,14 @@ status_message (struct Lisp_Process *p)
if (code == 0)
return build_string ("finished\n");
string = Fnumber_to_string (make_number (code));
- string2 = build_string (coredump ? " (core dumped)\n" : "\n");
- return concat3 (build_string ("exited abnormally with code "),
+ string2 = build_local_string (coredump ? " (core dumped)\n" : "\n");
+ return concat3 (build_local_string ("exited abnormally with code "),
string, string2);
}
else if (EQ (symbol, Qfailed))
{
string = Fnumber_to_string (make_number (code));
- string2 = build_string ("\n");
+ string2 = build_local_string ("\n");
return concat3 (build_string ("failed with code "),
string, string2);
}
@@ -1305,22 +1305,22 @@ Returns nil if format of ADDRESS is invalid. */)
if (size == 4 || (size == 5 && !NILP (omit_port)))
{
- args[0] = build_string ("%d.%d.%d.%d");
+ args[0] = build_local_string ("%d.%d.%d.%d");
nargs = 4;
}
else if (size == 5)
{
- args[0] = build_string ("%d.%d.%d.%d:%d");
+ args[0] = build_local_string ("%d.%d.%d.%d:%d");
nargs = 5;
}
else if (size == 8 || (size == 9 && !NILP (omit_port)))
{
- args[0] = build_string ("%x:%x:%x:%x:%x:%x:%x:%x");
+ args[0] = build_local_string ("%x:%x:%x:%x:%x:%x:%x:%x");
nargs = 8;
}
else if (size == 9)
{
- args[0] = build_string ("[%x:%x:%x:%x:%x:%x:%x:%x]:%d");
+ args[0] = build_local_string ("[%x:%x:%x:%x:%x:%x:%x:%x]:%d");
nargs = 9;
}
else
@@ -1339,16 +1339,12 @@ Returns nil if format of ADDRESS is invalid. */)
args[i+1] = p->contents[i];
}
- return Fformat (nargs+1, args);
+ return Fformat (nargs + 1, args);
}
if (CONSP (address))
- {
- Lisp_Object args[2];
- args[0] = build_string ("<Family %d>");
- args[1] = Fcar (address);
- return Fformat (2, args);
- }
+ return Fformat (2, ((Lisp_Object [])
+ { build_local_string ("<Family %d>"), Fcar (address) }));
return Qnil;
}
@@ -4061,20 +4057,14 @@ server_accept_connection (Lisp_Object server, int channel)
{
case AF_INET:
{
- Lisp_Object args[5];
unsigned char *ip = (unsigned char *)&saddr.in.sin_addr.s_addr;
- args[0] = build_string ("%d.%d.%d.%d");
- args[1] = make_number (*ip++);
- args[2] = make_number (*ip++);
- args[3] = make_number (*ip++);
- args[4] = make_number (*ip++);
- host = Fformat (5, args);
- service = make_number (ntohs (saddr.in.sin_port));
- args[0] = build_string (" <%s:%d>");
- args[1] = host;
- args[2] = service;
- caller = Fformat (3, args);
+ host = Fformat (5, ((Lisp_Object [])
+ { build_local_string ("%d.%d.%d.%d"), make_number (*ip++),
+ make_number (*ip++), make_number (*ip++), make_number (*ip++) }));
+ service = make_number (ntohs (saddr.in.sin_port));
+ caller = Fformat (3, ((Lisp_Object [])
+ { build_local_string (" <%s:%d>"), host, service }));
}
break;
@@ -4084,16 +4074,14 @@ server_accept_connection (Lisp_Object server, int channel)
Lisp_Object args[9];
uint16_t *ip6 = (uint16_t *)&saddr.in6.sin6_addr;
int i;
- args[0] = build_string ("%x:%x:%x:%x:%x:%x:%x:%x");
+
+ args[0] = build_local_string ("%x:%x:%x:%x:%x:%x:%x:%x");
for (i = 0; i < 8; i++)
- args[i+1] = make_number (ntohs (ip6[i]));
+ args[i + 1] = make_number (ntohs (ip6[i]));
host = Fformat (9, args);
service = make_number (ntohs (saddr.in.sin_port));
-
- args[0] = build_string (" <[%s]:%d>");
- args[1] = host;
- args[2] = service;
- caller = Fformat (3, args);
+ caller = Fformat (3, ((Lisp_Object [])
+ { build_local_string (" <[%s]:%d>"), host, service }));
}
break;
#endif
@@ -4103,7 +4091,8 @@ server_accept_connection (Lisp_Object server, int channel)
#endif
default:
caller = Fnumber_to_string (make_number (connect_counter));
- caller = concat3 (build_string (" <"), caller, build_string (">"));
+ caller = concat3
+ (build_local_string (" <"), caller, build_local_string (">"));
break;
}
@@ -4202,14 +4191,14 @@ server_accept_connection (Lisp_Object server, int channel)
if (!NILP (ps->log))
call3 (ps->log, server, proc,
- concat3 (build_string ("accept from "),
- (STRINGP (host) ? host : build_string ("-")),
- build_string ("\n")));
+ concat3 (build_local_string ("accept from "),
+ (STRINGP (host) ? host : build_local_string ("-")),
+ build_local_string ("\n")));
exec_sentinel (proc,
- concat3 (build_string ("open from "),
- (STRINGP (host) ? host : build_string ("-")),
- build_string ("\n")));
+ concat3 (build_local_string ("open from "),
+ (STRINGP (host) ? host : build_local_string ("-")),
+ build_local_string ("\n")));
}
/* This variable is different from waiting_for_input in keyboard.c.