aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorPaul Eggert2014-09-30 20:28:16 -0700
committerPaul Eggert2014-09-30 20:28:16 -0700
commit27900ac72a8959291062eda9ef5eda9fc3f8595f (patch)
tree780e22aa62de9c01e3faf00e5c123b1dfb87ddd3 /src/process.c
parentcebe0e68947ec46b44f5c3c9868814f8a5464173 (diff)
downloademacs-27900ac72a8959291062eda9ef5eda9fc3f8595f.tar.gz
emacs-27900ac72a8959291062eda9ef5eda9fc3f8595f.zip
Use AUTO_CONS instead of SCOPED_CONS, etc.
* doc/lispref/internals.texi (Stack-allocated Objects): Adjust to match the revised, less error-prone macros. * src/frame.h (AUTO_FRAME_ARG): Rename from FRAME_PARAMETER. * src/lisp.h (AUTO_CONS): Rename from scoped_cons. (AUTO_LIST1): Rename from scoped_list1. (AUTO_LIST2): Rename from scoped_list2. (AUTO_LIST3): Rename from scoped_list3. (AUTO_LIST4): Rename from scoped_list4. (AUTO_STRING): Rename from SCOPED_STRING. * src/frame.h (AUTO_FRAME_ARG): * src/lisp.h (AUTO_CONS, AUTO_LIST1, AUTO_LIST2, AUTO_LIST3) (AUTO_LIST4, AUTO_STRING): Prepend a new argument 'name'. Declare a variable instead of yielding a value. All uses changed. * src/lisp.h (STACK_CONS, AUTO_CONS_EXPR): New internal macros.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c66
1 files changed, 37 insertions, 29 deletions
diff --git a/src/process.c b/src/process.c
index 6d059af9cc8..f767ae05e96 100644
--- a/src/process.c
+++ b/src/process.c
@@ -596,7 +596,7 @@ status_message (struct Lisp_Process *p)
596 Lisp_Object symbol; 596 Lisp_Object symbol;
597 int code; 597 int code;
598 bool coredump; 598 bool coredump;
599 Lisp_Object string, string2; 599 Lisp_Object string;
600 600
601 decode_status (status, &symbol, &code, &coredump); 601 decode_status (status, &symbol, &code, &coredump);
602 602
@@ -620,8 +620,8 @@ status_message (struct Lisp_Process *p)
620 if (c1 != c2) 620 if (c1 != c2)
621 Faset (string, make_number (0), make_number (c2)); 621 Faset (string, make_number (0), make_number (c2));
622 } 622 }
623 string2 = SCOPED_STRING (coredump ? " (core dumped)\n" : "\n"); 623 AUTO_STRING (suffix, coredump ? " (core dumped)\n" : "\n");
624 return concat2 (string, string2); 624 return concat2 (string, suffix);
625 } 625 }
626 else if (EQ (symbol, Qexit)) 626 else if (EQ (symbol, Qexit))
627 { 627 {
@@ -629,17 +629,17 @@ status_message (struct Lisp_Process *p)
629 return build_string (code == 0 ? "deleted\n" : "connection broken by remote peer\n"); 629 return build_string (code == 0 ? "deleted\n" : "connection broken by remote peer\n");
630 if (code == 0) 630 if (code == 0)
631 return build_string ("finished\n"); 631 return build_string ("finished\n");
632 AUTO_STRING (prefix, "exited abnormally with code ");
632 string = Fnumber_to_string (make_number (code)); 633 string = Fnumber_to_string (make_number (code));
633 string2 = SCOPED_STRING (coredump ? " (core dumped)\n" : "\n"); 634 AUTO_STRING (suffix, coredump ? " (core dumped)\n" : "\n");
634 return concat3 (SCOPED_STRING ("exited abnormally with code "), 635 return concat3 (prefix, string, suffix);
635 string, string2);
636 } 636 }
637 else if (EQ (symbol, Qfailed)) 637 else if (EQ (symbol, Qfailed))
638 { 638 {
639 AUTO_STRING (prefix, "failed with code ");
639 string = Fnumber_to_string (make_number (code)); 640 string = Fnumber_to_string (make_number (code));
640 string2 = SCOPED_STRING ("\n"); 641 AUTO_STRING (suffix, "\n");
641 return concat3 (SCOPED_STRING ("failed with code "), 642 return concat3 (prefix, string, suffix);
642 string, string2);
643 } 643 }
644 else 644 else
645 return Fcopy_sequence (Fsymbol_name (symbol)); 645 return Fcopy_sequence (Fsymbol_name (symbol));
@@ -1327,7 +1327,8 @@ Returns nil if format of ADDRESS is invalid. */)
1327 else 1327 else
1328 return Qnil; 1328 return Qnil;
1329 1329
1330 args[0] = SCOPED_STRING (format); 1330 AUTO_STRING (format_obj, format);
1331 args[0] = format_obj;
1331 1332
1332 for (i = 0; i < nargs; i++) 1333 for (i = 0; i < nargs; i++)
1333 { 1334 {
@@ -1346,8 +1347,10 @@ Returns nil if format of ADDRESS is invalid. */)
1346 } 1347 }
1347 1348
1348 if (CONSP (address)) 1349 if (CONSP (address))
1349 return Fformat (2, ((Lisp_Object []) 1350 {
1350 { SCOPED_STRING ("<Family %d>"), Fcar (address) })); 1351 AUTO_STRING (format, "<Family %d>");
1352 return Fformat (2, (Lisp_Object []) {format, Fcar (address)});
1353 }
1351 1354
1352 return Qnil; 1355 return Qnil;
1353} 1356}
@@ -4062,12 +4065,13 @@ server_accept_connection (Lisp_Object server, int channel)
4062 { 4065 {
4063 unsigned char *ip = (unsigned char *)&saddr.in.sin_addr.s_addr; 4066 unsigned char *ip = (unsigned char *)&saddr.in.sin_addr.s_addr;
4064 4067
4068 AUTO_STRING (ipv4_format, "%d.%d.%d.%d");
4065 host = Fformat (5, ((Lisp_Object []) 4069 host = Fformat (5, ((Lisp_Object [])
4066 { SCOPED_STRING ("%d.%d.%d.%d"), make_number (ip[0]), 4070 { ipv4_format, make_number (ip[0]),
4067 make_number (ip[1]), make_number (ip[2]), make_number (ip[3]) })); 4071 make_number (ip[1]), make_number (ip[2]), make_number (ip[3]) }));
4068 service = make_number (ntohs (saddr.in.sin_port)); 4072 service = make_number (ntohs (saddr.in.sin_port));
4069 caller = Fformat (3, ((Lisp_Object []) 4073 AUTO_STRING (caller_format, " <%s:%d>");
4070 { SCOPED_STRING (" <%s:%d>"), host, service })); 4074 caller = Fformat (3, (Lisp_Object []) {caller_format, host, service});
4071 } 4075 }
4072 break; 4076 break;
4073 4077
@@ -4078,13 +4082,14 @@ server_accept_connection (Lisp_Object server, int channel)
4078 uint16_t *ip6 = (uint16_t *)&saddr.in6.sin6_addr; 4082 uint16_t *ip6 = (uint16_t *)&saddr.in6.sin6_addr;
4079 int i; 4083 int i;
4080 4084
4081 args[0] = SCOPED_STRING ("%x:%x:%x:%x:%x:%x:%x:%x"); 4085 AUTO_STRING (ipv6_format, "%x:%x:%x:%x:%x:%x:%x:%x");
4086 args[0] = ipv6_format;
4082 for (i = 0; i < 8; i++) 4087 for (i = 0; i < 8; i++)
4083 args[i + 1] = make_number (ntohs (ip6[i])); 4088 args[i + 1] = make_number (ntohs (ip6[i]));
4084 host = Fformat (9, args); 4089 host = Fformat (9, args);
4085 service = make_number (ntohs (saddr.in.sin_port)); 4090 service = make_number (ntohs (saddr.in.sin_port));
4086 caller = Fformat (3, ((Lisp_Object []) 4091 AUTO_STRING (caller_format, " <[%s]:%d>");
4087 { SCOPED_STRING (" <[%s]:%d>"), host, service })); 4092 caller = Fformat (3, (Lisp_Object []) {caller_format, host, service});
4088 } 4093 }
4089 break; 4094 break;
4090#endif 4095#endif
@@ -4094,8 +4099,9 @@ server_accept_connection (Lisp_Object server, int channel)
4094#endif 4099#endif
4095 default: 4100 default:
4096 caller = Fnumber_to_string (make_number (connect_counter)); 4101 caller = Fnumber_to_string (make_number (connect_counter));
4097 caller = concat3 4102 AUTO_STRING (space_lessthan, " <");
4098 (SCOPED_STRING (" <"), caller, SCOPED_STRING (">")); 4103 AUTO_STRING (greaterthan, ">");
4104 caller = concat3 (space_lessthan, caller, greaterthan);
4099 break; 4105 break;
4100 } 4106 }
4101 4107
@@ -4192,16 +4198,18 @@ server_accept_connection (Lisp_Object server, int channel)
4192 p->inherit_coding_system_flag 4198 p->inherit_coding_system_flag
4193 = (NILP (buffer) ? 0 : ps->inherit_coding_system_flag); 4199 = (NILP (buffer) ? 0 : ps->inherit_coding_system_flag);
4194 4200
4201 AUTO_STRING (dash, "-");
4202 AUTO_STRING (nl, "\n");
4203 Lisp_Object host_string = STRINGP (host) ? host : dash;
4204
4195 if (!NILP (ps->log)) 4205 if (!NILP (ps->log))
4196 call3 (ps->log, server, proc, 4206 {
4197 concat3 (SCOPED_STRING ("accept from "), 4207 AUTO_STRING (accept_from, "accept from ");
4198 (STRINGP (host) ? host : SCOPED_STRING ("-")), 4208 call3 (ps->log, server, proc, concat3 (accept_from, host_string, nl));
4199 SCOPED_STRING ("\n"))); 4209 }
4200 4210
4201 exec_sentinel (proc, 4211 AUTO_STRING (open_from, "open from ");
4202 concat3 (SCOPED_STRING ("open from "), 4212 exec_sentinel (proc, concat3 (open_from, host_string, nl));
4203 (STRINGP (host) ? host : SCOPED_STRING ("-")),
4204 SCOPED_STRING ("\n")));
4205} 4213}
4206 4214
4207/* This variable is different from waiting_for_input in keyboard.c. 4215/* This variable is different from waiting_for_input in keyboard.c.