aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorPaul Eggert2013-07-15 23:39:49 -0700
committerPaul Eggert2013-07-15 23:39:49 -0700
commit6c6f1994bf684f510d600bd18023fa01b4b06500 (patch)
tree04b7125d1327d8419024f28d14bfb384afc52cdd /src/process.c
parent8abee653a22b0b879a9376c1dce3e3ca2e2f31d6 (diff)
downloademacs-6c6f1994bf684f510d600bd18023fa01b4b06500.tar.gz
emacs-6c6f1994bf684f510d600bd18023fa01b4b06500.zip
Prefer list1 (X) to Fcons (X, Qnil) when building lists.
This makes the code easier to read and the executable a bit smaller. Do not replace all calls to Fcons that happen to create lists, just calls that are intended to create lists. For example, when creating an alist that maps FOO to nil, use list1 (Fcons (FOO, Qnil)) rather than list1 (list1 (FOO)) or Fcons (Fcons (FOO, Qnil), Qnil). Similarly for list2 through list5. * buffer.c (Fget_buffer_create, Fmake_indirect_buffer): * bytecode.c (exec_byte_code): * callint.c (quotify_arg, Fcall_interactively): * callproc.c (Fcall_process, create_temp_file): * charset.c (load_charset_map_from_file) (Fdefine_charset_internal, init_charset): * coding.c (get_translation_table, detect_coding_system) (Fcheck_coding_systems_region) (Fset_terminal_coding_system_internal) (Fdefine_coding_system_internal, Fdefine_coding_system_alias): * composite.c (update_compositions, Ffind_composition_internal): * dired.c (directory_files_internal, file_name_completion) (Fsystem_users): * dispnew.c (Fopen_termscript, bitch_at_user, init_display): * doc.c (Fsnarf_documentation): * editfns.c (Fmessage_box): * emacs.c (main): * eval.c (do_debug_on_call, signal_error, maybe_call_debugger) (Feval, eval_sub, Ffuncall, apply_lambda): * fileio.c (make_temp_name, Fcopy_file, Faccess_file) (Fset_file_selinux_context, Fset_file_acl, Fset_file_modes) (Fset_file_times, Finsert_file_contents) (Fchoose_write_coding_system, Fwrite_region): * fns.c (Flax_plist_put, Fyes_or_no_p, syms_of_fns): * font.c (font_registry_charsets, font_parse_fcname) (font_prepare_cache, font_update_drivers, Flist_fonts): * fontset.c (Fset_fontset_font, Ffontset_info, syms_of_fontset): * frame.c (make_frame, Fmake_terminal_frame) (x_set_frame_parameters, x_report_frame_params) (x_default_parameter, Fx_parse_geometry): * ftfont.c (syms_of_ftfont): * image.c (gif_load): * keyboard.c (command_loop_1): * keymap.c (Fmake_keymap, Fmake_sparse_keymap, access_keymap_1) (Fcopy_keymap, append_key, Fcurrent_active_maps) (Fminor_mode_key_binding, accessible_keymaps_1) (Faccessible_keymaps, Fwhere_is_internal): * lread.c (read_emacs_mule_char): * menu.c (find_and_return_menu_selection): * minibuf.c (get_minibuffer): * nsfns.m (Fns_perform_service): * nsfont.m (ns_script_to_charset): * nsmenu.m (ns_popup_dialog): * nsselect.m (ns_get_local_selection, ns_string_from_pasteboard) (Fx_own_selection_internal): * nsterm.m (append2): * print.c (Fredirect_debugging_output) (print_prune_string_charset): * process.c (Fdelete_process, Fprocess_contact) (Fformat_network_address, set_socket_option) (read_and_dispose_of_process_output, write_queue_push) (send_process, exec_sentinel): * sound.c (Fplay_sound_internal): * textprop.c (validate_plist, add_properties) (Fput_text_property, Fadd_face_text_property) (copy_text_properties, text_property_list, syms_of_textprop): * unexaix.c (report_error): * unexcoff.c (report_error): * unexsol.c (unexec): * xdisp.c (redisplay_tool_bar, store_mode_line_string) (Fformat_mode_line, syms_of_xdisp): * xfaces.c (set_font_frame_param) (Finternal_lisp_face_attribute_values) (Finternal_merge_in_global_face, syms_of_xfaces): * xfns.c (x_default_scroll_bar_color_parameter) (x_default_font_parameter, x_create_tip_frame): * xfont.c (xfont_supported_scripts): * xmenu.c (Fx_popup_dialog, xmenu_show, xdialog_show) (menu_help_callback, xmenu_show): * xml.c (make_dom): * xterm.c (set_wm_state): Prefer list1 (FOO) to Fcons (FOO, Qnil) when creating a list, and similarly for list2 through list5.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/process.c b/src/process.c
index 8589acaa8b5..94ffc37ffe7 100644
--- a/src/process.c
+++ b/src/process.c
@@ -841,7 +841,7 @@ nil, indicating the current buffer's process. */)
841 p->raw_status_new = 0; 841 p->raw_status_new = 0;
842 if (NETCONN1_P (p) || SERIALCONN1_P (p)) 842 if (NETCONN1_P (p) || SERIALCONN1_P (p))
843 { 843 {
844 pset_status (p, Fcons (Qexit, Fcons (make_number (0), Qnil))); 844 pset_status (p, list2 (Qexit, make_number (0)));
845 p->tick = ++process_tick; 845 p->tick = ++process_tick;
846 status_notify (p); 846 status_notify (p);
847 redisplay_preserve_echo_area (13); 847 redisplay_preserve_echo_area (13);
@@ -1206,11 +1206,11 @@ list of keywords. */)
1206 if ((!NETCONN_P (process) && !SERIALCONN_P (process)) || EQ (key, Qt)) 1206 if ((!NETCONN_P (process) && !SERIALCONN_P (process)) || EQ (key, Qt))
1207 return contact; 1207 return contact;
1208 if (NILP (key) && NETCONN_P (process)) 1208 if (NILP (key) && NETCONN_P (process))
1209 return Fcons (Fplist_get (contact, QChost), 1209 return list2 (Fplist_get (contact, QChost),
1210 Fcons (Fplist_get (contact, QCservice), Qnil)); 1210 Fplist_get (contact, QCservice));
1211 if (NILP (key) && SERIALCONN_P (process)) 1211 if (NILP (key) && SERIALCONN_P (process))
1212 return Fcons (Fplist_get (contact, QCport), 1212 return list2 (Fplist_get (contact, QCport),
1213 Fcons (Fplist_get (contact, QCspeed), Qnil)); 1213 Fplist_get (contact, QCspeed));
1214 return Fplist_get (contact, key); 1214 return Fplist_get (contact, key);
1215} 1215}
1216 1216
@@ -1397,7 +1397,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1397 current_dir = expand_and_dir_to_file (current_dir, Qnil); 1397 current_dir = expand_and_dir_to_file (current_dir, Qnil);
1398 if (NILP (Ffile_accessible_directory_p (current_dir))) 1398 if (NILP (Ffile_accessible_directory_p (current_dir)))
1399 report_file_error ("Setting current directory", 1399 report_file_error ("Setting current directory",
1400 Fcons (BVAR (current_buffer, directory), Qnil)); 1400 list1 (BVAR (current_buffer, directory)));
1401 1401
1402 UNGCPRO; 1402 UNGCPRO;
1403 } 1403 }
@@ -1519,7 +1519,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1519 openp (Vexec_path, program, Vexec_suffixes, &tem, make_number (X_OK)); 1519 openp (Vexec_path, program, Vexec_suffixes, &tem, make_number (X_OK));
1520 UNGCPRO; 1520 UNGCPRO;
1521 if (NILP (tem)) 1521 if (NILP (tem))
1522 report_file_error ("Searching for program", Fcons (program, Qnil)); 1522 report_file_error ("Searching for program", list1 (program));
1523 tem = Fexpand_file_name (tem, Qnil); 1523 tem = Fexpand_file_name (tem, Qnil);
1524 } 1524 }
1525 else 1525 else
@@ -1542,7 +1542,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1542 1542
1543 /* Encode the file name and put it in NEW_ARGV. 1543 /* Encode the file name and put it in NEW_ARGV.
1544 That's where the child will use it to execute the program. */ 1544 That's where the child will use it to execute the program. */
1545 tem = Fcons (ENCODE_FILE (tem), Qnil); 1545 tem = list1 (ENCODE_FILE (tem));
1546 1546
1547 /* Here we encode arguments by the coding system used for sending 1547 /* Here we encode arguments by the coding system used for sending
1548 data to the process. We don't support using different coding 1548 data to the process. We don't support using different coding
@@ -2323,8 +2323,7 @@ set_socket_option (int s, Lisp_Object opt, Lisp_Object val)
2323 } 2323 }
2324 2324
2325 if (ret < 0) 2325 if (ret < 0)
2326 report_file_error ("Cannot set network option", 2326 report_file_error ("Cannot set network option", list2 (opt, val));
2327 Fcons (opt, Fcons (val, Qnil)));
2328 return (1 << sopt->optbit); 2327 return (1 << sopt->optbit);
2329} 2328}
2330 2329
@@ -5124,9 +5123,7 @@ read_and_dispose_of_process_output (struct Lisp_Process *p, char *chars,
5124 sometimes it's simply wrong to wrap (e.g. when called from 5123 sometimes it's simply wrong to wrap (e.g. when called from
5125 accept-process-output). */ 5124 accept-process-output). */
5126 internal_condition_case_1 (read_process_output_call, 5125 internal_condition_case_1 (read_process_output_call,
5127 Fcons (outstream, 5126 list3 (outstream, make_lisp_proc (p), text),
5128 Fcons (make_lisp_proc (p),
5129 Fcons (text, Qnil))),
5130 !NILP (Vdebug_on_error) ? Qnil : Qerror, 5127 !NILP (Vdebug_on_error) ? Qnil : Qerror,
5131 read_process_output_error_handler); 5128 read_process_output_error_handler);
5132 5129
@@ -5296,7 +5293,7 @@ write_queue_push (struct Lisp_Process *p, Lisp_Object input_obj,
5296 if (front) 5293 if (front)
5297 pset_write_queue (p, Fcons (entry, p->write_queue)); 5294 pset_write_queue (p, Fcons (entry, p->write_queue));
5298 else 5295 else
5299 pset_write_queue (p, nconc2 (p->write_queue, Fcons (entry, Qnil))); 5296 pset_write_queue (p, nconc2 (p->write_queue, list1 (entry)));
5300} 5297}
5301 5298
5302/* Remove the first element in the write_queue of process P, put its 5299/* Remove the first element in the write_queue of process P, put its
@@ -5469,7 +5466,7 @@ send_process (Lisp_Object proc, const char *buf, ptrdiff_t len,
5469 if (rv >= 0) 5466 if (rv >= 0)
5470 written = rv; 5467 written = rv;
5471 else if (errno == EMSGSIZE) 5468 else if (errno == EMSGSIZE)
5472 report_file_error ("sending datagram", Fcons (proc, Qnil)); 5469 report_file_error ("sending datagram", list1 (proc));
5473 } 5470 }
5474 else 5471 else
5475#endif 5472#endif
@@ -5546,7 +5543,7 @@ send_process (Lisp_Object proc, const char *buf, ptrdiff_t len,
5546 } 5543 }
5547 else 5544 else
5548 /* This is a real error. */ 5545 /* This is a real error. */
5549 report_file_error ("writing to process", Fcons (proc, Qnil)); 5546 report_file_error ("writing to process", list1 (proc));
5550 } 5547 }
5551 cur_buf += written; 5548 cur_buf += written;
5552 cur_len -= written; 5549 cur_len -= written;
@@ -6272,8 +6269,7 @@ exec_sentinel (Lisp_Object proc, Lisp_Object reason)
6272 running_asynch_code = 1; 6269 running_asynch_code = 1;
6273 6270
6274 internal_condition_case_1 (read_process_output_call, 6271 internal_condition_case_1 (read_process_output_call,
6275 Fcons (sentinel, 6272 list3 (sentinel, proc, reason),
6276 Fcons (proc, Fcons (reason, Qnil))),
6277 !NILP (Vdebug_on_error) ? Qnil : Qerror, 6273 !NILP (Vdebug_on_error) ? Qnil : Qerror,
6278 exec_sentinel_error_handler); 6274 exec_sentinel_error_handler);
6279 6275