summaryrefslogtreecommitdiff
path: root/src/callproc.c
Commit message (Collapse)AuthorAgeFilesLines
* Prefer HTTPS to FTP and HTTP in documentationPaul Eggert2017-09-131-1/+1
| | | | | | | | | | | | | Most of this change is to boilerplate commentary such as license URLs. This change was prompted by ftp://ftp.gnu.org's going-away party, planned for November. Change these FTP URLs to https://ftp.gnu.org instead. Make similar changes for URLs to other organizations moving away from FTP. Also, change HTTP to HTTPS for URLs to gnu.org and fsf.org when this works, as this will further help defend against man-in-the-middle attacks (for this part I omitted the MS-DOS and MS-Windows sources and the test tarballs to keep the workload down). HTTPS is not fully working to lists.gnu.org so I left those URLs alone for now.
* Simplify expand_and_dir_to_filePaul Eggert2017-08-251-1/+1
| | | | | | * src/fileio.c (expand_and_dir_to_file): Simplify by omitting 2nd argument, since in practice it always has the default value. All callers changed. Prefer C99 style decls in nearby code.
* Work around macOS bug with vforked childPaul Eggert2017-05-211-0/+8
| | | | | * src/callproc.c (call_process) [DARWIN_OS]: Include workaround for apparent macOS bug.
* Attempt to work around macOS vfork bugPaul Eggert2017-05-191-4/+9
| | | | | | | | | | | | Problem reported by YAMAMOTO Mitsuharu in: http://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00342.html This is related to the fix for Bug#26397. * src/callproc.c (call_process_cleanup, call_process) [!MSDOS]: Report internal error if wait_for_termination fails. * src/sysdep.c (get_child_status): Return -1 if waitpid is buggy, instead of aborting. (wait_for_termination): Return bool success value. All callers changed.
* Merge from origin/emacs-25Glenn Morris2017-04-271-0/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 784602b1050 (origin/emacs-25) ; Add release notice 3a34412caae (tag: emacs-25.2) Set Emacs version to 25.2 and update AU... 56a4461a48d ; Move stray item from admin/notes/repo to CONTRIBUTE 2b0d1118199 ; CONTRIBUTE: Remove stray header. f2ab09ec60d Fix a typo in indexing the user manual bc55a574235 * lisp/menu-bar.el (kill-this-buffer): Doc fix. (Bug#26466) a6d50401b4b Document 'line-pixel-height' 0c55cf43e61 * search.c (Fre_search_forward, Fre_search_backward): Imp... c7ed57eaef4 Mention that processes start in default-directory (Bug#18... 856ec9ffa1f * src/xdisp.c (vmessage, message): Clarify commentary. 849a0aaa1c9 Belated fixes for admin.el's M-x make-manuals-dist 84938d79698 default-directory: Remark that it must be a directory name 3f0d047d2eb Delete confuse statement in manual ee1bd94dd0c Improve packaging documentation fb18bff91f0 Expand manual section on quitting windows 9a737079645 Fix docstring of dabbrev-abbrev-char-regexp afe8849bac1 * doc/misc/cl.texi (Iteration Clauses): Clarify example (... ada79442c07 ;* doc/misc/info.texi (Choose menu subtopic): Improve ind... d38fd9229c0 Narrow scope of modification hook renabling in org-src fo... e0e9db4c84a ; Spelling fix # Conflicts: # README # etc/AUTHORS # etc/HISTORY # lisp/ldefs-boot.el
| * Mention that processes start in default-directory (Bug#18515)Noam Postavsky2017-04-061-0/+4
| | | | | | | | | | | | | | | | | | * doc/lispref/processes.texi (Synchronous Processes): (Asynchronous Processes): * lisp/subr.el (start-process): * src/callproc.c (call-process): Mention that the subprocess starts in `default-directory' when local, suggest `start-file-process' and `process-file' otherwise.
* | Use vfork if possible on Darwin (bug#26397)Alan Third2017-04-181-0/+13
| | | | | | | | | | | | | | | | | | | | | | Co-authored-by: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> * src/conf_post.h (HAVE_WORKING_VFORK): Don't undef. (vfork): Don't define. * src/process.c (create_process) [DARWIN_OS]: Use fork if pty_flag is set, otherwise vfork. * src/callproc.c (call_process) [DARWIN_OS]: Use TIOCNOTTY to detach the controlling terminal instead of setsid.
* | Install update-game-score only on requestPaul Eggert2017-03-121-12/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most distributions do not install update-game-score properly due to setuid/setgid complications, so install it only when the installer specifies a user or group (Bug#25895). * .gitattributes: Remove lib-src/update-game-score.exe.manifest. * Makefile.in (gameuser, gamegroup, use_gamedir, PATH_GAME): New vars. (epaths-force): Use PATH_GAME. (uninstall): Remove snake-scores and tetris-scores only if shared. * configure.ac: Default --with-gameuser to 'no'. (UPDATE_MANIFEST): Remove. * etc/NEWS: Mention this. * lib-src/Makefile.in (UPDATE_MANIFEST): Remove. (use_gamedir): New macro. (UTILITIES): Remove update-game-score unless use_gamedir. (SCRIPTS): Remove $(UPDATE_MANIFEST). ($(DESTDIR)${archlibdir}): Install game directory program and data only if use_gamedir. * lib-src/update-game-score.exe.manifest: Remove, as update-game-score is no longer installed on MS-Windows. * lisp/play/gamegrid.el (gamegrid-add-score-with-update-game-score): Use auxiliary program only if setuid or setgid. * make-dist: Do not distribute update-game-score.exe.manifest. * src/callproc.c (init_callproc): Set Vshared_game_score_directory based on PATH_GAME, not DOS_NT. (syms_of_callproc): Remove unnecessary initialization of Vshared_game_score_directory.
* | Use 'char *FOO' instead of 'char* FOO'Paul Eggert2017-02-181-1/+1
| |
* | Fix quitting bug when buffers are frozenPaul Eggert2017-02-011-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem noted by Eli Zaretskii in: http://lists.gnu.org/archive/html/emacs-devel/2017-01/msg00721.html This patch also fixes some other issues in that report. * src/lisp.h (incr_rarely_quit): Remove. All callers changed to use rarely_quit directly. * src/search.c (freeze_buffer_relocation) (thaw_buffer_relocation): New functions. (looking_at_1, fast_looking_at, search_buffer): Use them to fix bug when quitting when buffers are frozen. * src/sysdep.c (emacs_intr_read): Rename from emacs_nointr_read. All uses changed.
* | Revamp quitting and fix infloopsPaul Eggert2017-02-011-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes some infinite loops that cannot be quitted out of, e.g., (defun foo () (nth most-positive-fixnum '#1=(1 . #1#))) when byte-compiled and when run under X. See: http://lists.gnu.org/archive/html/emacs-devel/2017-01/msg00577.html This also attempts to keep the performance improvements I recently added, as much as possible under the constraint that the infloops must be caught. In some cases this fixes infloop bugs recently introduced when I removed immediate_quit. * src/alloc.c (Fmake_list): Use rarely_quit, not maybe_quit, for speed in the usual case. * src/bytecode.c (exec_byte_code): * src/editfns.c (Fcompare_buffer_substrings): * src/fns.c (Fnthcdr): * src/syntax.c (scan_words, skip_chars, skip_syntaxes) (Fbackward_prefix_chars): Use rarely_quit so that users can C-g out of long loops. * src/callproc.c (call_process_cleanup, call_process): * src/fileio.c (read_non_regular, Finsert_file_contents): * src/indent.c (compute_motion): * src/syntax.c (scan_words, Fforward_comment): Remove now-unnecessary maybe_quit calls. * src/callproc.c (call_process): * src/doc.c (get_doc_string, Fsnarf_documentation): * src/fileio.c (Fcopy_file, read_non_regular, Finsert_file_contents): * src/lread.c (safe_to_load_version): * src/sysdep.c (system_process_attributes) [GNU_LINUX]: Use emacs_read_quit instead of emacs_read in places where C-g handling is safe. * src/eval.c (maybe_quit): Move comment here from lisp.h. * src/fileio.c (Fcopy_file, e_write): Use emacs_write_quit instead of emacs_write_sig in places where C-g handling is safe. * src/filelock.c (create_lock_file): Use emacs_write, not plain write, as emacs_write no longer has a problem. (read_lock_data): Use emacs_read, not read, as emacs_read no longer has a problem. * src/fns.c (rarely_quit): Move to lisp.h and rename to incr_rarely_quit. All uses changed.. * src/fns.c (Fmemq, Fmemql, Fassq, Frassq, Fplist_put, Fplist_member): * src/indent.c (compute_motion): * src/syntax.c (find_defun_start, back_comment, forw_comment) (Fforward_comment, scan_lists, scan_sexps_forward): Use incr_rarely_quit so that users can C-g out of long loops. * src/fns.c (Fnconc): Move incr_rarely_quit call to within inner loop, so that it catches C-g there too. * src/keyboard.c (tty_read_avail_input): Remove commented-out and now-obsolete code dealing with interrupts. * src/lisp.h (rarely_quit, incr_rarely_quit): New functions, the latter moved here from fns.c and renamed from rarely_quit. (emacs_read_quit, emacs_write_quit): New decls. * src/search.c (find_newline, search_buffer, find_newline1): Add maybe_quit to catch C-g. * src/sysdep.c (get_child_status): Always invoke maybe_quit if interruptible, so that the caller need not bother. (emacs_nointr_read, emacs_read_quit, emacs_write_quit): New functions. (emacs_read): Rewrite in terms of emacs_nointr_read. Do not handle C-g or signals; that is now for emacs_read_quit. (emacs_full_write): Replace PROCESS_SIGNALS two-way arg with INTERRUPTIBLE three-way arg. All uses changed.
* | Remove immediate_quit.Paul Eggert2017-02-011-7/+1
| | | | | | | | | | | | | | | | | | The old code that sets and clears immediate_quit was ineffective except when Emacs is running in terminal mode, and has problematic race conditions anyway, so remove it. This will introduce some hangs when Emacs runs in terminal mode, and these hangs should be fixed in followup patches. * src/keyboard.c (immediate_quit): Remove. All uses removed.
* | Replace QUIT with maybe_quitPaul Eggert2017-01-251-8/+8
| | | | | | | | | | | | | | | | There’s no longer need to have QUIT stand for a slug of C statements. Use the more-obvious function-call syntax instead. Also, use true and false when setting immediate_quit. These changes should not affect the generated machine code. * src/lisp.h (QUIT): Remove. All uses replaced by maybe_quit.
* | Merge from origin/emacs-25Paul Eggert2017-01-011-1/+1
|\ \ | |/ | | | | | | 2e2a806 Fix copyright years by hand 5badc81 Update copyright year to 2017
| * Update copyright year to 2017Paul Eggert2016-12-311-1/+1
| | | | | | | | Run admin/update-copyright.
* | Don't define NOMINMAX on MS-WindowsEli Zaretskii2016-12-311-1/+0
| | | | | | | | | | | | * src/callproc.c (NOMINMAX) [WINDOWSNT]: Don't define. This is no longer needed with the current sources and MinGW headers, while defining NOMINMAX causes an annoying compiler warning.
* | Change two _Noreturn functions to return voidPaul Eggert2016-12-061-8/+8
| | | | | | | | | | | | | | | | | | | | | | This is a bit clearer than _Noreturn functions that (do not) return a non-void type. * src/callproc.c (call_process) [MSDOS]: Use 'status' local to record status. (child_setup): Return CHILD_SETUP_TYPE. * src/data.c, src/lisp.h (wrong_type_argument): Return void. All callers changed. * src/lisp.h (CHILD_SETUP_TYPE): New macro.
* | Restore file descriptor limit in subprocessesPaul Eggert2016-11-061-0/+3
| | | | | | | | | | | | | | | | | | Problem reported by Philipp Stephani (Bug#24869). * src/callproc.c (child_setup) [!DOS_NT]: Call restore_nofile_limit in the child. * src/process.c (nofile_limit) [HAVE_SETRLIMIT]: New static var. (restore_nofile_limit): New function. (init_process_emacs) [HAVE_SETRLIMIT]: Set the new var.
* | Limit <config.h>’s includesPaul Eggert2016-09-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This follows up on recent problems with the fact that config.h includes stdlib.h etc.; some files need to include stdlib.h later. config.h generally should limit itself to includes that are universally safe; outside of MS-Windows, only stdbool.h makes the cut among the files currently included. So, move the other includes to just the files that need them (Bug#24506). * configure.ac (config_opsysfile): Remove, as this generic hook is no longer needed. * lib-src/etags.c, src/unexmacosx.c, src/w32.c, src/w32notify.c: * src/w32proc.c (_GNU_SOURCE): Remove, as it’s OK for config.h to do this now. * src/conf_post.h: Include <ms-w32.h>, instead of the generic config_opsysfile, for simplicity as this old way of configuring is now done only for the MS-Windows port. Do not include <ms-w32.h> if DEFER_MS_W32_H, for the benefit of the few files that want its effects later. Do not include <alloca.h>, <string.h>, or <stdlib.h>. Other files modified to include these headers as needed, or to not include headers that are no longer needed. * src/lisp.h: Include <alloca.h> and <string.h> here, since some of the inline functions need them. * src/regex.c: Include <alloca.h> if not emacs. (If emacs, we can rely on SAFE_ALLOCA.) There is no longer any need to worry about HAVE_ALLOCA_H. * src/unexmacosx.c: Rely on config.h not including stdlib.h. * src/w32.c, src/w32notify.c, src/w32proc.c (DEFER_MS_W32_H): Define before including <config.h> first, and include <ms-w32.h> after the troublesome headers.
* | Merge from origin/emacs-25Paul Eggert2016-08-221-0/+7
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 927afa1 ; Update ChangeLog.2 and ldef-boot.el for Emacs 25.1 RC2 6bf83b5 * etc/AUTHORS: Update the AUTHORS file 73cbb81 ; ChangeLog spelling fixes 9b99772 Some assorted documentation clarifications 37d4723 Improve commentary in src/character.h 5ccd593 ; Fix typo in /etc/NEWS 96e3d16 * etc/NEWS: Mention the change in json-encode-string. 2e524034 ; * etc/NEWS: Mention incompatible change in url-http-create... 2e4e74e Merge branch 'emacs-25' of git.savannah.gnu.org:/srv/git/emac... 66dea65 ; * doc/lispref/windows.texi (Window Parameters): Grammar twe... # Conflicts: # ChangeLog.2 # lisp/ldefs-boot.el
| * Some assorted documentation clarificationsPhilipp Stephani2016-08-201-0/+7
| | | | | | | | | | | | | | | | | | * src/fileio.c (Fwrite_region): Clarify that END is ignored if START is nil. * src/editfns.c (Fbuffer_size): Add short discussion about narrowing. * src/callproc.c (Fcall_process_region): Discuss behavior when START and END are not buffer positions.
* | Fix port to glibc 2.24 (pre-release) + ppc64Paul Eggert2016-07-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | * src/callproc.c (child_setup): Use emacs_exec_file so that ASLR is enabled in the child process. * src/emacs.c: Move some personality details into sys/sysdep.c. Do not include <sys/personality.h>. (main): Disable ASLR earlier, so that we don’t chdir twice. * src/lisp.h (disable_address_randomization): New decl. * src/sysdep.c (disable_address_randomization) [HAVE_PERSONALITY_ADDR_NO_RANDOMIZE]: Move personality details here from emacs.c. (emacs_exec_file): New function.
* | ; Spelling fixPaul Eggert2016-07-191-1/+1
| |
* | Keep w32 environment settings internal onlyNoam Postavsky2016-07-181-0/+14
| | | | | | | | | | | | | | | | | | | | * src/emacs.c (main) [WINDOWSNT]: Move init_environment calls after the set_initial_environment call. This prevents Emacs' modifications to the environment from contaminating Vprocess_environment and Vinitial_environment (Bug #10980). * src/callproc.c (getenv_internal) [WINDOWSNT]: Consult Emacs' internal environment in as a fallback to Vprocess_environment. * test/src/callproc-tests.el (initial-environment-preserved): New Test.
* | Merge from origin/emacs-25Paul Eggert2016-06-261-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 0377fe2 ; Spelling fixes f253695 Update docs for `customize-mode' 4395aaa Fix documentation of 'assoc-string' and 'compare-strings' ab0ebb9 ; Only load .elc file in tests. a98aa02 Error on multibyte characters in HTTP request ea512a7 * lisp/gnus/mm-decode.el (mm-convert-shr-links): Mask keys th... 8297331 ; Revert "Ensure undo-boundary after insert-file-contents." dc5e65b Unset GIT_DIR when calling Git commands 6cdd8f7 Ensure undo-boundary after insert-file-contents. 4793f5f Clarify documentation of 'line-spacing' and 'line-height' 5f37572 Fix removal of variables from process-environment e5e886d * admin/authors.el (authors-ignored-files, authors-valid-file... db0777b * admin/authors.el (authors-aliases, authors-fixed-case): Add... # Conflicts: # doc/lispref/modes.texi # lisp/gnus/mm-decode.el
| * Fix removal of variables from process-environmentEli Zaretskii2016-06-201-1/+1
| | | | | | | | | | * src/callproc.c (add_env): Fix comparison of a variable with a value against the same variable without a value. (Bug#23779)
* | Fix compiler warnings in the MinGW buildEli Zaretskii2016-05-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac [mingw32]: Don't add -Wpointer-sign, and add -Wno-pointer-sign, to keep the noise level down. * nt/mingw-cfg.site (gl_cv_warn_c__Wredundant_decls): Disable -Wredundant-decls, as that produces a lot of noise due to redeclaration of time-related functions by gnulib. * nt/runemacs.c (set_user_model_id): Fix argument type of 'SetCurrentProcessExplicitAppUserModelID'. * src/image.c (x_create_bitmap_from_file) [HAVE_NTGUI]: Don't declare 'dpyinfo', as it is unused. (xpm_load): Fix warnings about pointer signedness. * src/w32proc.c (IsValidLocale, init_winsock): Remove redundant prototypes. (sys_spawnve): Avoid warnings about discarding 'const' qualifier. (sys_select): Provide prototype. (g_b_init_compare_string_w): Move declaration to file scope. * src/w32heap.c (dumped_data_commit): Now static. (FREEABLE_P): Avoid warnings about pointer comparison with integer. (mmap_realloc): Cast to 'char *' for arithmetics on void pointers. * src/w32console.c (ctrl_c_handler, sys_tputs, sys_tgetstr) (evalcost, cmputc, cmcheckmagic, cmcostinit, cmgoto, Wcm_clear): Provide prototypes. * src/w32.c (globals_of_w32, conv_sockaddr_to_lisp): Remove redundant prototypes. (w32_get_internal_run_time, map_w32_filename): Provide prototype. (init_environment, sys_ctime): Avoid warnings about discarding 'const' qualifier. Include utimens.h. (sys_ctime, sys_chdir, sys_creat, sys_fopen, sys_mkdir) (sys_open, sys_rename, sys_rmdir, is_slow_fs, term_winsock) (sys_close, sys_dup2, sys_read, sys_write, sys_localtime): Provide prototypes. (sys_rename_replace): Use %d to avoid compiler warnings. (_wsa_errlist): Make the message text 'const char *', to avoid compilation warnings. (dynlib_reset_last_error): Move prototype to file scope. (w32_get_resource): First argument is now 'const char *'. * src/w32uniscribe.c (syms_of_w32uniscribe): Provide prototype. (otf_features): Second argument is no 'const char *'. * src/w32term.c (free_frame_menubar, x_wm_set_size_hint) (x_set_window_size): Remove redundant prototypes. (XChangeGC, XGetGCValues, w32_draw_underwave) (w32_draw_rectangle, w32_shift_glyphs_for_insert, x_mouse_leave) (x_calc_absolute_position, x_destroy_window): Now static. (menubar_selection_callback): Move prototype to file scope. * src/w32font.c (g_b_init_get_glyph_outline_w): Remove redundant declaration. (w32_to_x_charset): Fix warnings about discarding 'const' qualifier. (w32font_full_name): Fix warnings about implicit conversion of 'float' to 'double'. * src/w32reg.c (w32_get_rdb_resource): Fix warnings about discarding 'const' qualifier. * src/w32menu.c (syms_of_w32menu, globals_of_w32menu) (set_frame_menubar): Remove redundant prototypes. (menubar_selection_callback, w32_menu_display_help): Provide prototypes. (simple_dialog_show): Avoid warnings about discarding 'const' qualifier. * src/w32fns.c (syms_of_w32fns, globals_of_w32fns) (free_frame_menubar, w32_strerror, x_set_menu_bar_lines) (x_set_tool_bar_lines, x_set_internal_border_width): Remove redundant prototypes. (current_popup_menu): Remove redundant declaration. (colormap_t): Member 'name' is now 'const char *'. (add_system_logical_colors_to_map): Fix signed/unsigned warnings. (x_decode_color, x_set_border_pixel) (x_clear_under_internal_border, x_set_name, hook_w32_key) (reset_w32_kbdhook_state, deliver_wm_chars, w32_backtrace): Now static. (w32_load_cursor, w32_key_to_modifier, map_keypad_keys) (w32_msg_worker, w32_last_error): Provide prototypes. (funhook, lookup_vk_code): Avoid warnings about missing parentheses. (x_default_font_parameter, Fw32_notification_notify): Avoid warnings about discarding 'const' qualifier. (Fx_create_frame): Avoid warnings about empty body of 'else'. (x_screen_planes): Ifdef away unused function. (Fx_show_tip): Remove unused variables. (Fw32_battery_status): Avoid warnings about implicit promotion from float to double. (Fw32_notification_notify): Initialize 'timeout'. * src/profiler.c (profiler_cpu_running) [HAVE_ITIMERSPEC]: Only define the TIMER_SETTIME_RUNNING value if it will be used. * src/w32notify.c (send_notifications): Ifdef away an empty if clause. Remove unused variable. (watch_end, watch_completion): Provide prototypes. * src/sound.c (sound_warning) [WINDOWSNT]: Don't define: unused. * src/callproc.c (child_setup, getenv_internal_1) [WINDOWSNT]: Fix warning with pointer signedness. * src/gnutls.c (gnutls_x509_crt_get_signature) (gnutls_alert_send_appropriate) [WINDOWSNT]: Don't define, and don't load them from the GnuTLS library, as they are no longer used. * src/process.c (DATAGRAM_CHAN_P) [!DATAGRAM_SOCKETS]: Don't define, as it's unused. * src/unexw32.c (open_input_file, open_output_file) (close_file_data): Remove redundant prototypes. (_start): provide prototype. (mainCRTStartup): Move prototype to file level. (find_section): Use type-cast to shut up compiler warnings. (offset_to_section, relocate_offset): Now static. (find_section): First argument is now a 'const char *'. (offset_to_section): Ifdef away, as it's unused. * src/w32heap.h (find_section): Adjust prototype. * src/dynlib.c (dynlib_reset_last_error): Provide prototype. * src/dired.c (directory_files_internal_w32_unwind): Avoid warnings about missing prototypes. (is_slow_fs) [WINDOWSNT]: Provide prototype at file level. (directory_files_internal) [WINDOWSNT]: Fix warnings about pointer signedness. * src/fileio.c (Ffile_writable_p, Ffile_regular_p) [WINDOWSNT]: Fix warnings about pointer signedness. * src/filelock.c (WTMP_FILE) [WINDOWSNT]: Don't define, it's unused. * src/sysdep.c (_getpid): Remove redundant prototype. (sys_subshell) [DOS_NT]: Don't define 'status', it's unused. [!MSDOS]: Don't define 'st', it's unused. (init_sys_modes) [DOS_NT]: Don't define 'terminal', it's unused. (str_collate) [WINDOWSNT]: Avoid warnings about pointer signedness. * src/keyboard.c (tty_read_avail_input) [WINDOWSNT]: Don't define n_to_read, as it is not used. (MAX_ENCODED_BYTES) [WINDOWSNT]: Don't define, as it's unused. * src/w32font.h (syms_of_w32font): Remove redundant prototype. * src/xfaces.c (x_display_info) [HAVE_NTGUI]: Remove unused macro. * src/term.c (init_tty) [DOS_NT]: Ifdef away variables that are not used by DOS_NT builds, to avoid compiler warnings. * src/menu.c (current_popup_menu) [HAVE_NTGUI]: Remove redundant declaration. * src/dispnew.c (init_display) [WINDOWSNT]: Use type-cast to shut up compiler warnings. * src/w32term.h (x_set_window_size, x_get_focus_frame) (x_make_frame_visible, x_make_frame_invisible, x_iconify_frame) (x_set_frame_alpha, x_activate_menubar, x_bitmap_icon) (x_free_frame_resources, x_real_positions) (display_x_get_resource): Remove redundant prototypes. * lib-src/ntlib.c (sys_ctime, sys_fopen, sys_chdir, mkostemp) (sys_rename, gettimeofday): Provide prototypes. * lib-src/ntlib.h (getuid, geteuid, mkostemp): Remove redundant declarations. * lib-src/emacsclient.c (w32_getenv): Argument is now 'const char *'. (xstrdup, w32_get_resource, w32_window_app, w32_execvp, ttyname) (close_winsock, initialize_sockets, w32_set_user_model_id) (w32_find_emacs_process, w32_give_focus) [WINDOWSNT]: Add prototypes. (w32_get_resource) [WINDOWSNT]: Fix a warning about signedness difference. (w32_set_user_model_id): Update prototype of SetCurrentProcessExplicitAppUserModelID to avoid compiler warnings. (start_daemon_and_retry_set_socket) [WINDOWSNT]: Use type-cast to shut up compiler warnings. * lib-src/etags.c (MAXPATHLEN) [WINDOWSNT]: Remove unused macro.
* | Simplify use of O_BINARYPaul Eggert2016-04-141-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | * src/callproc.c (call_process): * src/fileio.c (write_region): * src/filelock.c (read_lock_data): * src/image.c (x_find_image_fd): * src/lread.c (openp): * src/sysdep.c (init_random, emacs_fopen): * src/unexcw.c (unexec): Omit unnecessary use of O_BINARY, since emacs_open now arranges that for us.
* | Port redirect-debugging-output to non-GNU/LinuxPaul Eggert2016-04-041-55/+3
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | Problem reported by Kylie McClain for musl in: http://lists.gnu.org/archive/html/emacs-devel/2016-03/msg01592.html * etc/DEBUG, etc/NEWS: Mention this. * src/callproc.c (child_setup) [!MSDOS]: * src/dispnew.c (init_display): * src/emacs.c (main, Fdaemon_initialized): * src/minibuf.c (read_minibuf_noninteractive): * src/regex.c (xmalloc, xrealloc): Prefer symbolic names like STDERR_FILENO to magic numbers like 2, to make file-descriptor manipulation easier to follow. * src/emacs.c (relocate_fd) [!WINDOWSNT]: Remove; no longer needed now that we make sure stdin, stdout and stderr are open. All uses removed. (main): Make sure standard FDs are OK. Prefer symbolic names like EXIT_FAILURE to magic numbers like 1. Use bool for boolean. * src/lisp.h (init_standard_fds): New decl. * src/print.c (WITH_REDIRECT_DEBUGGING_OUTPUT) [GNU_LINUX]: Remove; no longer needed. (Fredirect_debugging_output): Define on all platforms, not just GNU/Linux. Redirect file descriptor, not stream, so that the code works even if stderr is not an lvalue. Report an error if the file arg is neither a string nor nil. (syms_of_print): Always define redirect-debugging-output. * src/sysdep.c (force_open, init_standard_fds): New functions.
* Rework C source files to avoid ^(Paul Eggert2016-03-101-4/+4
| | | | | | | | Work around Bug#22884 by rewording comments and strings to avoid ‘(’ at the start of a line unless it starts a function. This change is a short-term hack; in the longer run we plan to fix cc-mode’s performance for C files that have ‘(’ at the start of a line in a comment or string.
* Update copyright year to 2016Paul Eggert2016-01-011-1/+1
| | | | Run admin/update-copyright.
* New lispref section “Security Considerations”Paul Eggert2015-10-211-1/+1
| | | | | | | | | | | | | This attempts to document some of the issues recently discussed on emacs-devel, and to indicate other such issues. The section could be a lot longer. * doc/lispref/os.texi (Security Considerations): New node. * doc/lispref/elisp.texi (Top): * doc/lispref/processes.texi (Shell Arguments): * lisp/subr.el (shell-quote-argument): * src/callproc.c (syms_of_callproc): Reference it.
* Include-file cleanup for src directoryPaul Eggert2015-10-201-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Omit ‘#include "foo.h"’ unless the file needs foo.h (Bug#21707). In a few cases, add ‘#include "foo.h"’ if the file needs foo.h but does not include it directly. As a general rule, a source file should include foo.h if it needs the interfaces that foo.h defines. * src/alloc.c: Don’t include process.h. Include dispextern.h, systime.h. * src/atimer.c: Don’t include blockinput.h. * src/buffer.c: Include coding.h, systime.h. Don’t include keyboard.h, coding.h. * src/callint.c: Don’t include commands.h, keymap.h. * src/callproc.c: Don’t include character.h, ccl.h, composite.h, systty.h, termhooks.h. * src/casetab.c: Don’t include character.h. * src/category.c: Don’t include charset.h, keymap.h. * src/ccl.h: Don’t include character.h. * src/character.c: Don’t include charset.h. * src/charset.c: Don’t include disptab.h. * src/chartab.c: Don’t include ccl.h. * src/cm.c: Don’t include frame.h, termhooks.h. * src/cmds.c: Don’t include window.h, dispextern.h. * src/coding.c: Don’t include window.h, frame.h. * src/composite.c: Include composite.h. Don’t include window.h, font.h. * src/data.c: Don’t include syssignal.h, termhooks.h, font.h. * src/dbusbind.c: Don’t include frame.h. * src/decompress.c: Don’t include character.h. * src/dired.c: Don’t include character.h, commands.h, charset.h. * src/dispnew.c: Don’t include character.h, indent.h, intervals.h, process.h, timespec.h. Include systime.h. * src/doc.c: Include coding.h. Don’t include keyboard.h. * src/editfns.c: Include composite.h. Don’t include frame.h. * src/emacs.c: Include fcntl.h, coding.h. Don’t include commands.h, systty.h.. * src/fileio.c: Don’t include intervals.h, dispextern.h. Include composite.h. * src/filelock.c: Don’t include character.h, systime.h. * src/fns.c: Don’t include time.h, commands.h, keyboard.h, keymap.h, frame.h, blockinput.h, xterm.h. Include composite.h. * src/font.c: Include termhooks.h. * src/font.h: Don’t include ccl.h, frame.h. Add forward decls of struct composition_it, struct face, struct glyph_string. * src/fontset.c: Don’t include buffer.h, ccl.h, keyboard.h, intervals.h, window.h, termhooks.h. * src/frame.c: Don’t include character.h, commands.h, font.h. * src/frame.h: Don’t include dispextern.h. * src/fringe.c: Don’t include character.h. * src/ftcrfont.c: Don’t include dispextern.h, frame.h, character.h, charset.h, fontset.h. * src/ftfont.c: Don’t include frame.h, blockinput.h, coding.h, fontset.h. * src/ftxfont.c: Don’t include dispextern.h, character.h, charset.h, fontset.h. * src/gfilenotify.c: Don’t include frame.h, process.h. * src/gtkutil.c: Include dispextern.h, frame.h, systime.h. Don’t include syssignal.h, buffer.h, charset.h, font.h. * src/gtkutil.h: Don’t include frame.h. * src/image.c: Include fcntl.h and stdio.h instead of sysstdio.h. Don’t include character.h. * src/indent.c: Don’t include keyboard.h, termchar.h. * src/inotify.c: Don’t include character.h, frame.h. * src/insdel.c: Include composite.h. Don’t include blockinput.h. * src/intervals.c: Don’t include character.h, keyboard.h. * src/intervals.h: Don’t include dispextern.h, composite.h. * src/keyboard.c: Don’t include sysstdio.h, disptab.h, puresize.h. Include coding.h. * src/keyboard.h: Don’t incldue systime.h. * src/keymap.c: Don’t include charset.h, frame.h. * src/lread.c: Include dispextern.h and systime.h. Don’t include frame.h. Include systime.h. * src/macros.c: Don’t include commands.h, character.h, buffer.h. * src/menu.c: Include character.h, coding.h. Don’t include dispextern.h. * src/menu.h: Don’t include systime.h. * src/minibuf.c: Don’t include commands.h, dispextern.h, syntax.h, intervals.h, termhooks.h. * src/print.c: Include coding.h. Don’t include keyboard.h, window.h, dispextern.h, termchar.h, termhooks.h, font.h. Add forward decl of struct terminal. * src/process.c: Don’t include termhooks.h, commands.h, dispextern.h, composite.h. * src/region-cache.c: Don’t include character.h. * src/scroll.c: Don’t include keyboard.h, window.h. * src/search.c: Don’t include category.h, commands.h. * src/sound.c: Don’t include dispextern.h. * src/syntax.c: Don’t include command.h, keymap.h. * src/sysdep.c: Don’t include window.h, dispextern.h. * src/systime.h: Use ‘#ifdef emacs’, not ‘#ifdef EMACS_LISP_H’, * src/term.c: Don’t include systty.h, intervals.h, xterm.h. * src/terminal.c: Include character.h. Don’t include charset.h, coding.h. * src/textprop.c: Don’t include character.h. * src/undo.c: Don’t include character.h, commands.h, window.h. * src/unexsol.c: Don’t include character.h, charset.h. * src/widget.c: Include widget.h. Don’t include keyboard.h, window.h, dispextern.h, blockinput.h, character.h, font.h. * src/widgetprv.h: Don’t include widget.h. * src/window.c: Don’t include character.h, menu.h, intervals.h. * src/xdisp.c: Include composite.h, systime.h. Don’t include macros.h, process.h. * src/xfaces.c: Don’t include charset.h, keyboard.h, termhooks.h, intervals.h. * src/xfns.c: Don’t include menu.h, character.h, intervals.h, epaths.h, fontset.h, systime.h, atimer.h, termchar.h. * src/xfont.c: Don’t include dispextern.h, fontset.h, ccl.h. * src/xftfont.c: Don’t include dispextern.h, character.h, fontset.h. * src/xgselect.c: Don’t include timespec.h, frame.h. Include systime.h. * src/xgselect.h: Don’t include time.h. Use a forward decl to struct timespec instead. * src/xmenu.c: Don’t include keymap.h, character.h, charset.h, dispextern.h. Include systime.h. * src/xml.c: Don’t include character.h. * src/xrdb.c [USE_MOTIF]: Don’t include keyboard.h. * src/xselect.c: Don’t include dispextern.h, character.h, buffer.h, process.h. * src/xsmfns.c: Don’t include systime.h, sysselect.h. * src/xterm.c: Don’t include syssignal.h, charset.h, disptab.h, intervals.h process.h, keymap.h, xgselect.h. Include composite.h.
* Omit unnecessary \ before paren in C docstringsPaul Eggert2015-09-161-2/+2
| | | | | | | | | Although \( is needed in docstrings in Elisp code, it is not needed in docstrings in C code, since C function definitiions do not start with a parenthesis. The backslashes made the docstrings a bit harder to read and to format in columns. Also, some C docstrings had ( in column 1 and this did not appear to be causing any problems. So, simplify C docstrings by replacing \( with ( and \) with ).
* Assume GC_MARK_STACK == GC_MAKE_GCPROS_NOOPSPaul Eggert2015-08-261-60/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removes the need for GCPRO1 etc. Suggested by Stefan Monnier in: http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00918.html * doc/lispref/internals.texi (Writing Emacs Primitives): * etc/NEWS: Document the change. * src/alloc.c (gcprolist, dump_zombies, MAX_ZOMBIES, zombies) (nzombies, ngcs, avg_zombies, max_live, max_zombies, avg_live) (Fgc_status, check_gcpros, relocatable_string_data_p, gc-precise): * src/bytecode.c (mark_byte_stack) [BYTE_MARK_STACK]: * src/eval.c (gcpro_level) [DEBUG_GCPRO]: * src/lisp.h (struct handler.gcpro, struct gcpro, GC_MARK_STACK) (GC_USE_GCPROS_AS_BEFORE, GC_MAKE_GCPROS_NOOPS) (GC_MARK_STACK_CHECK_GCPROS, GC_USE_GCPROS_CHECK_ZOMBIES) (BYTE_MARK_STACK, GCPRO1, GCPRO2, GCPRO3, GCPRO4, GCPRO5, GCPRO6) (GCPRO7, UNGCPRO, RETURN_UNGCPRO): Remove. All uses removed. The code now assumes GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS. * src/bytecode.c (relocate_byte_stack): Rename from unmark_byte_stack, since it now only relocates. All callers changed. * src/frame.c (make_frame): Add an IF_LINT to pacify GCC 5.2 with GCPROs removed. * src/systime.h: Use EMACS_LISP_H as the canary instead of GCPRO1. * test/automated/finalizer-tests.el (finalizer-basic) (finalizer-circular-reference, finalizer-cross-reference) (finalizer-error): * test/automated/generator-tests.el (cps-test-iter-close-finalizer): Remove tests, as they depend on gc-precise.
* Tweak exec-path in uninstalled caseGlenn Morris2015-04-201-2/+2
| | | | | * src/callproc.c (init_callproc): If running uninstalled, do not include eventual installation libexec directory in exec-path.
* Prefer 'Qfoo' to 'intern ("foo")'Paul Eggert2015-02-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * buffer.c (syms_of_buffer): * bytecode.c (exec_byte_code): * callint.c (Fcall_interactively): * callproc.c (create_temp_file): * charset.c (define_charset_internal): * coding.c (syms_of_coding): * editfns.c (syms_of_editfns): * emacs.c (main): * fns.c (syms_of_fns): * frame.c (delete_frame, Fframe_parameters): * keyboard.c (syms_of_keyboard): * keymap.c (syms_of_keymap): * minibuf.c (read_minibuf, syms_of_minibuf): * nsfns.m (ns_cursor_type_to_lisp): * textprop.c (syms_of_textprop): * xdisp.c (Fformat_mode_line, syms_of_xdisp): * xfns.c (x_create_tip_frame, Fx_select_font): * xml.c (parse_region): Prefer constants like 'Qfoo' to calls like 'intern ("foo")'. * buffer.c (syms_of_buffer): OK to do (put 'erase-buffer 'disabled t) here now ... (keys_of_buffer): ... instead of here. * ftfont.c (syms_of_ftfont): Move DEFSYM of Qmono from here ... * xfns.c (syms_of_xfns): ... to here, since ftfont.c is more optional than xfns.c.
* Consolidate common path transformation code.Dmitry Antipov2015-01-141-9/+4
| | | | | | * process.h (remove_slash_colon): New function. * callproc.c (encode_current_directory, call_process): * process.c (Fstart_process): Use it.
* Avoid extra multibyteness check in ENCODE_FILE users.Dmitry Antipov2015-01-141-7/+5
| | | | | | | * callproc.c (encode_current_directory, Fcall_process, call_process): * dired.c (directory_files_internal, file_name_completion): Do not check for STRING_MULTIBYTE because encode_file_name is a no-op for unibyte strings.
* Update copyright year to 2015Paul Eggert2015-01-011-1/+1
| | | | Run admin/update-copyright.
* Prefer stpcpy to strcatPaul Eggert2014-12-251-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * admin/merge-gnulib (GNULIB_MODULES): Add stpcpy. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. * lib/stpcpy.c, m4/stpcpy.m4: New files, from gnulib. * lib-src/ebrowse.c (sym_scope_1, operator_name, open_file): * lib-src/emacsclient.c (get_server_config, set_local_socket) (start_daemon_and_retry_set_socket): * lib-src/etags.c (main, C_entries, relative_filename): * lib-src/pop.c (sendline): * lib-src/update-game-score.c (main): * lwlib/xlwmenu.c (resource_widget_value): * src/callproc.c (child_setup): * src/dbusbind.c (xd_signature_cat): * src/doc.c (get_doc_string, Fsnarf_documentation): * src/editfns.c (Fuser_full_name): * src/frame.c (xrdb_get_resource): * src/gtkutil.c (xg_get_file_with_chooser): * src/tparam.c (tparam1): * src/xfns.c (xic_create_fontsetname): * src/xrdb.c (gethomedir, get_user_db, get_environ_db): * src/xsmfns.c (smc_save_yourself_CB): Rewrite to avoid the need for strcat, typically by using stpcpy and/or lispstpcpy. strcat tends to be part of O(N**2) algorithms. * src/doc.c (sibling_etc): * src/xrdb.c (xdefaults): Now a top-level static constant.
* * src/: Various fixes to use bool type and constants.Stefan Monnier2014-12-151-3/+3
| | | | | | * src/dispnew.c (update_single_window): Remove arg `force_p' since it's always true. * src/xfaces.c (clear_face_cache): Use bool for the argument type.
* Merge from emacs-24; up to 117687Glenn Morris2014-11-081-0/+8
|\
| * * callproc.c (encode_current_directory): Encode dir at the end.Michael Albinus2014-11-071-2/+3
| |
| * * src/callproc.c (encode_current_directory): Fix thinko in previous.Glenn Morris2014-11-071-1/+1
| |
| * * callproc.c (encode_current_directory): Support handling of fileMichael Albinus2014-11-071-1/+5
| | | | | | | | | | | | names prepended by "/:". Fixes: debbugs:18891
* | * lisp.h (lispstpcpy): Rename from lispstrcpy, and act like stpcpy.Paul Eggert2014-09-231-1/+1
| | | | | | | | | | | | All callers changed. * xterm.c (x_term_init): Use new functionality to avoid two needs to compute a string length.
* | Use known length of a Lisp string to copy it faster.Dmitry Antipov2014-09-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp.h (lispstrcpy): New function. Add comment. * callproc.c (child_setup): * dbusbind.c (xd_append_arg): * doc.c (get_doc_string): * font.c (Ffont_xlfd_name): * frame.c (xrdb_get_resource): * process.c (Fmake_network_process, network_interface_info): * w32fns.c (Fx_open_connection): * w32proc.c (sys_spawnve): * xfns.c (select_visual): * xfont.c (xfont_list): * xsmfns.c (x_session_initialize): * xterm.c (x_term_init): Use it.
* | Fix SAFE_ALLOCA to not exhaust the stack when in a loop.Paul Eggert2014-09-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem reported by Dmietry Antipov in thread leading to: http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00713.html This patch fixes only SAFE_ALLOCA, SAFE_NALLOCA, and SAFE_ALLOCA_LISP; the experimental local_* macros enabled by USE_LOCAL_ALLOCATORS remain unfixed. * callproc.c (call_process): Save and restore sa_avail. * lisp.h (USE_SAFE_ALLOCA): Define sa_avail. (AVAIL_ALLOCA): New macro. (SAFE_ALLOCA, SAFE_NALLOCA, SAFE_ALLOCA_LISP): Use it, and check against sa_avail rather than MAX_ALLOCA.
* | * callproc.c (init_callproc): Fix bug introduced at 2014-09-07.Jan Djärv2014-09-141-1/+1
| | | | | | | | Fixes: debbugs:18474