diff options
| author | Paul Eggert <eggert@cs.ucla.edu> | 2014-09-30 20:28:16 -0700 |
|---|---|---|
| committer | Paul Eggert <eggert@cs.ucla.edu> | 2014-09-30 20:28:16 -0700 |
| commit | 27900ac72a8959291062eda9ef5eda9fc3f8595f (patch) | |
| tree | 780e22aa62de9c01e3faf00e5c123b1dfb87ddd3 /src/process.c | |
| parent | cebe0e68947ec46b44f5c3c9868814f8a5464173 (diff) | |
| download | emacs-27900ac72a8959291062eda9ef5eda9fc3f8595f.tar.gz | |
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.c | 66 |
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) Lisp_Object symbol; int code; bool coredump; - Lisp_Object string, string2; + Lisp_Object string; decode_status (status, &symbol, &code, &coredump); @@ -620,8 +620,8 @@ status_message (struct Lisp_Process *p) if (c1 != c2) Faset (string, make_number (0), make_number (c2)); } - string2 = SCOPED_STRING (coredump ? " (core dumped)\n" : "\n"); - return concat2 (string, string2); + AUTO_STRING (suffix, coredump ? " (core dumped)\n" : "\n"); + return concat2 (string, suffix); } else if (EQ (symbol, Qexit)) { @@ -629,17 +629,17 @@ status_message (struct Lisp_Process *p) return build_string (code == 0 ? "deleted\n" : "connection broken by remote peer\n"); if (code == 0) return build_string ("finished\n"); + AUTO_STRING (prefix, "exited abnormally with code "); string = Fnumber_to_string (make_number (code)); - string2 = SCOPED_STRING (coredump ? " (core dumped)\n" : "\n"); - return concat3 (SCOPED_STRING ("exited abnormally with code "), - string, string2); + AUTO_STRING (suffix, coredump ? " (core dumped)\n" : "\n"); + return concat3 (prefix, string, suffix); } else if (EQ (symbol, Qfailed)) { + AUTO_STRING (prefix, "failed with code "); string = Fnumber_to_string (make_number (code)); - string2 = SCOPED_STRING ("\n"); - return concat3 (SCOPED_STRING ("failed with code "), - string, string2); + AUTO_STRING (suffix, "\n"); + return concat3 (prefix, string, suffix); } else return Fcopy_sequence (Fsymbol_name (symbol)); @@ -1327,7 +1327,8 @@ Returns nil if format of ADDRESS is invalid. */) else return Qnil; - args[0] = SCOPED_STRING (format); + AUTO_STRING (format_obj, format); + args[0] = format_obj; for (i = 0; i < nargs; i++) { @@ -1346,8 +1347,10 @@ Returns nil if format of ADDRESS is invalid. */) } if (CONSP (address)) - return Fformat (2, ((Lisp_Object []) - { SCOPED_STRING ("<Family %d>"), Fcar (address) })); + { + AUTO_STRING (format, "<Family %d>"); + return Fformat (2, (Lisp_Object []) {format, Fcar (address)}); + } return Qnil; } @@ -4062,12 +4065,13 @@ server_accept_connection (Lisp_Object server, int channel) { unsigned char *ip = (unsigned char *)&saddr.in.sin_addr.s_addr; + AUTO_STRING (ipv4_format, "%d.%d.%d.%d"); host = Fformat (5, ((Lisp_Object []) - { SCOPED_STRING ("%d.%d.%d.%d"), make_number (ip[0]), + { ipv4_format, make_number (ip[0]), make_number (ip[1]), make_number (ip[2]), make_number (ip[3]) })); service = make_number (ntohs (saddr.in.sin_port)); - caller = Fformat (3, ((Lisp_Object []) - { SCOPED_STRING (" <%s:%d>"), host, service })); + AUTO_STRING (caller_format, " <%s:%d>"); + caller = Fformat (3, (Lisp_Object []) {caller_format, host, service}); } break; @@ -4078,13 +4082,14 @@ server_accept_connection (Lisp_Object server, int channel) uint16_t *ip6 = (uint16_t *)&saddr.in6.sin6_addr; int i; - args[0] = SCOPED_STRING ("%x:%x:%x:%x:%x:%x:%x:%x"); + AUTO_STRING (ipv6_format, "%x:%x:%x:%x:%x:%x:%x:%x"); + args[0] = ipv6_format; for (i = 0; i < 8; i++) args[i + 1] = make_number (ntohs (ip6[i])); host = Fformat (9, args); service = make_number (ntohs (saddr.in.sin_port)); - caller = Fformat (3, ((Lisp_Object []) - { SCOPED_STRING (" <[%s]:%d>"), host, service })); + AUTO_STRING (caller_format, " <[%s]:%d>"); + caller = Fformat (3, (Lisp_Object []) {caller_format, host, service}); } break; #endif @@ -4094,8 +4099,9 @@ server_accept_connection (Lisp_Object server, int channel) #endif default: caller = Fnumber_to_string (make_number (connect_counter)); - caller = concat3 - (SCOPED_STRING (" <"), caller, SCOPED_STRING (">")); + AUTO_STRING (space_lessthan, " <"); + AUTO_STRING (greaterthan, ">"); + caller = concat3 (space_lessthan, caller, greaterthan); break; } @@ -4192,16 +4198,18 @@ server_accept_connection (Lisp_Object server, int channel) p->inherit_coding_system_flag = (NILP (buffer) ? 0 : ps->inherit_coding_system_flag); + AUTO_STRING (dash, "-"); + AUTO_STRING (nl, "\n"); + Lisp_Object host_string = STRINGP (host) ? host : dash; + if (!NILP (ps->log)) - call3 (ps->log, server, proc, - concat3 (SCOPED_STRING ("accept from "), - (STRINGP (host) ? host : SCOPED_STRING ("-")), - SCOPED_STRING ("\n"))); - - exec_sentinel (proc, - concat3 (SCOPED_STRING ("open from "), - (STRINGP (host) ? host : SCOPED_STRING ("-")), - SCOPED_STRING ("\n"))); + { + AUTO_STRING (accept_from, "accept from "); + call3 (ps->log, server, proc, concat3 (accept_from, host_string, nl)); + } + + AUTO_STRING (open_from, "open from "); + exec_sentinel (proc, concat3 (open_from, host_string, nl)); } /* This variable is different from waiting_for_input in keyboard.c. |
