aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Schwab2010-07-08 00:18:28 +0200
committerAndreas Schwab2010-07-08 00:18:28 +0200
commit72af86bd8cf1812d1fcc8924c4093d692040a664 (patch)
treeef5f905c859ad0e4626eff800311782a4cd8ae00 /src
parentcb768704a459ab54632daf5bb1a10127a6a5c9f7 (diff)
downloademacs-72af86bd8cf1812d1fcc8924c4093d692040a664.tar.gz
emacs-72af86bd8cf1812d1fcc8924c4093d692040a664.zip
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc) (overrun_check_free, xstrdup, allocate_string) (allocate_string_data, compact_small_strings, Fmake_string) (make_unibyte_string, make_multibyte_string) (make_string_from_bytes, make_specified_string, make_float) (Fcons, allocate_terminal, allocate_frame, make_pure_string) (Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp. * atimer.c (start_atimer, set_alarm): Likewise. * buffer.c (clone_per_buffer_values, report_overlay_modification) (mmap_realloc, init_buffer_once): Likewise. * callint.c (Fcall_interactively): Likewise. * callproc.c (Fcall_process, Fcall_process_region, child_setup) (getenv_internal_1): Likewise. * casefiddle.c (casify_object): Likewise. * ccl.c (ccl_driver): Likewise. * character.c (str_as_multibyte, str_to_multibyte): Likewise. * charset.c (load_charset_map_from_file) (load_charset_map_from_file, load_charset_map_from_vector) (Fdefine_charset_internal): Likewise. * cm.c (Wcm_clear): Likewise. * coding.c (decode_eol, decode_coding_object) (Fset_coding_system_priority, make_subsidiaries): Likewise. * data.c (Faset): Likewise. * dired.c (directory_files_internal, file_name_completion_stat): Likewise. * dispnew.c (new_glyph_matrix, adjust_glyph_matrix) (clear_glyph_row, copy_row_except_pointers) (copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool) (save_current_matrix, restore_current_matrix) (build_frame_matrix_from_leaf_window, mirrored_line_dance) (mirror_line_dance, scrolling_window): Likewise. * doc.c (Fsnarf_documentation, Fsubstitute_command_keys): Likewise. * doprnt.c (doprnt): Likewise. * editfns.c (Fuser_full_name, make_buffer_string_both) (Fmessage_box, Fformat, Ftranspose_regions): Likewise. * emacs.c (sort_args): Likewise. * eval.c (Fapply, Ffuncall): Likewise. * fileio.c (Ffile_name_directory, make_temp_name) (Fexpand_file_name, search_embedded_absfilename) (Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents) (auto_save_error): Likewise. * fns.c (Fstring_equal, Fcopy_sequence, concat) (string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte) (internal_equal, Fclear_string, larger_vector, copy_hash_table) (Fmake_hash_table): Likewise. * fringe.c (Fdefine_fringe_bitmap): Likewise. * ftfont.c (ftfont_text_extents): Likewise. * getloadavg.c (getloadavg): Likewise. * image.c (define_image_type, make_image, make_image_cache) (x_create_x_image_and_pixmap, xbm_image_p) (w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color) (xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load) (init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load) (png_image_p, png_read_from_memory, png_load, jpeg_image_p) (tiff_image_p, tiff_read_from_memory, gif_image_p) (gif_read_from_memory, gif_load, svg_image_p, gs_image_p): Likewise. * indent.c (scan_for_column, compute_motion): Likewise. * insdel.c (gap_left, gap_right, make_gap_smaller, copy_text) (insert_1_both, insert_from_gap, replace_range_2): Likewise. * intervals.c (reproduce_tree, reproduce_tree_obj): Likewise. * keyboard.c (echo_char, save_getcjmp, restore_getcjmp) (kbd_buffer_store_event_hold, apply_modifiers_uncached) (store_user_signal_events, menu_bar_items, tool_bar_items) (process_tool_bar_item, append_tool_bar_item) (read_char_minibuf_menu_prompt, read_key_sequence) (Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys): Likewise. * keymap.c (current_minor_maps, Fdescribe_buffer_bindings): Likewise. * lisp.h (STRING_COPYIN): Likewise. * lread.c (Fload, read1, oblookup): Likewise. * msdos.c (Frecent_doskeys): Likewise. * nsfns.m (Fx_create_frame): Likewise. * nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics): Likewise. * nsimage.m (EmacsImage-initFromSkipXBM:width:height:) (EmacsImage-initForXPMWithDepth:width:height:flip:length:): Likewise. * nsmenu.m (ns_update_menubar): Likewise. * nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise. * print.c (print_unwind, printchar, strout, print_string) (print_error_message): Likewise. * process.c (conv_lisp_to_sockaddr, set_socket_option) (Fmake_network_process, Fnetwork_interface_list) (Fnetwork_interface_info, read_process_output, Fprocess_send_eof) (init_process): Likewise. * ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise. * regex.c (init_syntax_once, regex_compile, re_compile_fastmap): Likewise. * scroll.c (do_scrolling, do_direct_scrolling) (scrolling_max_lines_saved): Likewise. * search.c (search_buffer, wordify, Freplace_match): Likewise. * sound.c (wav_init, au_init, Fplay_sound_internal): Likewise. * syntax.c (skip_chars, skip_syntaxes): Likewise. * sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty) (emacs_set_tty): Likewise. * term.c (encode_terminal_code, calculate_costs) (produce_special_glyphs, create_tty_output, init_tty, delete_tty): Likewise. * termcap.c (tgetst1, gobble_line): Likewise. * termhooks.h (EVENT_INIT): Likewise. * tparam.c (tparam1): Likewise. * unexalpha.c (unexec): Likewise. * unexec.c (write_segment): Likewise. * unexmacosx.c (unexec_write_zero): Likewise. * w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame) (Fx_file_dialog, Fsystem_move_file_to_trash): Likewise. * w32font.c (w32font_list_family, w32font_text_extents) (w32font_list_internal, w32font_match_internal) (w32font_open_internal, compute_metrics, Fx_select_font): Likewise. * w32menu.c (set_frame_menubar, add_menu_item) (w32_menu_display_help, w32_free_submenu_strings): Likewise. * w32term.c (XCreateGC, w32_initialize_display_info): Likewise. * w32uniscribe.c (uniscribe_list_family): Likewise. * w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise. * window.c (make_window, replace_window, set_window_buffer) (Fsplit_window): Likewise. * xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string) (add_to_log, message3, x_consider_frame_title) (append_space_for_newline, extend_face_to_end_of_line) (decode_mode_spec_coding, init_glyph_string): Likewise. * xfaces.c (x_create_gc, get_lface_attributes_no_remap) (Finternal_copy_lisp_face, Finternal_merge_in_global_face) (face_attr_equal_p, make_realized_face, make_face_cache) (free_realized_faces, lookup_named_face, smaller_face) (face_with_height, lookup_derived_face) (x_supports_face_attributes_p, Finternal_set_font_selection_order) (Finternal_set_font_selection_order, realize_default_face) (compute_char_face, face_at_buffer_position) (face_for_overlay_string, face_at_string_position, merge_faces): Likewise. * xfns.c (xic_create_fontsetname, Fx_create_frame) (Fx_window_property, x_create_tip_frame) (Fx_backspace_delete_keys_p): Likewise. * xfont.c (xfont_list, xfont_match, xfont_list_family) (xfont_text_extents): Likewise. * xmenu.c (set_frame_menubar, xmenu_show): Likewise. * xrdb.c (magic_file_p, x_get_resource): Likewise. * xselect.c (x_queue_event, x_get_window_property) (receive_incremental_selection): Likewise. * xsmfns.c (x_session_check_input): Likewise. * xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT) (handle_one_xevent, x_check_errors, xim_initialize, x_term_init): Likewise. * character.h (BCOPY_SHORT): Removed. * config.in: Regenerate. * dispnew.c (safe_bcopy): Only define as dummy if PROFILING. * emacs.c (main) [PROFILING]: Don't declare dump_opcode_frequencies. * lisp.h (safe_bcopy): Remove declaration. (memset) [!HAVE_MEMSET]: Declare. (memcpy) [!HAVE_MEMCPY]: Likewise. (memmove) [!HAVE_MEMMOVE]: Likewise. (memcmp) [!HAVE_MEMCMP]: Likewise. * s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY) (BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP): Don't define. (HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define. * s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE) (BCOPY_DOWNWARD_SAFE): Don't define. * sysdep.c (memset) [!HAVE_MEMSET]: Define. (memcpy) [!HAVE_MEMCPY]: Define. (memmove) [!HAVE_MEMMOVE]: Define. (memcmp) [!HAVE_MEMCMP]: Define. * config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs. (HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs. * sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1. (HAVE_BZERO): Don't edit. * lwlib.c (lwlib_memset, lwlib_bcopy): Remove. (malloc_widget_value, free_widget_info, allocate_widget_instance) (lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by memset, memcpy, memcmp. * lwlib-utils.c (XtApplyToWidgets): Likewise. * xlwmenu.c (XlwMenuInitialize): Likewise. * lwlib.h (lwlib_bcopy): Remove declaration. * ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by memcpy, memmove, memset. * pop.c (pop_retrieve, socket_connection, pop_getline): Likewise. * CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE) (GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero): Remove. * configure.in: Don't check for bcopy, bcmp, bzero. Don't include <strings.h> and don't define bcopy, bzero, BCMP in config.h.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog171
-rw-r--r--src/alloc.c87
-rw-r--r--src/atimer.c4
-rw-r--r--src/buffer.c12
-rw-r--r--src/callint.c3
-rw-r--r--src/callproc.c14
-rw-r--r--src/casefiddle.c2
-rw-r--r--src/ccl.c6
-rw-r--r--src/character.c4
-rw-r--r--src/character.h12
-rw-r--r--src/charset.c16
-rw-r--r--src/cm.c2
-rw-r--r--src/coding.c12
-rw-r--r--src/config.in23
-rw-r--r--src/data.c8
-rw-r--r--src/dired.c13
-rw-r--r--src/dispnew.c95
-rw-r--r--src/doc.c10
-rw-r--r--src/doprnt.c4
-rw-r--r--src/editfns.c49
-rw-r--r--src/emacs.c5
-rw-r--r--src/eval.c4
-rw-r--r--src/fileio.c24
-rw-r--r--src/fns.c32
-rw-r--r--src/fringe.c2
-rw-r--r--src/ftfont.c2
-rw-r--r--src/getloadavg.c2
-rw-r--r--src/image.c64
-rw-r--r--src/indent.c4
-rw-r--r--src/insdel.c62
-rw-r--r--src/intervals.c4
-rw-r--r--src/keyboard.c59
-rw-r--r--src/keymap.c14
-rw-r--r--src/lisp.h15
-rw-r--r--src/lread.c8
-rw-r--r--src/msdos.c12
-rw-r--r--src/nsfns.m2
-rw-r--r--src/nsfont.m12
-rw-r--r--src/nsimage.m8
-rw-r--r--src/nsmenu.m4
-rw-r--r--src/nsterm.m6
-rw-r--r--src/print.c12
-rw-r--r--src/process.c52
-rw-r--r--src/ralloc.c28
-rw-r--r--src/regex.c45
-rw-r--r--src/s/ms-w32.h15
-rw-r--r--src/s/msdos.h4
-rw-r--r--src/scroll.c6
-rw-r--r--src/search.c7
-rw-r--r--src/sound.c11
-rw-r--r--src/syntax.c14
-rw-r--r--src/sysdep.c59
-rw-r--r--src/term.c14
-rw-r--r--src/termcap.c9
-rw-r--r--src/termhooks.h2
-rw-r--r--src/tparam.c7
-rw-r--r--src/unexalpha.c6
-rw-r--r--src/unexec.c2
-rw-r--r--src/unexmacosx.c2
-rw-r--r--src/w32fns.c12
-rw-r--r--src/w32font.c30
-rw-r--r--src/w32menu.c10
-rw-r--r--src/w32term.c4
-rw-r--r--src/w32uniscribe.c2
-rw-r--r--src/w32xfns.c6
-rw-r--r--src/window.c16
-rw-r--r--src/xdisp.c22
-rw-r--r--src/xfaces.c54
-rw-r--r--src/xfns.c30
-rw-r--r--src/xfont.c8
-rw-r--r--src/xmenu.c10
-rw-r--r--src/xrdb.c6
-rw-r--r--src/xselect.c8
-rw-r--r--src/xsmfns.c2
-rw-r--r--src/xterm.c16
75 files changed, 737 insertions, 686 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 912a5a8d2f2..4896708b979 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,174 @@
12010-07-07 Andreas Schwab <schwab@linux-m68k.org>
2
3 * alloc.c (overrun_check_malloc, overrun_check_realloc)
4 (overrun_check_free, xstrdup, allocate_string)
5 (allocate_string_data, compact_small_strings, Fmake_string)
6 (make_unibyte_string, make_multibyte_string)
7 (make_string_from_bytes, make_specified_string, make_float)
8 (Fcons, allocate_terminal, allocate_frame, make_pure_string)
9 (Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
10 memcpy, memmove, memset, memcmp.
11 * atimer.c (start_atimer, set_alarm): Likewise.
12 * buffer.c (clone_per_buffer_values, report_overlay_modification)
13 (mmap_realloc, init_buffer_once): Likewise.
14 * callint.c (Fcall_interactively): Likewise.
15 * callproc.c (Fcall_process, Fcall_process_region, child_setup)
16 (getenv_internal_1): Likewise.
17 * casefiddle.c (casify_object): Likewise.
18 * ccl.c (ccl_driver): Likewise.
19 * character.c (str_as_multibyte, str_to_multibyte): Likewise.
20 * charset.c (load_charset_map_from_file)
21 (load_charset_map_from_file, load_charset_map_from_vector)
22 (Fdefine_charset_internal): Likewise.
23 * cm.c (Wcm_clear): Likewise.
24 * coding.c (decode_eol, decode_coding_object)
25 (Fset_coding_system_priority, make_subsidiaries): Likewise.
26 * data.c (Faset): Likewise.
27 * dired.c (directory_files_internal, file_name_completion_stat):
28 Likewise.
29 * dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
30 (clear_glyph_row, copy_row_except_pointers)
31 (copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
32 (save_current_matrix, restore_current_matrix)
33 (build_frame_matrix_from_leaf_window, mirrored_line_dance)
34 (mirror_line_dance, scrolling_window): Likewise.
35 * doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
36 Likewise.
37 * doprnt.c (doprnt): Likewise.
38 * editfns.c (Fuser_full_name, make_buffer_string_both)
39 (Fmessage_box, Fformat, Ftranspose_regions): Likewise.
40 * emacs.c (sort_args): Likewise.
41 * eval.c (Fapply, Ffuncall): Likewise.
42 * fileio.c (Ffile_name_directory, make_temp_name)
43 (Fexpand_file_name, search_embedded_absfilename)
44 (Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
45 (auto_save_error): Likewise.
46 * fns.c (Fstring_equal, Fcopy_sequence, concat)
47 (string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
48 (internal_equal, Fclear_string, larger_vector, copy_hash_table)
49 (Fmake_hash_table): Likewise.
50 * fringe.c (Fdefine_fringe_bitmap): Likewise.
51 * ftfont.c (ftfont_text_extents): Likewise.
52 * getloadavg.c (getloadavg): Likewise.
53 * image.c (define_image_type, make_image, make_image_cache)
54 (x_create_x_image_and_pixmap, xbm_image_p)
55 (w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
56 (xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
57 (init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
58 (png_image_p, png_read_from_memory, png_load, jpeg_image_p)
59 (tiff_image_p, tiff_read_from_memory, gif_image_p)
60 (gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
61 Likewise.
62 * indent.c (scan_for_column, compute_motion): Likewise.
63 * insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
64 (insert_1_both, insert_from_gap, replace_range_2): Likewise.
65 * intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
66 * keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
67 (kbd_buffer_store_event_hold, apply_modifiers_uncached)
68 (store_user_signal_events, menu_bar_items, tool_bar_items)
69 (process_tool_bar_item, append_tool_bar_item)
70 (read_char_minibuf_menu_prompt, read_key_sequence)
71 (Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
72 Likewise.
73 * keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
74 Likewise.
75 * lisp.h (STRING_COPYIN): Likewise.
76 * lread.c (Fload, read1, oblookup): Likewise.
77 * msdos.c (Frecent_doskeys): Likewise.
78 * nsfns.m (Fx_create_frame): Likewise.
79 * nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
80 Likewise.
81 * nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
82 (EmacsImage-initForXPMWithDepth:width:height:flip:length:):
83 Likewise.
84 * nsmenu.m (ns_update_menubar): Likewise.
85 * nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
86 * print.c (print_unwind, printchar, strout, print_string)
87 (print_error_message): Likewise.
88 * process.c (conv_lisp_to_sockaddr, set_socket_option)
89 (Fmake_network_process, Fnetwork_interface_list)
90 (Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
91 (init_process): Likewise.
92 * ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
93 * regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
94 Likewise.
95 * scroll.c (do_scrolling, do_direct_scrolling)
96 (scrolling_max_lines_saved): Likewise.
97 * search.c (search_buffer, wordify, Freplace_match): Likewise.
98 * sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
99 * syntax.c (skip_chars, skip_syntaxes): Likewise.
100 * sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
101 (emacs_set_tty): Likewise.
102 * term.c (encode_terminal_code, calculate_costs)
103 (produce_special_glyphs, create_tty_output, init_tty, delete_tty):
104 Likewise.
105 * termcap.c (tgetst1, gobble_line): Likewise.
106 * termhooks.h (EVENT_INIT): Likewise.
107 * tparam.c (tparam1): Likewise.
108 * unexalpha.c (unexec): Likewise.
109 * unexec.c (write_segment): Likewise.
110 * unexmacosx.c (unexec_write_zero): Likewise.
111 * w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
112 (Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
113 * w32font.c (w32font_list_family, w32font_text_extents)
114 (w32font_list_internal, w32font_match_internal)
115 (w32font_open_internal, compute_metrics, Fx_select_font):
116 Likewise.
117 * w32menu.c (set_frame_menubar, add_menu_item)
118 (w32_menu_display_help, w32_free_submenu_strings): Likewise.
119 * w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
120 * w32uniscribe.c (uniscribe_list_family): Likewise.
121 * w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
122 * window.c (make_window, replace_window, set_window_buffer)
123 (Fsplit_window): Likewise.
124 * xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
125 (add_to_log, message3, x_consider_frame_title)
126 (append_space_for_newline, extend_face_to_end_of_line)
127 (decode_mode_spec_coding, init_glyph_string): Likewise.
128 * xfaces.c (x_create_gc, get_lface_attributes_no_remap)
129 (Finternal_copy_lisp_face, Finternal_merge_in_global_face)
130 (face_attr_equal_p, make_realized_face, make_face_cache)
131 (free_realized_faces, lookup_named_face, smaller_face)
132 (face_with_height, lookup_derived_face)
133 (x_supports_face_attributes_p, Finternal_set_font_selection_order)
134 (Finternal_set_font_selection_order, realize_default_face)
135 (compute_char_face, face_at_buffer_position)
136 (face_for_overlay_string, face_at_string_position, merge_faces):
137 Likewise.
138 * xfns.c (xic_create_fontsetname, Fx_create_frame)
139 (Fx_window_property, x_create_tip_frame)
140 (Fx_backspace_delete_keys_p): Likewise.
141 * xfont.c (xfont_list, xfont_match, xfont_list_family)
142 (xfont_text_extents): Likewise.
143 * xmenu.c (set_frame_menubar, xmenu_show): Likewise.
144 * xrdb.c (magic_file_p, x_get_resource): Likewise.
145 * xselect.c (x_queue_event, x_get_window_property)
146 (receive_incremental_selection): Likewise.
147 * xsmfns.c (x_session_check_input): Likewise.
148 * xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
149 (handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
150 Likewise.
151 * character.h (BCOPY_SHORT): Removed.
152 * config.in: Regenerate.
153 * dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
154 * emacs.c (main) [PROFILING]: Don't declare
155 dump_opcode_frequencies.
156 * lisp.h (safe_bcopy): Remove declaration.
157 (memset) [!HAVE_MEMSET]: Declare.
158 (memcpy) [!HAVE_MEMCPY]: Likewise.
159 (memmove) [!HAVE_MEMMOVE]: Likewise.
160 (memcmp) [!HAVE_MEMCMP]: Likewise.
161 * s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
162 (BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
163 Don't define.
164 (HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
165 * s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
166 (BCOPY_DOWNWARD_SAFE): Don't define.
167 * sysdep.c (memset) [!HAVE_MEMSET]: Define.
168 (memcpy) [!HAVE_MEMCPY]: Define.
169 (memmove) [!HAVE_MEMMOVE]: Define.
170 (memcmp) [!HAVE_MEMCMP]: Define.
171
12010-07-07 Jan Djärv <jan.h.d@swipnet.se> 1722010-07-07 Jan Djärv <jan.h.d@swipnet.se>
2 173
3 * process.c (kbd_is_on_hold): New variable. 174 * process.c (kbd_is_on_hold): New variable.
diff --git a/src/alloc.c b/src/alloc.c
index 7598386ebca..62b6e449831 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -636,10 +636,12 @@ overrun_check_malloc (size)
636 val = (unsigned char *) malloc (size + overhead); 636 val = (unsigned char *) malloc (size + overhead);
637 if (val && check_depth == 1) 637 if (val && check_depth == 1)
638 { 638 {
639 bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4); 639 memcpy (val, xmalloc_overrun_check_header,
640 XMALLOC_OVERRUN_CHECK_SIZE - 4);
640 val += XMALLOC_OVERRUN_CHECK_SIZE; 641 val += XMALLOC_OVERRUN_CHECK_SIZE;
641 XMALLOC_PUT_SIZE(val, size); 642 XMALLOC_PUT_SIZE(val, size);
642 bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE); 643 memcpy (val + size, xmalloc_overrun_check_trailer,
644 XMALLOC_OVERRUN_CHECK_SIZE);
643 } 645 }
644 --check_depth; 646 --check_depth;
645 return (POINTER_TYPE *)val; 647 return (POINTER_TYPE *)val;
@@ -659,28 +661,29 @@ overrun_check_realloc (block, size)
659 661
660 if (val 662 if (val
661 && check_depth == 1 663 && check_depth == 1
662 && bcmp (xmalloc_overrun_check_header, 664 && memcmp (xmalloc_overrun_check_header,
663 val - XMALLOC_OVERRUN_CHECK_SIZE, 665 val - XMALLOC_OVERRUN_CHECK_SIZE,
664 XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) 666 XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0)
665 { 667 {
666 size_t osize = XMALLOC_GET_SIZE (val); 668 size_t osize = XMALLOC_GET_SIZE (val);
667 if (bcmp (xmalloc_overrun_check_trailer, 669 if (memcmp (xmalloc_overrun_check_trailer, val + osize,
668 val + osize, 670 XMALLOC_OVERRUN_CHECK_SIZE))
669 XMALLOC_OVERRUN_CHECK_SIZE))
670 abort (); 671 abort ();
671 bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE); 672 memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE);
672 val -= XMALLOC_OVERRUN_CHECK_SIZE; 673 val -= XMALLOC_OVERRUN_CHECK_SIZE;
673 bzero (val, XMALLOC_OVERRUN_CHECK_SIZE); 674 memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE);
674 } 675 }
675 676
676 val = (unsigned char *) realloc ((POINTER_TYPE *)val, size + overhead); 677 val = (unsigned char *) realloc ((POINTER_TYPE *)val, size + overhead);
677 678
678 if (val && check_depth == 1) 679 if (val && check_depth == 1)
679 { 680 {
680 bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4); 681 memcpy (val, xmalloc_overrun_check_header,
682 XMALLOC_OVERRUN_CHECK_SIZE - 4);
681 val += XMALLOC_OVERRUN_CHECK_SIZE; 683 val += XMALLOC_OVERRUN_CHECK_SIZE;
682 XMALLOC_PUT_SIZE(val, size); 684 XMALLOC_PUT_SIZE(val, size);
683 bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE); 685 memcpy (val + size, xmalloc_overrun_check_trailer,
686 XMALLOC_OVERRUN_CHECK_SIZE);
684 } 687 }
685 --check_depth; 688 --check_depth;
686 return (POINTER_TYPE *)val; 689 return (POINTER_TYPE *)val;
@@ -697,22 +700,21 @@ overrun_check_free (block)
697 ++check_depth; 700 ++check_depth;
698 if (val 701 if (val
699 && check_depth == 1 702 && check_depth == 1
700 && bcmp (xmalloc_overrun_check_header, 703 && memcmp (xmalloc_overrun_check_header,
701 val - XMALLOC_OVERRUN_CHECK_SIZE, 704 val - XMALLOC_OVERRUN_CHECK_SIZE,
702 XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) 705 XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0)
703 { 706 {
704 size_t osize = XMALLOC_GET_SIZE (val); 707 size_t osize = XMALLOC_GET_SIZE (val);
705 if (bcmp (xmalloc_overrun_check_trailer, 708 if (memcmp (xmalloc_overrun_check_trailer, val + osize,
706 val + osize, 709 XMALLOC_OVERRUN_CHECK_SIZE))
707 XMALLOC_OVERRUN_CHECK_SIZE))
708 abort (); 710 abort ();
709#ifdef XMALLOC_CLEAR_FREE_MEMORY 711#ifdef XMALLOC_CLEAR_FREE_MEMORY
710 val -= XMALLOC_OVERRUN_CHECK_SIZE; 712 val -= XMALLOC_OVERRUN_CHECK_SIZE;
711 memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_SIZE*2); 713 memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_SIZE*2);
712#else 714#else
713 bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE); 715 memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE);
714 val -= XMALLOC_OVERRUN_CHECK_SIZE; 716 val -= XMALLOC_OVERRUN_CHECK_SIZE;
715 bzero (val, XMALLOC_OVERRUN_CHECK_SIZE); 717 memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE);
716#endif 718#endif
717 } 719 }
718 720
@@ -799,7 +801,7 @@ xstrdup (const char *s)
799{ 801{
800 size_t len = strlen (s) + 1; 802 size_t len = strlen (s) + 1;
801 char *p = (char *) xmalloc (len); 803 char *p = (char *) xmalloc (len);
802 bcopy (s, p, len); 804 memcpy (p, s, len);
803 return p; 805 return p;
804} 806}
805 807
@@ -1873,7 +1875,7 @@ allocate_string (void)
1873 int i; 1875 int i;
1874 1876
1875 b = (struct string_block *) lisp_malloc (sizeof *b, MEM_TYPE_STRING); 1877 b = (struct string_block *) lisp_malloc (sizeof *b, MEM_TYPE_STRING);
1876 bzero (b, sizeof *b); 1878 memset (b, 0, sizeof *b);
1877 b->next = string_blocks; 1879 b->next = string_blocks;
1878 string_blocks = b; 1880 string_blocks = b;
1879 ++n_string_blocks; 1881 ++n_string_blocks;
@@ -1897,7 +1899,7 @@ allocate_string (void)
1897 MALLOC_UNBLOCK_INPUT; 1899 MALLOC_UNBLOCK_INPUT;
1898 1900
1899 /* Probably not strictly necessary, but play it safe. */ 1901 /* Probably not strictly necessary, but play it safe. */
1900 bzero (s, sizeof *s); 1902 memset (s, 0, sizeof *s);
1901 1903
1902 --total_free_strings; 1904 --total_free_strings;
1903 ++total_strings; 1905 ++total_strings;
@@ -2005,8 +2007,7 @@ allocate_string_data (struct Lisp_String *s, int nchars, int nbytes)
2005 s->size_byte = nbytes; 2007 s->size_byte = nbytes;
2006 s->data[nbytes] = '\0'; 2008 s->data[nbytes] = '\0';
2007#ifdef GC_CHECK_STRING_OVERRUN 2009#ifdef GC_CHECK_STRING_OVERRUN
2008 bcopy (string_overrun_cookie, (char *) data + needed, 2010 memcpy (data + needed, string_overrun_cookie, GC_STRING_OVERRUN_COOKIE_SIZE);
2009 GC_STRING_OVERRUN_COOKIE_SIZE);
2010#endif 2011#endif
2011 2012
2012 /* If S had already data assigned, mark that as free by setting its 2013 /* If S had already data assigned, mark that as free by setting its
@@ -2197,9 +2198,9 @@ compact_small_strings (void)
2197 from_end = (struct sdata *) ((char *) from + nbytes + GC_STRING_EXTRA); 2198 from_end = (struct sdata *) ((char *) from + nbytes + GC_STRING_EXTRA);
2198 2199
2199#ifdef GC_CHECK_STRING_OVERRUN 2200#ifdef GC_CHECK_STRING_OVERRUN
2200 if (bcmp (string_overrun_cookie, 2201 if (memcmp (string_overrun_cookie,
2201 ((char *) from_end) - GC_STRING_OVERRUN_COOKIE_SIZE, 2202 (char *) from_end - GC_STRING_OVERRUN_COOKIE_SIZE,
2202 GC_STRING_OVERRUN_COOKIE_SIZE)) 2203 GC_STRING_OVERRUN_COOKIE_SIZE))
2203 abort (); 2204 abort ();
2204#endif 2205#endif
2205 2206
@@ -2221,7 +2222,7 @@ compact_small_strings (void)
2221 if (from != to) 2222 if (from != to)
2222 { 2223 {
2223 xassert (tb != b || to <= from); 2224 xassert (tb != b || to <= from);
2224 safe_bcopy ((char *) from, (char *) to, nbytes + GC_STRING_EXTRA); 2225 memmove (to, from, nbytes + GC_STRING_EXTRA);
2225 to->string->data = SDATA_DATA (to); 2226 to->string->data = SDATA_DATA (to);
2226 } 2227 }
2227 2228
@@ -2280,7 +2281,7 @@ INIT must be an integer that represents a character. */)
2280 end = p + nbytes; 2281 end = p + nbytes;
2281 while (p != end) 2282 while (p != end)
2282 { 2283 {
2283 bcopy (str, p, len); 2284 memcpy (p, str, len);
2284 p += len; 2285 p += len;
2285 } 2286 }
2286 } 2287 }
@@ -2362,7 +2363,7 @@ make_unibyte_string (const char *contents, int length)
2362{ 2363{
2363 register Lisp_Object val; 2364 register Lisp_Object val;
2364 val = make_uninit_string (length); 2365 val = make_uninit_string (length);
2365 bcopy (contents, SDATA (val), length); 2366 memcpy (SDATA (val), contents, length);
2366 STRING_SET_UNIBYTE (val); 2367 STRING_SET_UNIBYTE (val);
2367 return val; 2368 return val;
2368} 2369}
@@ -2376,7 +2377,7 @@ make_multibyte_string (const char *contents, int nchars, int nbytes)
2376{ 2377{
2377 register Lisp_Object val; 2378 register Lisp_Object val;
2378 val = make_uninit_multibyte_string (nchars, nbytes); 2379 val = make_uninit_multibyte_string (nchars, nbytes);
2379 bcopy (contents, SDATA (val), nbytes); 2380 memcpy (SDATA (val), contents, nbytes);
2380 return val; 2381 return val;
2381} 2382}
2382 2383
@@ -2389,7 +2390,7 @@ make_string_from_bytes (const char *contents, int nchars, int nbytes)
2389{ 2390{
2390 register Lisp_Object val; 2391 register Lisp_Object val;
2391 val = make_uninit_multibyte_string (nchars, nbytes); 2392 val = make_uninit_multibyte_string (nchars, nbytes);
2392 bcopy (contents, SDATA (val), nbytes); 2393 memcpy (SDATA (val), contents, nbytes);
2393 if (SBYTES (val) == SCHARS (val)) 2394 if (SBYTES (val) == SCHARS (val))
2394 STRING_SET_UNIBYTE (val); 2395 STRING_SET_UNIBYTE (val);
2395 return val; 2396 return val;
@@ -2414,7 +2415,7 @@ make_specified_string (const char *contents, int nchars, int nbytes, int multiby
2414 nchars = nbytes; 2415 nchars = nbytes;
2415 } 2416 }
2416 val = make_uninit_multibyte_string (nchars, nbytes); 2417 val = make_uninit_multibyte_string (nchars, nbytes);
2417 bcopy (contents, SDATA (val), nbytes); 2418 memcpy (SDATA (val), contents, nbytes);
2418 if (!multibyte) 2419 if (!multibyte)
2419 STRING_SET_UNIBYTE (val); 2420 STRING_SET_UNIBYTE (val);
2420 return val; 2421 return val;
@@ -2587,7 +2588,7 @@ make_float (double float_value)
2587 new = (struct float_block *) lisp_align_malloc (sizeof *new, 2588 new = (struct float_block *) lisp_align_malloc (sizeof *new,
2588 MEM_TYPE_FLOAT); 2589 MEM_TYPE_FLOAT);
2589 new->next = float_block; 2590 new->next = float_block;
2590 bzero ((char *) new->gcmarkbits, sizeof new->gcmarkbits); 2591 memset (new->gcmarkbits, 0, sizeof new->gcmarkbits);
2591 float_block = new; 2592 float_block = new;
2592 float_block_index = 0; 2593 float_block_index = 0;
2593 n_float_blocks++; 2594 n_float_blocks++;
@@ -2709,7 +2710,7 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0,
2709 register struct cons_block *new; 2710 register struct cons_block *new;
2710 new = (struct cons_block *) lisp_align_malloc (sizeof *new, 2711 new = (struct cons_block *) lisp_align_malloc (sizeof *new,
2711 MEM_TYPE_CONS); 2712 MEM_TYPE_CONS);
2712 bzero ((char *) new->gcmarkbits, sizeof new->gcmarkbits); 2713 memset (new->gcmarkbits, 0, sizeof new->gcmarkbits);
2713 new->next = cons_block; 2714 new->next = cons_block;
2714 cons_block = new; 2715 cons_block = new;
2715 cons_block_index = 0; 2716 cons_block_index = 0;
@@ -2950,8 +2951,8 @@ allocate_terminal (void)
2950 struct terminal *t = ALLOCATE_PSEUDOVECTOR (struct terminal, 2951 struct terminal *t = ALLOCATE_PSEUDOVECTOR (struct terminal,
2951 next_terminal, PVEC_TERMINAL); 2952 next_terminal, PVEC_TERMINAL);
2952 /* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */ 2953 /* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */
2953 bzero (&(t->next_terminal), 2954 memset (&t->next_terminal, 0,
2954 ((char*)(t+1)) - ((char*)&(t->next_terminal))); 2955 (char*) (t + 1) - (char*) &t->next_terminal);
2955 2956
2956 return t; 2957 return t;
2957} 2958}
@@ -2962,8 +2963,8 @@ allocate_frame (void)
2962 struct frame *f = ALLOCATE_PSEUDOVECTOR (struct frame, 2963 struct frame *f = ALLOCATE_PSEUDOVECTOR (struct frame,
2963 face_cache, PVEC_FRAME); 2964 face_cache, PVEC_FRAME);
2964 /* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */ 2965 /* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */
2965 bzero (&(f->face_cache), 2966 memset (&f->face_cache, 0,
2966 ((char*)(f+1)) - ((char*)&(f->face_cache))); 2967 (char *) (f + 1) - (char *) &f->face_cache);
2967 return f; 2968 return f;
2968} 2969}
2969 2970
@@ -4713,7 +4714,7 @@ make_pure_string (const char *data, int nchars, int nbytes, int multibyte)
4713 if (s->data == NULL) 4714 if (s->data == NULL)
4714 { 4715 {
4715 s->data = (unsigned char *) pure_alloc (nbytes + 1, -1); 4716 s->data = (unsigned char *) pure_alloc (nbytes + 1, -1);
4716 bcopy (data, s->data, nbytes); 4717 memcpy (s->data, data, nbytes);
4717 s->data[nbytes] = '\0'; 4718 s->data[nbytes] = '\0';
4718 } 4719 }
4719 s->size = nchars; 4720 s->size = nchars;
@@ -4980,9 +4981,9 @@ returns nil, because real GC can't be done. */)
4980 if (stack_copy) 4981 if (stack_copy)
4981 { 4982 {
4982 if ((EMACS_INT) (&stack_top_variable - stack_bottom) > 0) 4983 if ((EMACS_INT) (&stack_top_variable - stack_bottom) > 0)
4983 bcopy (stack_bottom, stack_copy, i); 4984 memcpy (stack_copy, stack_bottom, i);
4984 else 4985 else
4985 bcopy (&stack_top_variable, stack_copy, i); 4986 memcpy (stack_copy, &stack_top_variable, i);
4986 } 4987 }
4987 } 4988 }
4988 } 4989 }
diff --git a/src/atimer.c b/src/atimer.c
index c9cf145ad85..9fd9dee835e 100644
--- a/src/atimer.c
+++ b/src/atimer.c
@@ -116,7 +116,7 @@ start_atimer (enum atimer_type type, EMACS_TIME time, atimer_callback fn,
116 t = (struct atimer *) xmalloc (sizeof *t); 116 t = (struct atimer *) xmalloc (sizeof *t);
117 117
118 /* Fill the atimer structure. */ 118 /* Fill the atimer structure. */
119 bzero (t, sizeof *t); 119 memset (t, 0, sizeof *t);
120 t->type = type; 120 t->type = type;
121 t->fn = fn; 121 t->fn = fn;
122 t->client_data = client_data; 122 t->client_data = client_data;
@@ -308,7 +308,7 @@ set_alarm (void)
308 EMACS_SET_USECS (time, 1000); 308 EMACS_SET_USECS (time, 1000);
309 } 309 }
310 310
311 bzero (&it, sizeof it); 311 memset (&it, 0, sizeof it);
312 it.it_value = time; 312 it.it_value = time;
313 setitimer (ITIMER_REAL, &it, 0); 313 setitimer (ITIMER_REAL, &it, 0);
314#else /* not HAVE_SETITIMER */ 314#else /* not HAVE_SETITIMER */
diff --git a/src/buffer.c b/src/buffer.c
index 57e4986a0bb..b8f19e96c43 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -514,7 +514,7 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to)
514 PER_BUFFER_VALUE (to, offset) = obj; 514 PER_BUFFER_VALUE (to, offset) = obj;
515 } 515 }
516 516
517 bcopy (from->local_flags, to->local_flags, sizeof to->local_flags); 517 memcpy (to->local_flags, from->local_flags, sizeof to->local_flags);
518 518
519 to->overlays_before = copy_overlays (to, from->overlays_before); 519 to->overlays_before = copy_overlays (to, from->overlays_before);
520 to->overlays_after = copy_overlays (to, from->overlays_after); 520 to->overlays_after = copy_overlays (to, from->overlays_after);
@@ -4413,8 +4413,8 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, int after,
4413 Lisp_Object *copy = (Lisp_Object *) alloca (size * sizeof (Lisp_Object)); 4413 Lisp_Object *copy = (Lisp_Object *) alloca (size * sizeof (Lisp_Object));
4414 int i; 4414 int i;
4415 4415
4416 bcopy (XVECTOR (last_overlay_modification_hooks)->contents, 4416 memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents,
4417 copy, size * sizeof (Lisp_Object)); 4417 size * sizeof (Lisp_Object));
4418 gcpro1.var = copy; 4418 gcpro1.var = copy;
4419 gcpro1.nvars = size; 4419 gcpro1.nvars = size;
4420 4420
@@ -4877,7 +4877,7 @@ mmap_realloc (var, nbytes)
4877 } 4877 }
4878 else if (mmap_alloc (var, nbytes)) 4878 else if (mmap_alloc (var, nbytes))
4879 { 4879 {
4880 bcopy (old_ptr, *var, r->nbytes_specified); 4880 memcpy (*var, old_ptr, r->nbytes_specified);
4881 mmap_free_1 (MMAP_REGION (old_ptr)); 4881 mmap_free_1 (MMAP_REGION (old_ptr));
4882 result = *var; 4882 result = *var;
4883 r = MMAP_REGION (result); 4883 r = MMAP_REGION (result);
@@ -5058,7 +5058,7 @@ init_buffer_once (void)
5058{ 5058{
5059 int idx; 5059 int idx;
5060 5060
5061 bzero (buffer_permanent_local_flags, sizeof buffer_permanent_local_flags); 5061 memset (buffer_permanent_local_flags, 0, sizeof buffer_permanent_local_flags);
5062 5062
5063 /* Make sure all markable slots in buffer_defaults 5063 /* Make sure all markable slots in buffer_defaults
5064 are initialized reasonably, so mark_buffer won't choke. */ 5064 are initialized reasonably, so mark_buffer won't choke. */
@@ -5146,7 +5146,7 @@ init_buffer_once (void)
5146 if (sizeof (EMACS_INT) != sizeof (Lisp_Object)) abort (); 5146 if (sizeof (EMACS_INT) != sizeof (Lisp_Object)) abort ();
5147 5147
5148 /* 0 means not a lisp var, -1 means always local, else mask */ 5148 /* 0 means not a lisp var, -1 means always local, else mask */
5149 bzero (&buffer_local_flags, sizeof buffer_local_flags); 5149 memset (&buffer_local_flags, 0, sizeof buffer_local_flags);
5150 XSETINT (buffer_local_flags.filename, -1); 5150 XSETINT (buffer_local_flags.filename, -1);
5151 XSETINT (buffer_local_flags.directory, -1); 5151 XSETINT (buffer_local_flags.directory, -1);
5152 XSETINT (buffer_local_flags.backed_up, -1); 5152 XSETINT (buffer_local_flags.backed_up, -1);
diff --git a/src/callint.c b/src/callint.c
index 5716a6fdd47..4a011b55b91 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -348,8 +348,7 @@ invoke it. If KEYS is omitted or nil, the return value of
348 /* Make a copy of string so that if a GC relocates specs, 348 /* Make a copy of string so that if a GC relocates specs,
349 `string' will still be valid. */ 349 `string' will still be valid. */
350 string = (unsigned char *) alloca (SBYTES (specs) + 1); 350 string = (unsigned char *) alloca (SBYTES (specs) + 1);
351 bcopy (SDATA (specs), string, 351 memcpy (string, SDATA (specs), SBYTES (specs) + 1);
352 SBYTES (specs) + 1);
353 } 352 }
354 else 353 else
355 { 354 {
diff --git a/src/callproc.c b/src/callproc.c
index 34748c71c1c..733cdee3499 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -775,10 +775,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
775 PT_BYTE + process_coding.produced); 775 PT_BYTE + process_coding.produced);
776 carryover = process_coding.carryover_bytes; 776 carryover = process_coding.carryover_bytes;
777 if (carryover > 0) 777 if (carryover > 0)
778 /* As CARRYOVER should not be that large, we had 778 memcpy (buf, process_coding.carryover,
779 better avoid overhead of bcopy. */ 779 process_coding.carryover_bytes);
780 BCOPY_SHORT (process_coding.carryover, buf,
781 process_coding.carryover_bytes);
782 } 780 }
783 } 781 }
784 782
@@ -916,7 +914,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
916 914
917 pattern = Fexpand_file_name (Vtemp_file_name_pattern, tmpdir); 915 pattern = Fexpand_file_name (Vtemp_file_name_pattern, tmpdir);
918 tempfile = (char *) alloca (SBYTES (pattern) + 1); 916 tempfile = (char *) alloca (SBYTES (pattern) + 1);
919 bcopy (SDATA (pattern), tempfile, SBYTES (pattern) + 1); 917 memcpy (tempfile, SDATA (pattern), SBYTES (pattern) + 1);
920 coding_systems = Qt; 918 coding_systems = Qt;
921 919
922#ifdef HAVE_MKSTEMP 920#ifdef HAVE_MKSTEMP
@@ -1099,8 +1097,8 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L
1099 pwd_var = (char *) alloca (i + 6); 1097 pwd_var = (char *) alloca (i + 6);
1100#endif 1098#endif
1101 temp = pwd_var + 4; 1099 temp = pwd_var + 4;
1102 bcopy ("PWD=", pwd_var, 4); 1100 memcpy (pwd_var, "PWD=", 4);
1103 bcopy (SDATA (current_dir), temp, i); 1101 memcpy (temp, SDATA (current_dir), i);
1104 if (!IS_DIRECTORY_SEP (temp[i - 1])) temp[i++] = DIRECTORY_SEP; 1102 if (!IS_DIRECTORY_SEP (temp[i - 1])) temp[i++] = DIRECTORY_SEP;
1105 temp[i] = 0; 1103 temp[i] = 0;
1106 1104
@@ -1325,7 +1323,7 @@ getenv_internal_1 (char *var, int varlen, char **value, int *valuelen, Lisp_Obje
1325 /* NT environment variables are case insensitive. */ 1323 /* NT environment variables are case insensitive. */
1326 && ! strnicmp (SDATA (entry), var, varlen) 1324 && ! strnicmp (SDATA (entry), var, varlen)
1327#else /* not WINDOWSNT */ 1325#else /* not WINDOWSNT */
1328 && ! bcmp (SDATA (entry), var, varlen) 1326 && ! memcmp (SDATA (entry), var, varlen)
1329#endif /* not WINDOWSNT */ 1327#endif /* not WINDOWSNT */
1330 ) 1328 )
1331 { 1329 {
diff --git a/src/casefiddle.c b/src/casefiddle.c
index 36715848941..b9667efe2bb 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -128,7 +128,7 @@ casify_object (enum case_action flag, Lisp_Object obj)
128 unsigned char *old_dst = dst; 128 unsigned char *old_dst = dst;
129 o_size += o_size; /* Probably overkill, but extremely rare. */ 129 o_size += o_size; /* Probably overkill, but extremely rare. */
130 SAFE_ALLOCA (dst, void *, o_size); 130 SAFE_ALLOCA (dst, void *, o_size);
131 bcopy (old_dst, dst, o - old_dst); 131 memcpy (dst, old_dst, o - old_dst);
132 o = dst + (o - old_dst); 132 o = dst + (o - old_dst);
133 } 133 }
134 c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i_byte, len); 134 c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i_byte, len);
diff --git a/src/ccl.c b/src/ccl.c
index 4ddc56a707f..d02e83db8f4 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -1715,7 +1715,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
1715 msglen = strlen (msg); 1715 msglen = strlen (msg);
1716 if (dst + msglen <= (dst_bytes ? dst_end : src)) 1716 if (dst + msglen <= (dst_bytes ? dst_end : src))
1717 { 1717 {
1718 bcopy (msg, dst, msglen); 1718 memcpy (dst, msg, msglen);
1719 dst += msglen; 1719 dst += msglen;
1720 } 1720 }
1721 1721
@@ -1728,7 +1728,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
1728 msglen = strlen (msg); 1728 msglen = strlen (msg);
1729 if (dst + msglen > (dst_bytes ? dst_end : src)) 1729 if (dst + msglen > (dst_bytes ? dst_end : src))
1730 break; 1730 break;
1731 bcopy (msg, dst, msglen); 1731 memcpy (dst, msg, msglen);
1732 dst += msglen; 1732 dst += msglen;
1733 } 1733 }
1734 goto ccl_finish; 1734 goto ccl_finish;
@@ -1761,7 +1761,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
1761 int i = src_end - src; 1761 int i = src_end - src;
1762 if (dst_bytes && (dst_end - dst) < i) 1762 if (dst_bytes && (dst_end - dst) < i)
1763 i = dst_end - dst; 1763 i = dst_end - dst;
1764 bcopy (src, dst, i); 1764 memcpy (dst, src, i);
1765 src += i; 1765 src += i;
1766 dst += i; 1766 dst += i;
1767#else 1767#else
diff --git a/src/character.c b/src/character.c
index a6c38df9e85..648c5a291d2 100644
--- a/src/character.c
+++ b/src/character.c
@@ -668,7 +668,7 @@ str_as_multibyte (unsigned char *str, int len, int nbytes, int *nchars)
668 to = p; 668 to = p;
669 nbytes = endp - p; 669 nbytes = endp - p;
670 endp = str + len; 670 endp = str + len;
671 safe_bcopy ((char *) p, (char *) (endp - nbytes), nbytes); 671 memmove (endp - nbytes, p, nbytes);
672 p = endp - nbytes; 672 p = endp - nbytes;
673 673
674 if (nbytes >= MAX_MULTIBYTE_LENGTH) 674 if (nbytes >= MAX_MULTIBYTE_LENGTH)
@@ -746,7 +746,7 @@ str_to_multibyte (unsigned char *str, int len, int bytes)
746 to = p; 746 to = p;
747 bytes = endp - p; 747 bytes = endp - p;
748 endp = str + len; 748 endp = str + len;
749 safe_bcopy ((char *) p, (char *) (endp - bytes), bytes); 749 memmove (endp - bytes, p, bytes);
750 p = endp - bytes; 750 p = endp - bytes;
751 while (p < endp) 751 while (p < endp)
752 { 752 {
diff --git a/src/character.h b/src/character.h
index f9d95010655..b32dabba12e 100644
--- a/src/character.h
+++ b/src/character.h
@@ -636,18 +636,6 @@ extern Lisp_Object Vauto_fill_chars;
636extern Lisp_Object Vchar_script_table; 636extern Lisp_Object Vchar_script_table;
637extern Lisp_Object Vscript_representative_chars; 637extern Lisp_Object Vscript_representative_chars;
638 638
639/* Copy LEN bytes from FROM to TO. This macro should be used only
640 when a caller knows that LEN is short and the obvious copy loop is
641 faster than calling bcopy which has some overhead. Copying a
642 multibyte sequence of a character is the typical case. */
643
644#define BCOPY_SHORT(from, to, len) \
645 do { \
646 int i = len; \
647 unsigned char *from_p = from, *to_p = to; \
648 while (i--) *to_p++ = *from_p++; \
649 } while (0)
650
651#define DEFSYM(sym, name) \ 639#define DEFSYM(sym, name) \
652 do { (sym) = intern_c_string ((name)); staticpro (&(sym)); } while (0) 640 do { (sym) = intern_c_string ((name)); staticpro (&(sym)); } while (0)
653 641
diff --git a/src/charset.c b/src/charset.c
index 45ce52870bd..718b5197471 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -522,7 +522,7 @@ load_charset_map_from_file (struct charset *charset, Lisp_Object mapfile, int co
522 SAFE_ALLOCA (head, struct charset_map_entries *, 522 SAFE_ALLOCA (head, struct charset_map_entries *,
523 sizeof (struct charset_map_entries)); 523 sizeof (struct charset_map_entries));
524 entries = head; 524 entries = head;
525 bzero (entries, sizeof (struct charset_map_entries)); 525 memset (entries, 0, sizeof (struct charset_map_entries));
526 526
527 n_entries = 0; 527 n_entries = 0;
528 eof = 0; 528 eof = 0;
@@ -549,7 +549,7 @@ load_charset_map_from_file (struct charset *charset, Lisp_Object mapfile, int co
549 SAFE_ALLOCA (entries->next, struct charset_map_entries *, 549 SAFE_ALLOCA (entries->next, struct charset_map_entries *,
550 sizeof (struct charset_map_entries)); 550 sizeof (struct charset_map_entries));
551 entries = entries->next; 551 entries = entries->next;
552 bzero (entries, sizeof (struct charset_map_entries)); 552 memset (entries, 0, sizeof (struct charset_map_entries));
553 } 553 }
554 idx = n_entries % 0x10000; 554 idx = n_entries % 0x10000;
555 entries->entry[idx].from = from; 555 entries->entry[idx].from = from;
@@ -585,7 +585,7 @@ load_charset_map_from_vector (struct charset *charset, Lisp_Object vec, int cont
585 SAFE_ALLOCA (head, struct charset_map_entries *, 585 SAFE_ALLOCA (head, struct charset_map_entries *,
586 sizeof (struct charset_map_entries)); 586 sizeof (struct charset_map_entries));
587 entries = head; 587 entries = head;
588 bzero (entries, sizeof (struct charset_map_entries)); 588 memset (entries, 0, sizeof (struct charset_map_entries));
589 589
590 n_entries = 0; 590 n_entries = 0;
591 for (i = 0; i < len; i += 2) 591 for (i = 0; i < len; i += 2)
@@ -622,7 +622,7 @@ load_charset_map_from_vector (struct charset *charset, Lisp_Object vec, int cont
622 SAFE_ALLOCA (entries->next, struct charset_map_entries *, 622 SAFE_ALLOCA (entries->next, struct charset_map_entries *,
623 sizeof (struct charset_map_entries)); 623 sizeof (struct charset_map_entries));
624 entries = entries->next; 624 entries = entries->next;
625 bzero (entries, sizeof (struct charset_map_entries)); 625 memset (entries, 0, sizeof (struct charset_map_entries));
626 } 626 }
627 idx = n_entries % 0x10000; 627 idx = n_entries % 0x10000;
628 entries->entry[idx].from = from; 628 entries->entry[idx].from = from;
@@ -935,7 +935,7 @@ usage: (define-charset-internal ...) */)
935 if (! charset.code_linear_p) 935 if (! charset.code_linear_p)
936 { 936 {
937 charset.code_space_mask = (unsigned char *) xmalloc (256); 937 charset.code_space_mask = (unsigned char *) xmalloc (256);
938 bzero (charset.code_space_mask, 256); 938 memset (charset.code_space_mask, 0, 256);
939 for (i = 0; i < 4; i++) 939 for (i = 0; i < 4; i++)
940 for (j = charset.code_space[i * 4]; j <= charset.code_space[i * 4 + 1]; 940 for (j = charset.code_space[i * 4]; j <= charset.code_space[i * 4 + 1];
941 j++) 941 j++)
@@ -1058,7 +1058,7 @@ usage: (define-charset-internal ...) */)
1058 1058
1059 charset.unified_p = 0; 1059 charset.unified_p = 0;
1060 1060
1061 bzero (charset.fast_map, sizeof (charset.fast_map)); 1061 memset (charset.fast_map, 0, sizeof (charset.fast_map));
1062 1062
1063 if (! NILP (args[charset_arg_code_offset])) 1063 if (! NILP (args[charset_arg_code_offset]))
1064 { 1064 {
@@ -1191,8 +1191,8 @@ usage: (define-charset-internal ...) */)
1191 struct charset *new_table 1191 struct charset *new_table
1192 = (struct charset *) xmalloc (sizeof (struct charset) 1192 = (struct charset *) xmalloc (sizeof (struct charset)
1193 * (charset_table_size + 16)); 1193 * (charset_table_size + 16));
1194 bcopy (charset_table, new_table, 1194 memcpy (new_table, charset_table,
1195 sizeof (struct charset) * charset_table_size); 1195 sizeof (struct charset) * charset_table_size);
1196 charset_table_size += 16; 1196 charset_table_size += 16;
1197 charset_table = new_table; 1197 charset_table = new_table;
1198 } 1198 }
diff --git a/src/cm.c b/src/cm.c
index c2a68ed7015..dac6ece7b2d 100644
--- a/src/cm.c
+++ b/src/cm.c
@@ -430,7 +430,7 @@ cmgoto (struct tty_display_info *tty, int row, int col)
430void 430void
431Wcm_clear (struct tty_display_info *tty) 431Wcm_clear (struct tty_display_info *tty)
432{ 432{
433 bzero (tty->Wcm, sizeof (struct cm)); 433 memset (tty->Wcm, 0, sizeof (struct cm));
434 UP = 0; 434 UP = 0;
435 BC = 0; 435 BC = 0;
436} 436}
diff --git a/src/coding.c b/src/coding.c
index f16d505b67a..989fd70b497 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -6550,7 +6550,7 @@ decode_eol (struct coding_system *coding)
6550 for (p = pend - 2; p >= pbeg; p--) 6550 for (p = pend - 2; p >= pbeg; p--)
6551 if (*p == '\r') 6551 if (*p == '\r')
6552 { 6552 {
6553 safe_bcopy ((char *) (p + 1), (char *) p, pend-- - p - 1); 6553 memmove (p, p + 1, pend-- - p - 1);
6554 n++; 6554 n++;
6555 } 6555 }
6556 } 6556 }
@@ -7814,7 +7814,7 @@ decode_coding_object (struct coding_system *coding,
7814 } 7814 }
7815 if (BEGV < GPT && GPT < BEGV + coding->produced_char) 7815 if (BEGV < GPT && GPT < BEGV + coding->produced_char)
7816 move_gap_both (BEGV, BEGV_BYTE); 7816 move_gap_both (BEGV, BEGV_BYTE);
7817 bcopy (BEGV_ADDR, destination, coding->produced); 7817 memcpy (destination, BEGV_ADDR, coding->produced);
7818 coding->destination = destination; 7818 coding->destination = destination;
7819 } 7819 }
7820 } 7820 }
@@ -9482,7 +9482,7 @@ usage: (set-coding-system-priority &rest coding-systems) */)
9482 int changed[coding_category_max]; 9482 int changed[coding_category_max];
9483 enum coding_category priorities[coding_category_max]; 9483 enum coding_category priorities[coding_category_max];
9484 9484
9485 bzero (changed, sizeof changed); 9485 memset (changed, 0, sizeof changed);
9486 9486
9487 for (i = j = 0; i < nargs; i++) 9487 for (i = j = 0; i < nargs; i++)
9488 { 9488 {
@@ -9517,7 +9517,7 @@ usage: (set-coding-system-priority &rest coding-systems) */)
9517 priorities[i] = coding_priorities[j]; 9517 priorities[i] = coding_priorities[j];
9518 } 9518 }
9519 9519
9520 bcopy (priorities, coding_priorities, sizeof priorities); 9520 memcpy (coding_priorities, priorities, sizeof priorities);
9521 9521
9522 /* Update `coding-category-list'. */ 9522 /* Update `coding-category-list'. */
9523 Vcoding_category_list = Qnil; 9523 Vcoding_category_list = Qnil;
@@ -9568,11 +9568,11 @@ make_subsidiaries (Lisp_Object base)
9568 char *buf = (char *) alloca (base_name_len + 6); 9568 char *buf = (char *) alloca (base_name_len + 6);
9569 int i; 9569 int i;
9570 9570
9571 bcopy (SDATA (SYMBOL_NAME (base)), buf, base_name_len); 9571 memcpy (buf, SDATA (SYMBOL_NAME (base)), base_name_len);
9572 subsidiaries = Fmake_vector (make_number (3), Qnil); 9572 subsidiaries = Fmake_vector (make_number (3), Qnil);
9573 for (i = 0; i < 3; i++) 9573 for (i = 0; i < 3; i++)
9574 { 9574 {
9575 bcopy (suffixes[i], buf + base_name_len, strlen (suffixes[i]) + 1); 9575 memcpy (buf + base_name_len, suffixes[i], strlen (suffixes[i]) + 1);
9576 ASET (subsidiaries, i, intern (buf)); 9576 ASET (subsidiaries, i, intern (buf));
9577 } 9577 }
9578 return subsidiaries; 9578 return subsidiaries;
diff --git a/src/config.in b/src/config.in
index e2328dd9384..1ef407c158b 100644
--- a/src/config.in
+++ b/src/config.in
@@ -102,15 +102,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
102/* Define to 1 if ALSA is available. */ 102/* Define to 1 if ALSA is available. */
103#undef HAVE_ALSA 103#undef HAVE_ALSA
104 104
105/* Define to 1 if you have the `bcmp' function. */
106#undef HAVE_BCMP
107
108/* Define to 1 if you have the `bcopy' function. */
109#undef HAVE_BCOPY
110
111/* Define to 1 if you have the `bzero' function. */
112#undef HAVE_BZERO
113
114/* Define to 1 if you have the `cbrt' function. */ 105/* Define to 1 if you have the `cbrt' function. */
115#undef HAVE_CBRT 106#undef HAVE_CBRT
116 107
@@ -1141,10 +1132,6 @@ SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. */
1141#include <string.h> 1132#include <string.h>
1142#endif 1133#endif
1143 1134
1144#ifdef HAVE_STRINGS_H
1145#include <strings.h> /* May be needed for bcopy & al. */
1146#endif
1147
1148#ifdef HAVE_STDLIB_H 1135#ifdef HAVE_STDLIB_H
1149#include <stdlib.h> 1136#include <stdlib.h>
1150#endif 1137#endif
@@ -1186,16 +1173,6 @@ typedef unsigned size_t;
1186# endif 1173# endif
1187#endif 1174#endif
1188 1175
1189#ifndef HAVE_BCOPY
1190#define bcopy(a,b,s) memcpy (b,a,s)
1191#endif
1192#ifndef HAVE_BZERO
1193#define bzero(a,s) memset (a,0,s)
1194#endif
1195#ifndef HAVE_BCMP
1196#define BCMP memcmp
1197#endif
1198
1199#endif /* EMACS_CONFIG_H */ 1176#endif /* EMACS_CONFIG_H */
1200 1177
1201/* 1178/*
diff --git a/src/data.c b/src/data.c
index 3949e6da54b..cde6e9538b9 100644
--- a/src/data.c
+++ b/src/data.c
@@ -2264,13 +2264,13 @@ bool-vector. IDX starts at 0. */)
2264 USE_SAFE_ALLOCA; 2264 USE_SAFE_ALLOCA;
2265 2265
2266 SAFE_ALLOCA (str, unsigned char *, nbytes); 2266 SAFE_ALLOCA (str, unsigned char *, nbytes);
2267 bcopy (SDATA (array), str, nbytes); 2267 memcpy (str, SDATA (array), nbytes);
2268 allocate_string_data (XSTRING (array), nchars, 2268 allocate_string_data (XSTRING (array), nchars,
2269 nbytes + new_bytes - prev_bytes); 2269 nbytes + new_bytes - prev_bytes);
2270 bcopy (str, SDATA (array), idxval_byte); 2270 memcpy (SDATA (array), str, idxval_byte);
2271 p1 = SDATA (array) + idxval_byte; 2271 p1 = SDATA (array) + idxval_byte;
2272 bcopy (str + idxval_byte + prev_bytes, p1 + new_bytes, 2272 memcpy (p1 + new_bytes, str + idxval_byte + prev_bytes,
2273 nbytes - (idxval_byte + prev_bytes)); 2273 nbytes - (idxval_byte + prev_bytes));
2274 SAFE_FREE (); 2274 SAFE_FREE ();
2275 clear_string_char_byte_cache (); 2275 clear_string_char_byte_cache ();
2276 } 2276 }
diff --git a/src/dired.c b/src/dired.c
index a24d068d3b6..cbff34302b9 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -289,15 +289,14 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m
289 int nchars; 289 int nchars;
290 290
291 fullname = make_uninit_multibyte_string (nbytes, nbytes); 291 fullname = make_uninit_multibyte_string (nbytes, nbytes);
292 bcopy (SDATA (directory), SDATA (fullname), 292 memcpy (SDATA (fullname), SDATA (directory),
293 directory_nbytes); 293 directory_nbytes);
294 294
295 if (needsep) 295 if (needsep)
296 SSET (fullname, directory_nbytes, DIRECTORY_SEP); 296 SSET (fullname, directory_nbytes, DIRECTORY_SEP);
297 297
298 bcopy (SDATA (name), 298 memcpy (SDATA (fullname) + directory_nbytes + needsep,
299 SDATA (fullname) + directory_nbytes + needsep, 299 SDATA (name), len);
300 len);
301 300
302 nchars = chars_in_text (SDATA (fullname), nbytes); 301 nchars = chars_in_text (SDATA (fullname), nbytes);
303 302
@@ -857,11 +856,11 @@ file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_ad
857 _djstat_flags = _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE; 856 _djstat_flags = _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE;
858#endif /* MSDOS */ 857#endif /* MSDOS */
859 858
860 bcopy (SDATA (dirname), fullname, pos); 859 memcpy (fullname, SDATA (dirname), pos);
861 if (!IS_DIRECTORY_SEP (fullname[pos - 1])) 860 if (!IS_DIRECTORY_SEP (fullname[pos - 1]))
862 fullname[pos++] = DIRECTORY_SEP; 861 fullname[pos++] = DIRECTORY_SEP;
863 862
864 bcopy (dp->d_name, fullname + pos, len); 863 memcpy (fullname + pos, dp->d_name, len);
865 fullname[pos + len] = 0; 864 fullname[pos + len] = 0;
866 865
867#ifdef S_IFLNK 866#ifdef S_IFLNK
diff --git a/src/dispnew.c b/src/dispnew.c
index 2bfec21f3f2..7c0009e570a 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -436,62 +436,15 @@ DEFUN ("dump-redisplay-history", Fdump_redisplay_history,
436#endif /* GLYPH_DEBUG == 0 */ 436#endif /* GLYPH_DEBUG == 0 */
437 437
438 438
439/* Like bcopy except never gets confused by overlap. Let this be the 439#ifdef PROFILING
440 first function defined in this file, or change emacs.c where the 440/* FIXME: only used to find text start for profiling. */
441 address of this function is used. */
442 441
443void 442void
444safe_bcopy (const char *from, char *to, int size) 443safe_bcopy (const char *from, char *to, int size)
445{ 444{
446 if (size <= 0 || from == to) 445 abort ();
447 return;
448
449 /* If the source and destination don't overlap, then bcopy can
450 handle it. If they do overlap, but the destination is lower in
451 memory than the source, we'll assume bcopy can handle that. */
452 if (to < from || from + size <= to)
453 bcopy (from, to, size);
454
455 /* Otherwise, we'll copy from the end. */
456 else
457 {
458 register const char *endf = from + size;
459 register char *endt = to + size;
460
461 /* If TO - FROM is large, then we should break the copy into
462 nonoverlapping chunks of TO - FROM bytes each. However, if
463 TO - FROM is small, then the bcopy function call overhead
464 makes this not worth it. The crossover point could be about
465 anywhere. Since I don't think the obvious copy loop is too
466 bad, I'm trying to err in its favor. */
467 if (to - from < 64)
468 {
469 do
470 *--endt = *--endf;
471 while (endf != from);
472 }
473 else
474 {
475 for (;;)
476 {
477 endt -= (to - from);
478 endf -= (to - from);
479
480 if (endt < to)
481 break;
482
483 bcopy (endf, endt, to - from);
484 }
485
486 /* If SIZE wasn't a multiple of TO - FROM, there will be a
487 little left over. The amount left over is (endt + (to -
488 from)) - to, which is endt - from. */
489 bcopy (from, to, endt - from);
490 }
491 }
492} 446}
493 447#endif
494
495 448
496/*********************************************************************** 449/***********************************************************************
497 Glyph Matrices 450 Glyph Matrices
@@ -510,7 +463,7 @@ new_glyph_matrix (struct glyph_pool *pool)
510 463
511 /* Allocate and clear. */ 464 /* Allocate and clear. */
512 result = (struct glyph_matrix *) xmalloc (sizeof *result); 465 result = (struct glyph_matrix *) xmalloc (sizeof *result);
513 bzero (result, sizeof *result); 466 memset (result, 0, sizeof *result);
514 467
515 /* Increment number of allocated matrices. This count is used 468 /* Increment number of allocated matrices. This count is used
516 to detect memory leaks. */ 469 to detect memory leaks. */
@@ -655,8 +608,8 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
655 int size = dim.height * sizeof (struct glyph_row); 608 int size = dim.height * sizeof (struct glyph_row);
656 new_rows = dim.height - matrix->rows_allocated; 609 new_rows = dim.height - matrix->rows_allocated;
657 matrix->rows = (struct glyph_row *) xrealloc (matrix->rows, size); 610 matrix->rows = (struct glyph_row *) xrealloc (matrix->rows, size);
658 bzero (matrix->rows + matrix->rows_allocated, 611 memset (matrix->rows + matrix->rows_allocated, 0,
659 new_rows * sizeof *matrix->rows); 612 new_rows * sizeof *matrix->rows);
660 matrix->rows_allocated = dim.height; 613 matrix->rows_allocated = dim.height;
661 } 614 }
662 else 615 else
@@ -1103,7 +1056,7 @@ clear_glyph_row (struct glyph_row *row)
1103 returned by xmalloc. If flickering happens again, activate 1056 returned by xmalloc. If flickering happens again, activate
1104 the code below. If the flickering is gone with that, chances 1057 the code below. If the flickering is gone with that, chances
1105 are that the flickering has the same reason as here. */ 1058 are that the flickering has the same reason as here. */
1106 bzero (p[0], (char *) p[LAST_AREA] - (char *) p[0]); 1059 memset (p[0], 0, (char *) p[LAST_AREA] - (char *) p[0]);
1107#endif 1060#endif
1108} 1061}
1109 1062
@@ -1237,13 +1190,13 @@ copy_row_except_pointers (struct glyph_row *to, struct glyph_row *from)
1237 struct glyph *pointers[1 + LAST_AREA]; 1190 struct glyph *pointers[1 + LAST_AREA];
1238 1191
1239 /* Save glyph pointers of TO. */ 1192 /* Save glyph pointers of TO. */
1240 bcopy (to->glyphs, pointers, sizeof to->glyphs); 1193 memcpy (pointers, to->glyphs, sizeof to->glyphs);
1241 1194
1242 /* Do a structure assignment. */ 1195 /* Do a structure assignment. */
1243 *to = *from; 1196 *to = *from;
1244 1197
1245 /* Restore original pointers of TO. */ 1198 /* Restore original pointers of TO. */
1246 bcopy (pointers, to->glyphs, sizeof to->glyphs); 1199 memcpy (to->glyphs, pointers, sizeof to->glyphs);
1247} 1200}
1248 1201
1249 1202
@@ -1264,8 +1217,8 @@ copy_glyph_row_contents (struct glyph_row *to, struct glyph_row *from, int delta
1264 /* Copy glyphs from FROM to TO. */ 1217 /* Copy glyphs from FROM to TO. */
1265 for (area = 0; area < LAST_AREA; ++area) 1218 for (area = 0; area < LAST_AREA; ++area)
1266 if (from->used[area]) 1219 if (from->used[area])
1267 bcopy (from->glyphs[area], to->glyphs[area], 1220 memcpy (to->glyphs[area], from->glyphs[area],
1268 from->used[area] * sizeof (struct glyph)); 1221 from->used[area] * sizeof (struct glyph));
1269 1222
1270 /* Increment buffer positions in TO by DELTA. */ 1223 /* Increment buffer positions in TO by DELTA. */
1271 increment_row_positions (to, delta, delta_bytes); 1224 increment_row_positions (to, delta, delta_bytes);
@@ -1524,7 +1477,7 @@ new_glyph_pool (void)
1524 1477
1525 /* Allocate a new glyph_pool and clear it. */ 1478 /* Allocate a new glyph_pool and clear it. */
1526 result = (struct glyph_pool *) xmalloc (sizeof *result); 1479 result = (struct glyph_pool *) xmalloc (sizeof *result);
1527 bzero (result, sizeof *result); 1480 memset (result, 0, sizeof *result);
1528 1481
1529 /* For memory leak and double deletion checking. */ 1482 /* For memory leak and double deletion checking. */
1530 ++glyph_pool_count; 1483 ++glyph_pool_count;
@@ -1585,7 +1538,7 @@ realloc_glyph_pool (struct glyph_pool *pool, struct dim matrix_dim)
1585 else 1538 else
1586 { 1539 {
1587 pool->glyphs = (struct glyph *) xmalloc (size); 1540 pool->glyphs = (struct glyph *) xmalloc (size);
1588 bzero (pool->glyphs, size); 1541 memset (pool->glyphs, 0, size);
1589 } 1542 }
1590 1543
1591 pool->nglyphs = needed; 1544 pool->nglyphs = needed;
@@ -2196,11 +2149,11 @@ save_current_matrix (struct frame *f)
2196 struct glyph_matrix *saved; 2149 struct glyph_matrix *saved;
2197 2150
2198 saved = (struct glyph_matrix *) xmalloc (sizeof *saved); 2151 saved = (struct glyph_matrix *) xmalloc (sizeof *saved);
2199 bzero (saved, sizeof *saved); 2152 memset (saved, 0, sizeof *saved);
2200 saved->nrows = f->current_matrix->nrows; 2153 saved->nrows = f->current_matrix->nrows;
2201 saved->rows = (struct glyph_row *) xmalloc (saved->nrows 2154 saved->rows = (struct glyph_row *) xmalloc (saved->nrows
2202 * sizeof *saved->rows); 2155 * sizeof *saved->rows);
2203 bzero (saved->rows, saved->nrows * sizeof *saved->rows); 2156 memset (saved->rows, 0, saved->nrows * sizeof *saved->rows);
2204 2157
2205 for (i = 0; i < saved->nrows; ++i) 2158 for (i = 0; i < saved->nrows; ++i)
2206 { 2159 {
@@ -2208,7 +2161,7 @@ save_current_matrix (struct frame *f)
2208 struct glyph_row *to = saved->rows + i; 2161 struct glyph_row *to = saved->rows + i;
2209 size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph); 2162 size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph);
2210 to->glyphs[TEXT_AREA] = (struct glyph *) xmalloc (nbytes); 2163 to->glyphs[TEXT_AREA] = (struct glyph *) xmalloc (nbytes);
2211 bcopy (from->glyphs[TEXT_AREA], to->glyphs[TEXT_AREA], nbytes); 2164 memcpy (to->glyphs[TEXT_AREA], from->glyphs[TEXT_AREA], nbytes);
2212 to->used[TEXT_AREA] = from->used[TEXT_AREA]; 2165 to->used[TEXT_AREA] = from->used[TEXT_AREA];
2213 } 2166 }
2214 2167
@@ -2229,7 +2182,7 @@ restore_current_matrix (struct frame *f, struct glyph_matrix *saved)
2229 struct glyph_row *from = saved->rows + i; 2182 struct glyph_row *from = saved->rows + i;
2230 struct glyph_row *to = f->current_matrix->rows + i; 2183 struct glyph_row *to = f->current_matrix->rows + i;
2231 size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph); 2184 size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph);
2232 bcopy (from->glyphs[TEXT_AREA], to->glyphs[TEXT_AREA], nbytes); 2185 memcpy (to->glyphs[TEXT_AREA], from->glyphs[TEXT_AREA], nbytes);
2233 to->used[TEXT_AREA] = from->used[TEXT_AREA]; 2186 to->used[TEXT_AREA] = from->used[TEXT_AREA];
2234 xfree (from->glyphs[TEXT_AREA]); 2187 xfree (from->glyphs[TEXT_AREA]);
2235 } 2188 }
@@ -2740,9 +2693,9 @@ build_frame_matrix_from_leaf_window (struct glyph_matrix *frame_matrix, struct w
2740 if (current_row_p) 2693 if (current_row_p)
2741 { 2694 {
2742 /* Copy window row to frame row. */ 2695 /* Copy window row to frame row. */
2743 bcopy (window_row->glyphs[0], 2696 memcpy (frame_row->glyphs[TEXT_AREA] + window_matrix->matrix_x,
2744 frame_row->glyphs[TEXT_AREA] + window_matrix->matrix_x, 2697 window_row->glyphs[0],
2745 window_matrix->matrix_w * sizeof (struct glyph)); 2698 window_matrix->matrix_w * sizeof (struct glyph));
2746 } 2699 }
2747 else 2700 else
2748 { 2701 {
@@ -2979,7 +2932,7 @@ mirrored_line_dance (matrix, unchanged_at_top, nlines, copy_from,
2979 2932
2980 /* Make a copy of the original rows. */ 2933 /* Make a copy of the original rows. */
2981 old_rows = (struct glyph_row *) alloca (nlines * sizeof *old_rows); 2934 old_rows = (struct glyph_row *) alloca (nlines * sizeof *old_rows);
2982 bcopy (new_rows, old_rows, nlines * sizeof *old_rows); 2935 memcpy (old_rows, new_rows, nlines * sizeof *old_rows);
2983 2936
2984 /* Assign new rows, maybe clear lines. */ 2937 /* Assign new rows, maybe clear lines. */
2985 for (i = 0; i < nlines; ++i) 2938 for (i = 0; i < nlines; ++i)
@@ -3097,7 +3050,7 @@ mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy
3097 3050
3098 /* Make a copy of the original rows of matrix m. */ 3051 /* Make a copy of the original rows of matrix m. */
3099 old_rows = (struct glyph_row *) alloca (m->nrows * sizeof *old_rows); 3052 old_rows = (struct glyph_row *) alloca (m->nrows * sizeof *old_rows);
3100 bcopy (m->rows, old_rows, m->nrows * sizeof *old_rows); 3053 memcpy (old_rows, m->rows, m->nrows * sizeof *old_rows);
3101 3054
3102 for (i = 0; i < nlines; ++i) 3055 for (i = 0; i < nlines; ++i)
3103 { 3056 {
@@ -4563,7 +4516,7 @@ scrolling_window (struct window *w, int header_line_p)
4563 row_table_size = next_almost_prime (3 * n); 4516 row_table_size = next_almost_prime (3 * n);
4564 nbytes = row_table_size * sizeof *row_table; 4517 nbytes = row_table_size * sizeof *row_table;
4565 row_table = (struct row_entry **) xrealloc (row_table, nbytes); 4518 row_table = (struct row_entry **) xrealloc (row_table, nbytes);
4566 bzero (row_table, nbytes); 4519 memset (row_table, 0, nbytes);
4567 } 4520 }
4568 4521
4569 if (n > row_entry_pool_size) 4522 if (n > row_entry_pool_size)
diff --git a/src/doc.c b/src/doc.c
index 57e1bc8f0e6..ce4c1ddda6a 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -686,7 +686,7 @@ the same file name is found in the `doc-directory'. */)
686 } 686 }
687 pos += end - buf; 687 pos += end - buf;
688 filled -= end - buf; 688 filled -= end - buf;
689 bcopy (end, buf, filled); 689 memcpy (buf, end, filled);
690 } 690 }
691 emacs_close (fd); 691 emacs_close (fd);
692 return Qnil; 692 return Qnil;
@@ -765,7 +765,7 @@ a new string, without any text properties, is returned. */)
765 if (len == 1) 765 if (len == 1)
766 *bufp = *strp; 766 *bufp = *strp;
767 else 767 else
768 bcopy (strp, bufp, len); 768 memcpy (bufp, strp, len);
769 strp += len; 769 strp += len;
770 bufp += len; 770 bufp += len;
771 nchars++; 771 nchars++;
@@ -817,7 +817,7 @@ a new string, without any text properties, is returned. */)
817 int offset = bufp - buf; 817 int offset = bufp - buf;
818 buf = (unsigned char *) xrealloc (buf, bsize += 4); 818 buf = (unsigned char *) xrealloc (buf, bsize += 4);
819 bufp = buf + offset; 819 bufp = buf + offset;
820 bcopy ("M-x ", bufp, 4); 820 memcpy (bufp, "M-x ", 4);
821 bufp += 4; 821 bufp += 4;
822 nchars += 4; 822 nchars += 4;
823 if (multibyte) 823 if (multibyte)
@@ -911,7 +911,7 @@ a new string, without any text properties, is returned. */)
911 int offset = bufp - buf; 911 int offset = bufp - buf;
912 buf = (unsigned char *) xrealloc (buf, bsize += length_byte); 912 buf = (unsigned char *) xrealloc (buf, bsize += length_byte);
913 bufp = buf + offset; 913 bufp = buf + offset;
914 bcopy (start, bufp, length_byte); 914 memcpy (bufp, start, length_byte);
915 bufp += length_byte; 915 bufp += length_byte;
916 nchars += length; 916 nchars += length;
917 /* Check STRING again in case gc relocated it. */ 917 /* Check STRING again in case gc relocated it. */
@@ -928,7 +928,7 @@ a new string, without any text properties, is returned. */)
928 if (len == 1) 928 if (len == 1)
929 *bufp = *strp; 929 *bufp = *strp;
930 else 930 else
931 bcopy (strp, bufp, len); 931 memcpy (bufp, strp, len);
932 strp += len; 932 strp += len;
933 bufp += len; 933 bufp += len;
934 nchars++; 934 nchars++;
diff --git a/src/doprnt.c b/src/doprnt.c
index f747d3a0281..3ff2f70dd34 100644
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -229,12 +229,12 @@ doprnt (char *buffer, register int bufsize, char *format, char *format_end, int
229 /* Truncate the string at character boundary. */ 229 /* Truncate the string at character boundary. */
230 tem = bufsize; 230 tem = bufsize;
231 while (!CHAR_HEAD_P (string[tem - 1])) tem--; 231 while (!CHAR_HEAD_P (string[tem - 1])) tem--;
232 bcopy (string, bufptr, tem); 232 memcpy (bufptr, string, tem);
233 /* We must calculate WIDTH again. */ 233 /* We must calculate WIDTH again. */
234 width = strwidth (bufptr, tem); 234 width = strwidth (bufptr, tem);
235 } 235 }
236 else 236 else
237 bcopy (string, bufptr, tem); 237 memcpy (bufptr, string, tem);
238 bufptr += tem; 238 bufptr += tem;
239 bufsize -= tem; 239 bufsize -= tem;
240 if (minlen < 0) 240 if (minlen < 0)
diff --git a/src/editfns.c b/src/editfns.c
index 5b340644fa8..ba27d4a76e0 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1405,7 +1405,7 @@ name, or nil if there is no such user. */)
1405 1405
1406 login = Fuser_login_name (make_number (pw->pw_uid)); 1406 login = Fuser_login_name (make_number (pw->pw_uid));
1407 r = (unsigned char *) alloca (strlen (p) + SCHARS (login) + 1); 1407 r = (unsigned char *) alloca (strlen (p) + SCHARS (login) + 1);
1408 bcopy (p, r, q - p); 1408 memcpy (r, p, q - p);
1409 r[q - p] = 0; 1409 r[q - p] = 0;
1410 strcat (r, SDATA (login)); 1410 strcat (r, SDATA (login));
1411 r[q - p] = UPCASE (r[q - p]); 1411 r[q - p] = UPCASE (r[q - p]);
@@ -2418,8 +2418,7 @@ make_buffer_string_both (int start, int start_byte, int end, int end_byte, int p
2418 result = make_uninit_multibyte_string (end - start, end_byte - start_byte); 2418 result = make_uninit_multibyte_string (end - start, end_byte - start_byte);
2419 else 2419 else
2420 result = make_uninit_string (end - start); 2420 result = make_uninit_string (end - start);
2421 bcopy (BYTE_POS_ADDR (start_byte), SDATA (result), 2421 memcpy (SDATA (result), BYTE_POS_ADDR (start_byte), end_byte - start_byte);
2422 end_byte - start_byte);
2423 2422
2424 /* If desired, update and copy the text properties. */ 2423 /* If desired, update and copy the text properties. */
2425 if (props) 2424 if (props)
@@ -3437,7 +3436,7 @@ usage: (message-box FORMAT-STRING &rest ARGS) */)
3437 message_length = SBYTES (val); 3436 message_length = SBYTES (val);
3438 message_text = (char *)xrealloc (message_text, message_length); 3437 message_text = (char *)xrealloc (message_text, message_length);
3439 } 3438 }
3440 bcopy (SDATA (val), message_text, SBYTES (val)); 3439 memcpy (message_text, SDATA (val), SBYTES (val));
3441 message2 (message_text, SBYTES (val), 3440 message2 (message_text, SBYTES (val),
3442 STRING_MULTIBYTE (val)); 3441 STRING_MULTIBYTE (val));
3443 return val; 3442 return val;
@@ -3654,12 +3653,12 @@ usage: (format STRING &rest OBJECTS) */)
3654 int i; 3653 int i;
3655 if (!info) 3654 if (!info)
3656 info = (struct info *) alloca (nbytes); 3655 info = (struct info *) alloca (nbytes);
3657 bzero (info, nbytes); 3656 memset (info, 0, nbytes);
3658 for (i = 0; i <= nargs; i++) 3657 for (i = 0; i <= nargs; i++)
3659 info[i].start = -1; 3658 info[i].start = -1;
3660 if (!discarded) 3659 if (!discarded)
3661 SAFE_ALLOCA (discarded, char *, SBYTES (args[0])); 3660 SAFE_ALLOCA (discarded, char *, SBYTES (args[0]));
3662 bzero (discarded, SBYTES (args[0])); 3661 memset (discarded, 0, SBYTES (args[0]));
3663 } 3662 }
3664 3663
3665 /* Add to TOTAL enough space to hold the converted arguments. */ 3664 /* Add to TOTAL enough space to hold the converted arguments. */
@@ -3973,8 +3972,8 @@ usage: (format STRING &rest OBJECTS) */)
3973 { 3972 {
3974 int this_nchars; 3973 int this_nchars;
3975 3974
3976 bcopy (this_format_start, this_format, 3975 memcpy (this_format, this_format_start,
3977 format - this_format_start); 3976 format - this_format_start);
3978 this_format[format - this_format_start] = 0; 3977 this_format[format - this_format_start] = 0;
3979 3978
3980 if (format[-1] == 'e' || format[-1] == 'f' || format[-1] == 'g') 3979 if (format[-1] == 'e' || format[-1] == 'f' || format[-1] == 'g')
@@ -4451,9 +4450,9 @@ Transposing beyond buffer boundaries is an error. */)
4451 start1_addr = BYTE_POS_ADDR (start1_byte); 4450 start1_addr = BYTE_POS_ADDR (start1_byte);
4452 start2_addr = BYTE_POS_ADDR (start2_byte); 4451 start2_addr = BYTE_POS_ADDR (start2_byte);
4453 4452
4454 bcopy (start2_addr, temp, len2_byte); 4453 memcpy (temp, start2_addr, len2_byte);
4455 bcopy (start1_addr, start1_addr + len2_byte, len1_byte); 4454 memcpy (start1_addr + len2_byte, start1_addr, len1_byte);
4456 bcopy (temp, start1_addr, len2_byte); 4455 memcpy (start1_addr, temp, len2_byte);
4457 SAFE_FREE (); 4456 SAFE_FREE ();
4458 } 4457 }
4459 else 4458 else
@@ -4464,9 +4463,9 @@ Transposing beyond buffer boundaries is an error. */)
4464 SAFE_ALLOCA (temp, unsigned char *, len1_byte); 4463 SAFE_ALLOCA (temp, unsigned char *, len1_byte);
4465 start1_addr = BYTE_POS_ADDR (start1_byte); 4464 start1_addr = BYTE_POS_ADDR (start1_byte);
4466 start2_addr = BYTE_POS_ADDR (start2_byte); 4465 start2_addr = BYTE_POS_ADDR (start2_byte);
4467 bcopy (start1_addr, temp, len1_byte); 4466 memcpy (temp, start1_addr, len1_byte);
4468 bcopy (start2_addr, start1_addr, len2_byte); 4467 memcpy (start1_addr, start2_addr, len2_byte);
4469 bcopy (temp, start1_addr + len2_byte, len1_byte); 4468 memcpy (start1_addr + len2_byte, temp, len1_byte);
4470 SAFE_FREE (); 4469 SAFE_FREE ();
4471 } 4470 }
4472 graft_intervals_into_buffer (tmp_interval1, start1 + len2, 4471 graft_intervals_into_buffer (tmp_interval1, start1 + len2,
@@ -4504,9 +4503,9 @@ Transposing beyond buffer boundaries is an error. */)
4504 SAFE_ALLOCA (temp, unsigned char *, len1_byte); 4503 SAFE_ALLOCA (temp, unsigned char *, len1_byte);
4505 start1_addr = BYTE_POS_ADDR (start1_byte); 4504 start1_addr = BYTE_POS_ADDR (start1_byte);
4506 start2_addr = BYTE_POS_ADDR (start2_byte); 4505 start2_addr = BYTE_POS_ADDR (start2_byte);
4507 bcopy (start1_addr, temp, len1_byte); 4506 memcpy (temp, start1_addr, len1_byte);
4508 bcopy (start2_addr, start1_addr, len2_byte); 4507 memcpy (start1_addr, start2_addr, len2_byte);
4509 bcopy (temp, start2_addr, len1_byte); 4508 memcpy (start2_addr, temp, len1_byte);
4510 SAFE_FREE (); 4509 SAFE_FREE ();
4511 4510
4512 graft_intervals_into_buffer (tmp_interval1, start2, 4511 graft_intervals_into_buffer (tmp_interval1, start2,
@@ -4534,10 +4533,10 @@ Transposing beyond buffer boundaries is an error. */)
4534 SAFE_ALLOCA (temp, unsigned char *, len2_byte); 4533 SAFE_ALLOCA (temp, unsigned char *, len2_byte);
4535 start1_addr = BYTE_POS_ADDR (start1_byte); 4534 start1_addr = BYTE_POS_ADDR (start1_byte);
4536 start2_addr = BYTE_POS_ADDR (start2_byte); 4535 start2_addr = BYTE_POS_ADDR (start2_byte);
4537 bcopy (start2_addr, temp, len2_byte); 4536 memcpy (temp, start2_addr, len2_byte);
4538 bcopy (start1_addr, start1_addr + len_mid + len2_byte, len1_byte); 4537 memcpy (start1_addr + len_mid + len2_byte, start1_addr, len1_byte);
4539 safe_bcopy (start1_addr + len1_byte, start1_addr + len2_byte, len_mid); 4538 memmove (start1_addr + len2_byte, start1_addr + len1_byte, len_mid);
4540 bcopy (temp, start1_addr, len2_byte); 4539 memcpy (start1_addr, temp, len2_byte);
4541 SAFE_FREE (); 4540 SAFE_FREE ();
4542 4541
4543 graft_intervals_into_buffer (tmp_interval1, end2 - len1, 4542 graft_intervals_into_buffer (tmp_interval1, end2 - len1,
@@ -4567,10 +4566,10 @@ Transposing beyond buffer boundaries is an error. */)
4567 SAFE_ALLOCA (temp, unsigned char *, len1_byte); 4566 SAFE_ALLOCA (temp, unsigned char *, len1_byte);
4568 start1_addr = BYTE_POS_ADDR (start1_byte); 4567 start1_addr = BYTE_POS_ADDR (start1_byte);
4569 start2_addr = BYTE_POS_ADDR (start2_byte); 4568 start2_addr = BYTE_POS_ADDR (start2_byte);
4570 bcopy (start1_addr, temp, len1_byte); 4569 memcpy (temp, start1_addr, len1_byte);
4571 bcopy (start2_addr, start1_addr, len2_byte); 4570 memcpy (start1_addr, start2_addr, len2_byte);
4572 bcopy (start1_addr + len1_byte, start1_addr + len2_byte, len_mid); 4571 memcpy (start1_addr + len2_byte, start1_addr + len1_byte, len_mid);
4573 bcopy (temp, start1_addr + len2_byte + len_mid, len1_byte); 4572 memcpy (start1_addr + len2_byte + len_mid, temp, len1_byte);
4574 SAFE_FREE (); 4573 SAFE_FREE ();
4575 4574
4576 graft_intervals_into_buffer (tmp_interval1, end2 - len1, 4575 graft_intervals_into_buffer (tmp_interval1, end2 - len1,
diff --git a/src/emacs.c b/src/emacs.c
index 79604413beb..cccfb02f1ef 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1761,13 +1761,14 @@ main (int argc, char **argv)
1761 extern char etext; 1761 extern char etext;
1762#endif 1762#endif
1763 extern void safe_bcopy (); 1763 extern void safe_bcopy ();
1764 extern void dump_opcode_frequencies ();
1765 1764
1766 atexit (_mcleanup); 1765 atexit (_mcleanup);
1767 /* This uses safe_bcopy because that function comes first in the 1766 /* This uses safe_bcopy because that function comes first in the
1768 Emacs executable. It might be better to use something that 1767 Emacs executable. It might be better to use something that
1769 gives the start of the text segment, but start_of_text is not 1768 gives the start of the text segment, but start_of_text is not
1770 defined on all systems now. */ 1769 defined on all systems now. */
1770 /* FIXME: Does not work on architectures with function
1771 descriptors. */
1771 monstartup (safe_bcopy, &etext); 1772 monstartup (safe_bcopy, &etext);
1772 } 1773 }
1773 else 1774 else
@@ -2058,7 +2059,7 @@ sort_args (int argc, char **argv)
2058 while (to < argc) 2059 while (to < argc)
2059 new[to++] = 0; 2060 new[to++] = 0;
2060 2061
2061 bcopy (new, argv, sizeof (char *) * argc); 2062 memcpy (argv, new, sizeof (char *) * argc);
2062 2063
2063 xfree (options); 2064 xfree (options);
2064 xfree (new); 2065 xfree (new);
diff --git a/src/eval.c b/src/eval.c
index d7e19139c6e..47c46fcbfdf 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2529,7 +2529,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
2529 gcpro1.nvars = 1 + numargs; 2529 gcpro1.nvars = 1 + numargs;
2530 } 2530 }
2531 2531
2532 bcopy (args, funcall_args, nargs * sizeof (Lisp_Object)); 2532 memcpy (funcall_args, args, nargs * sizeof (Lisp_Object));
2533 /* Spread the last arg we got. Its first element goes in 2533 /* Spread the last arg we got. Its first element goes in
2534 the slot that it used to occupy, hence this value of I. */ 2534 the slot that it used to occupy, hence this value of I. */
2535 i = nargs - 1; 2535 i = nargs - 1;
@@ -3018,7 +3018,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
3018 if (XSUBR (fun)->max_args > numargs) 3018 if (XSUBR (fun)->max_args > numargs)
3019 { 3019 {
3020 internal_args = (Lisp_Object *) alloca (XSUBR (fun)->max_args * sizeof (Lisp_Object)); 3020 internal_args = (Lisp_Object *) alloca (XSUBR (fun)->max_args * sizeof (Lisp_Object));
3021 bcopy (args + 1, internal_args, numargs * sizeof (Lisp_Object)); 3021 memcpy (internal_args, args + 1, numargs * sizeof (Lisp_Object));
3022 for (i = numargs; i < XSUBR (fun)->max_args; i++) 3022 for (i = numargs; i < XSUBR (fun)->max_args; i++)
3023 internal_args[i] = Qnil; 3023 internal_args[i] = Qnil;
3024 } 3024 }
diff --git a/src/fileio.c b/src/fileio.c
index 525d6ebf4a8..ee2dc9fa52a 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -425,7 +425,7 @@ Given a Unix syntax file name, returns a string ending in slash. */)
425 filename = FILE_SYSTEM_CASE (filename); 425 filename = FILE_SYSTEM_CASE (filename);
426#ifdef DOS_NT 426#ifdef DOS_NT
427 beg = (unsigned char *) alloca (SBYTES (filename) + 1); 427 beg = (unsigned char *) alloca (SBYTES (filename) + 1);
428 bcopy (SDATA (filename), beg, SBYTES (filename) + 1); 428 memcpy (beg, SDATA (filename), SBYTES (filename) + 1);
429#else 429#else
430 beg = SDATA (filename); 430 beg = SDATA (filename);
431#endif 431#endif
@@ -725,10 +725,10 @@ make_temp_name (Lisp_Object prefix, int base64_p)
725 if (!STRING_MULTIBYTE (prefix)) 725 if (!STRING_MULTIBYTE (prefix))
726 STRING_SET_UNIBYTE (val); 726 STRING_SET_UNIBYTE (val);
727 data = SDATA (val); 727 data = SDATA (val);
728 bcopy(SDATA (prefix), data, len); 728 memcpy (data, SDATA (prefix), len);
729 p = data + len; 729 p = data + len;
730 730
731 bcopy (pidbuf, p, pidlen); 731 memcpy (p, pidbuf, pidlen);
732 p += pidlen; 732 p += pidlen;
733 733
734 /* Here we try to minimize useless stat'ing when this function is 734 /* Here we try to minimize useless stat'ing when this function is
@@ -939,7 +939,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
939 939
940 /* Make a local copy of nm[] to protect it from GC in DECODE_FILE below. */ 940 /* Make a local copy of nm[] to protect it from GC in DECODE_FILE below. */
941 nm = (unsigned char *) alloca (SBYTES (name) + 1); 941 nm = (unsigned char *) alloca (SBYTES (name) + 1);
942 bcopy (SDATA (name), nm, SBYTES (name) + 1); 942 memcpy (nm, SDATA (name), SBYTES (name) + 1);
943 943
944#ifdef DOS_NT 944#ifdef DOS_NT
945 /* Note if special escape prefix is present, but remove for now. */ 945 /* Note if special escape prefix is present, but remove for now. */
@@ -1093,7 +1093,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
1093 unsigned char *o, *p; 1093 unsigned char *o, *p;
1094 for (p = nm; *p && (!IS_DIRECTORY_SEP (*p)); p++); 1094 for (p = nm; *p && (!IS_DIRECTORY_SEP (*p)); p++);
1095 o = alloca (p - nm + 1); 1095 o = alloca (p - nm + 1);
1096 bcopy ((char *) nm, o, p - nm); 1096 memcpy (o, nm, p - nm);
1097 o [p - nm] = 0; 1097 o [p - nm] = 0;
1098 1098
1099 BLOCK_INPUT; 1099 BLOCK_INPUT;
@@ -1244,7 +1244,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
1244 ) 1244 )
1245 { 1245 {
1246 unsigned char *temp = (unsigned char *) alloca (length); 1246 unsigned char *temp = (unsigned char *) alloca (length);
1247 bcopy (newdir, temp, length - 1); 1247 memcpy (temp, newdir, length - 1);
1248 temp[length - 1] = 0; 1248 temp[length - 1] = 0;
1249 newdir = temp; 1249 newdir = temp;
1250 } 1250 }
@@ -1467,7 +1467,7 @@ See also the function `substitute-in-file-name'.")
1467 int len = ptr ? ptr - user : strlen (user); 1467 int len = ptr ? ptr - user : strlen (user);
1468 /* Copy the user name into temp storage. */ 1468 /* Copy the user name into temp storage. */
1469 o = (unsigned char *) alloca (len + 1); 1469 o = (unsigned char *) alloca (len + 1);
1470 bcopy ((char *) user, o, len); 1470 memcpy (o, user, len);
1471 o[len] = 0; 1471 o[len] = 0;
1472 1472
1473 /* Look up the user name. */ 1473 /* Look up the user name. */
@@ -1583,7 +1583,7 @@ search_embedded_absfilename (unsigned char *nm, unsigned char *endp)
1583 { 1583 {
1584 unsigned char *o = alloca (s - p + 1); 1584 unsigned char *o = alloca (s - p + 1);
1585 struct passwd *pw; 1585 struct passwd *pw;
1586 bcopy (p, o, s - p); 1586 memcpy (o, p, s - p);
1587 o [s - p] = 0; 1587 o [s - p] = 0;
1588 1588
1589 /* If we have ~user and `user' exists, discard 1589 /* If we have ~user and `user' exists, discard
@@ -1640,7 +1640,7 @@ those `/' is discarded. */)
1640 decode of environment variables, causing the original Lisp_String 1640 decode of environment variables, causing the original Lisp_String
1641 data to be relocated. */ 1641 data to be relocated. */
1642 nm = (unsigned char *) alloca (SBYTES (filename) + 1); 1642 nm = (unsigned char *) alloca (SBYTES (filename) + 1);
1643 bcopy (SDATA (filename), nm, SBYTES (filename) + 1); 1643 memcpy (nm, SDATA (filename), SBYTES (filename) + 1);
1644 1644
1645#ifdef DOS_NT 1645#ifdef DOS_NT
1646 dostounix_filename (nm); 1646 dostounix_filename (nm);
@@ -2733,7 +2733,7 @@ points to a nonexistent file. */)
2733 { 2733 {
2734 bufsize *= 2; 2734 bufsize *= 2;
2735 buf = (char *) xrealloc (buf, bufsize); 2735 buf = (char *) xrealloc (buf, bufsize);
2736 bzero (buf, bufsize); 2736 memset (buf, 0, bufsize);
2737 2737
2738 errno = 0; 2738 errno = 0;
2739 valsize = readlink (SDATA (filename), buf, bufsize); 2739 valsize = readlink (SDATA (filename), buf, bufsize);
@@ -3837,7 +3837,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3837 conversion_buffer); 3837 conversion_buffer);
3838 unprocessed = coding.carryover_bytes; 3838 unprocessed = coding.carryover_bytes;
3839 if (coding.carryover_bytes > 0) 3839 if (coding.carryover_bytes > 0)
3840 bcopy (coding.carryover, read_buf, unprocessed); 3840 memcpy (read_buf, coding.carryover, unprocessed);
3841 } 3841 }
3842 UNGCPRO; 3842 UNGCPRO;
3843 emacs_close (fd); 3843 emacs_close (fd);
@@ -5245,7 +5245,7 @@ auto_save_error (Lisp_Object error)
5245 GCPRO1 (msg); 5245 GCPRO1 (msg);
5246 nbytes = SBYTES (msg); 5246 nbytes = SBYTES (msg);
5247 SAFE_ALLOCA (msgbuf, char *, nbytes); 5247 SAFE_ALLOCA (msgbuf, char *, nbytes);
5248 bcopy (SDATA (msg), msgbuf, nbytes); 5248 memcpy (msgbuf, SDATA (msg), nbytes);
5249 5249
5250 for (i = 0; i < 3; ++i) 5250 for (i = 0; i < 3; ++i)
5251 { 5251 {
diff --git a/src/fns.c b/src/fns.c
index a6f80f33153..240c0834800 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -233,7 +233,7 @@ Symbols are also allowed; their print names are used instead. */)
233 233
234 if (SCHARS (s1) != SCHARS (s2) 234 if (SCHARS (s1) != SCHARS (s2)
235 || SBYTES (s1) != SBYTES (s2) 235 || SBYTES (s1) != SBYTES (s2)
236 || bcmp (SDATA (s1), SDATA (s2), SBYTES (s1))) 236 || memcmp (SDATA (s1), SDATA (s2), SBYTES (s1)))
237 return Qnil; 237 return Qnil;
238 return Qt; 238 return Qt;
239} 239}
@@ -469,8 +469,8 @@ with the original. */)
469 / BOOL_VECTOR_BITS_PER_CHAR); 469 / BOOL_VECTOR_BITS_PER_CHAR);
470 470
471 val = Fmake_bool_vector (Flength (arg), Qnil); 471 val = Fmake_bool_vector (Flength (arg), Qnil);
472 bcopy (XBOOL_VECTOR (arg)->data, XBOOL_VECTOR (val)->data, 472 memcpy (XBOOL_VECTOR (val)->data, XBOOL_VECTOR (arg)->data,
473 size_in_chars); 473 size_in_chars);
474 return val; 474 return val;
475 } 475 }
476 476
@@ -637,8 +637,7 @@ concat (int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_speci
637 { 637 {
638 int thislen_byte = SBYTES (this); 638 int thislen_byte = SBYTES (this);
639 639
640 bcopy (SDATA (this), SDATA (val) + toindex_byte, 640 memcpy (SDATA (val) + toindex_byte, SDATA (this), SBYTES (this));
641 SBYTES (this));
642 if (! NULL_INTERVAL_P (STRING_INTERVALS (this))) 641 if (! NULL_INTERVAL_P (STRING_INTERVALS (this)))
643 { 642 {
644 textprops[num_textprops].argnum = argnum; 643 textprops[num_textprops].argnum = argnum;
@@ -953,7 +952,7 @@ string_to_multibyte (Lisp_Object string)
953 return make_multibyte_string (SDATA (string), nbytes, nbytes); 952 return make_multibyte_string (SDATA (string), nbytes, nbytes);
954 953
955 SAFE_ALLOCA (buf, unsigned char *, nbytes); 954 SAFE_ALLOCA (buf, unsigned char *, nbytes);
956 bcopy (SDATA (string), buf, SBYTES (string)); 955 memcpy (buf, SDATA (string), SBYTES (string));
957 str_to_multibyte (buf, nbytes, SBYTES (string)); 956 str_to_multibyte (buf, nbytes, SBYTES (string));
958 957
959 ret = make_multibyte_string (buf, SCHARS (string), nbytes); 958 ret = make_multibyte_string (buf, SCHARS (string), nbytes);
@@ -1039,7 +1038,7 @@ If STRING is multibyte and contains a character of charset
1039 int bytes = SBYTES (string); 1038 int bytes = SBYTES (string);
1040 unsigned char *str = (unsigned char *) xmalloc (bytes); 1039 unsigned char *str = (unsigned char *) xmalloc (bytes);
1041 1040
1042 bcopy (SDATA (string), str, bytes); 1041 memcpy (str, SDATA (string), bytes);
1043 bytes = str_as_unibyte (str, bytes); 1042 bytes = str_as_unibyte (str, bytes);
1044 string = make_unibyte_string (str, bytes); 1043 string = make_unibyte_string (str, bytes);
1045 xfree (str); 1044 xfree (str);
@@ -1076,8 +1075,7 @@ If you're not sure, whether to use `string-as-multibyte' or
1076 SBYTES (string), 1075 SBYTES (string),
1077 &nchars, &nbytes); 1076 &nchars, &nbytes);
1078 new_string = make_uninit_multibyte_string (nchars, nbytes); 1077 new_string = make_uninit_multibyte_string (nchars, nbytes);
1079 bcopy (SDATA (string), SDATA (new_string), 1078 memcpy (SDATA (new_string), SDATA (string), SBYTES (string));
1080 SBYTES (string));
1081 if (nbytes != SBYTES (string)) 1079 if (nbytes != SBYTES (string))
1082 str_as_multibyte (SDATA (new_string), nbytes, 1080 str_as_multibyte (SDATA (new_string), nbytes,
1083 SBYTES (string), NULL); 1081 SBYTES (string), NULL);
@@ -2170,8 +2168,8 @@ internal_equal (register Lisp_Object o1, register Lisp_Object o2, int depth, int
2170 2168
2171 if (XBOOL_VECTOR (o1)->size != XBOOL_VECTOR (o2)->size) 2169 if (XBOOL_VECTOR (o1)->size != XBOOL_VECTOR (o2)->size)
2172 return 0; 2170 return 0;
2173 if (bcmp (XBOOL_VECTOR (o1)->data, XBOOL_VECTOR (o2)->data, 2171 if (memcmp (XBOOL_VECTOR (o1)->data, XBOOL_VECTOR (o2)->data,
2174 size_in_chars)) 2172 size_in_chars))
2175 return 0; 2173 return 0;
2176 return 1; 2174 return 1;
2177 } 2175 }
@@ -2205,8 +2203,7 @@ internal_equal (register Lisp_Object o1, register Lisp_Object o2, int depth, int
2205 return 0; 2203 return 0;
2206 if (SBYTES (o1) != SBYTES (o2)) 2204 if (SBYTES (o1) != SBYTES (o2))
2207 return 0; 2205 return 0;
2208 if (bcmp (SDATA (o1), SDATA (o2), 2206 if (memcmp (SDATA (o1), SDATA (o2), SBYTES (o1)))
2209 SBYTES (o1)))
2210 return 0; 2207 return 0;
2211 if (props && !compare_string_intervals (o1, o2)) 2208 if (props && !compare_string_intervals (o1, o2))
2212 return 0; 2209 return 0;
@@ -2304,7 +2301,7 @@ This makes STRING unibyte and may change its length. */)
2304 int len; 2301 int len;
2305 CHECK_STRING (string); 2302 CHECK_STRING (string);
2306 len = SBYTES (string); 2303 len = SBYTES (string);
2307 bzero (SDATA (string), len); 2304 memset (SDATA (string), 0, len);
2308 STRING_SET_CHARS (string, len); 2305 STRING_SET_CHARS (string, len);
2309 STRING_SET_UNIBYTE (string); 2306 STRING_SET_UNIBYTE (string);
2310 return Qnil; 2307 return Qnil;
@@ -3709,8 +3706,7 @@ larger_vector (Lisp_Object vec, int new_size, Lisp_Object init)
3709 xassert (new_size >= old_size); 3706 xassert (new_size >= old_size);
3710 3707
3711 v = allocate_vector (new_size); 3708 v = allocate_vector (new_size);
3712 bcopy (XVECTOR (vec)->contents, v->contents, 3709 memcpy (v->contents, XVECTOR (vec)->contents, old_size * sizeof *v->contents);
3713 old_size * sizeof *v->contents);
3714 for (i = old_size; i < new_size; ++i) 3710 for (i = old_size; i < new_size; ++i)
3715 v->contents[i] = init; 3711 v->contents[i] = init;
3716 XSETVECTOR (vec, v); 3712 XSETVECTOR (vec, v);
@@ -3947,7 +3943,7 @@ copy_hash_table (struct Lisp_Hash_Table *h1)
3947 3943
3948 h2 = allocate_hash_table (); 3944 h2 = allocate_hash_table ();
3949 next = h2->vec_next; 3945 next = h2->vec_next;
3950 bcopy (h1, h2, sizeof *h2); 3946 memcpy (h2, h1, sizeof *h2);
3951 h2->vec_next = next; 3947 h2->vec_next = next;
3952 h2->key_and_value = Fcopy_sequence (h1->key_and_value); 3948 h2->key_and_value = Fcopy_sequence (h1->key_and_value);
3953 h2->hash = Fcopy_sequence (h1->hash); 3949 h2->hash = Fcopy_sequence (h1->hash);
@@ -4553,7 +4549,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
4553 /* The vector `used' is used to keep track of arguments that 4549 /* The vector `used' is used to keep track of arguments that
4554 have been consumed. */ 4550 have been consumed. */
4555 used = (char *) alloca (nargs * sizeof *used); 4551 used = (char *) alloca (nargs * sizeof *used);
4556 bzero (used, nargs * sizeof *used); 4552 memset (used, 0, nargs * sizeof *used);
4557 4553
4558 /* See if there's a `:test TEST' among the arguments. */ 4554 /* See if there's a `:test TEST' among the arguments. */
4559 i = get_key_arg (QCtest, nargs, args, used); 4555 i = get_key_arg (QCtest, nargs, args, used);
diff --git a/src/fringe.c b/src/fringe.c
index b2cff34ba57..b5be2f72ad7 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -1493,7 +1493,7 @@ If BITMAP already exists, the existing definition is replaced. */)
1493 xfb = (struct fringe_bitmap *) xmalloc (sizeof fb 1493 xfb = (struct fringe_bitmap *) xmalloc (sizeof fb
1494 + fb.height * BYTES_PER_BITMAP_ROW); 1494 + fb.height * BYTES_PER_BITMAP_ROW);
1495 fb.bits = b = (unsigned short *) (xfb + 1); 1495 fb.bits = b = (unsigned short *) (xfb + 1);
1496 bzero (b, fb.height); 1496 memset (b, 0, fb.height);
1497 1497
1498 j = 0; 1498 j = 0;
1499 while (j < fb.height) 1499 while (j < fb.height)
diff --git a/src/ftfont.c b/src/ftfont.c
index 83d1e033abb..670e7964a53 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -1365,7 +1365,7 @@ ftfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct
1365 if (ftfont_info->ft_size != ft_face->size) 1365 if (ftfont_info->ft_size != ft_face->size)
1366 FT_Activate_Size (ftfont_info->ft_size); 1366 FT_Activate_Size (ftfont_info->ft_size);
1367 if (metrics) 1367 if (metrics)
1368 bzero (metrics, sizeof (struct font_metrics)); 1368 memset (metrics, 0, sizeof (struct font_metrics));
1369 for (i = 0, first = 1; i < nglyphs; i++) 1369 for (i = 0, first = 1; i < nglyphs; i++)
1370 { 1370 {
1371 if (FT_Load_Glyph (ft_face, code[i], FT_LOAD_DEFAULT) == 0) 1371 if (FT_Load_Glyph (ft_face, code[i], FT_LOAD_DEFAULT) == 0)
diff --git a/src/getloadavg.c b/src/getloadavg.c
index a174fc07a01..779a0ef804c 100644
--- a/src/getloadavg.c
+++ b/src/getloadavg.c
@@ -713,7 +713,7 @@ getloadavg (loadavg, nelem)
713 for (i = 0; i < conf.config_maxclass; ++i) 713 for (i = 0; i < conf.config_maxclass; ++i)
714 { 714 {
715 struct class_stats stats; 715 struct class_stats stats;
716 bzero ((char *) &stats, sizeof stats); 716 memset (&stats, 0, sizeof stats);
717 717
718 desc.sd_type = CPUTYPE_CLASS; 718 desc.sd_type = CPUTYPE_CLASS;
719 desc.sd_objid = i; 719 desc.sd_objid = i;
diff --git a/src/image.c b/src/image.c
index be40d1c7b4b..8d618b157b9 100644
--- a/src/image.c
+++ b/src/image.c
@@ -625,7 +625,7 @@ define_image_type (struct image_type *type, int loaded)
625 /* Make a copy of TYPE to avoid a bus error in a dumped Emacs. 625 /* Make a copy of TYPE to avoid a bus error in a dumped Emacs.
626 The initialized data segment is read-only. */ 626 The initialized data segment is read-only. */
627 struct image_type *p = (struct image_type *) xmalloc (sizeof *p); 627 struct image_type *p = (struct image_type *) xmalloc (sizeof *p);
628 bcopy (type, p, sizeof *p); 628 memcpy (p, type, sizeof *p);
629 p->next = image_types; 629 p->next = image_types;
630 image_types = p; 630 image_types = p;
631 success = Qt; 631 success = Qt;
@@ -1020,7 +1020,7 @@ make_image (Lisp_Object spec, unsigned int hash)
1020 Lisp_Object file = image_spec_value (spec, QCfile, NULL); 1020 Lisp_Object file = image_spec_value (spec, QCfile, NULL);
1021 1021
1022 xassert (valid_image_p (spec)); 1022 xassert (valid_image_p (spec));
1023 bzero (img, sizeof *img); 1023 memset (img, 0, sizeof *img);
1024 img->dependencies = NILP (file) ? Qnil : list1 (file); 1024 img->dependencies = NILP (file) ? Qnil : list1 (file);
1025 img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL)); 1025 img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL));
1026 xassert (img->type != NULL); 1026 xassert (img->type != NULL);
@@ -1424,12 +1424,12 @@ make_image_cache (void)
1424 struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c); 1424 struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c);
1425 int size; 1425 int size;
1426 1426
1427 bzero (c, sizeof *c); 1427 memset (c, 0, sizeof *c);
1428 c->size = 50; 1428 c->size = 50;
1429 c->images = (struct image **) xmalloc (c->size * sizeof *c->images); 1429 c->images = (struct image **) xmalloc (c->size * sizeof *c->images);
1430 size = IMAGE_CACHE_BUCKETS_SIZE * sizeof *c->buckets; 1430 size = IMAGE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
1431 c->buckets = (struct image **) xmalloc (size); 1431 c->buckets = (struct image **) xmalloc (size);
1432 bzero (c->buckets, size); 1432 memset (c->buckets, 0, size);
1433 return c; 1433 return c;
1434} 1434}
1435 1435
@@ -2048,8 +2048,8 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
2048 return 0; 2048 return 0;
2049 } 2049 }
2050 2050
2051 header = &((*ximg)->info.bmiHeader); 2051 header = &(*ximg)->info.bmiHeader;
2052 bzero (&((*ximg)->info), sizeof (BITMAPINFO)); 2052 memset (&(*ximg)->info, 0, sizeof (BITMAPINFO));
2053 header->biSize = sizeof (*header); 2053 header->biSize = sizeof (*header);
2054 header->biWidth = width; 2054 header->biWidth = width;
2055 header->biHeight = -height; /* negative indicates a top-down bitmap. */ 2055 header->biHeight = -height; /* negative indicates a top-down bitmap. */
@@ -2353,7 +2353,7 @@ xbm_image_p (Lisp_Object object)
2353{ 2353{
2354 struct image_keyword kw[XBM_LAST]; 2354 struct image_keyword kw[XBM_LAST];
2355 2355
2356 bcopy (xbm_format, kw, sizeof kw); 2356 memcpy (kw, xbm_format, sizeof kw);
2357 if (!parse_image_spec (object, kw, XBM_LAST, Qxbm)) 2357 if (!parse_image_spec (object, kw, XBM_LAST, Qxbm))
2358 return 0; 2358 return 0;
2359 2359
@@ -2543,7 +2543,7 @@ w32_create_pixmap_from_bitmap_data (int width, int height, char *data)
2543 w1 = (width + 7) / 8; /* nb of 8bits elt in X bitmap */ 2543 w1 = (width + 7) / 8; /* nb of 8bits elt in X bitmap */
2544 w2 = ((width + 15) / 16) * 2; /* nb of 16bits elt in W32 bitmap */ 2544 w2 = ((width + 15) / 16) * 2; /* nb of 16bits elt in W32 bitmap */
2545 bits = (unsigned char *) alloca (height * w2); 2545 bits = (unsigned char *) alloca (height * w2);
2546 bzero (bits, height * w2); 2546 memset (bits, 0, height * w2);
2547 for (i = 0; i < height; i++) 2547 for (i = 0; i < height; i++)
2548 { 2548 {
2549 p = bits + i*w2; 2549 p = bits + i*w2;
@@ -2918,7 +2918,7 @@ xbm_load (struct frame *f, struct image *img)
2918 in_memory_file_p = xbm_file_p (data); 2918 in_memory_file_p = xbm_file_p (data);
2919 2919
2920 /* Parse the image specification. */ 2920 /* Parse the image specification. */
2921 bcopy (xbm_format, fmt, sizeof fmt); 2921 memcpy (fmt, xbm_format, sizeof fmt);
2922 parsed_p = parse_image_spec (img->spec, fmt, XBM_LAST, Qxbm); 2922 parsed_p = parse_image_spec (img->spec, fmt, XBM_LAST, Qxbm);
2923 xassert (parsed_p); 2923 xassert (parsed_p);
2924 2924
@@ -2964,9 +2964,9 @@ xbm_load (struct frame *f, struct image *img)
2964 { 2964 {
2965 Lisp_Object line = XVECTOR (data)->contents[i]; 2965 Lisp_Object line = XVECTOR (data)->contents[i];
2966 if (STRINGP (line)) 2966 if (STRINGP (line))
2967 bcopy (SDATA (line), p, nbytes); 2967 memcpy (p, SDATA (line), nbytes);
2968 else 2968 else
2969 bcopy (XBOOL_VECTOR (line)->data, p, nbytes); 2969 memcpy (p, XBOOL_VECTOR (line)->data, nbytes);
2970 } 2970 }
2971 } 2971 }
2972 else if (STRINGP (data)) 2972 else if (STRINGP (data))
@@ -3248,7 +3248,7 @@ xpm_lookup_color (struct frame *f, char *color_name, XColor *color)
3248 with transparency, and it's useful. */ 3248 with transparency, and it's useful. */
3249 else if (strcmp ("opaque", color_name) == 0) 3249 else if (strcmp ("opaque", color_name) == 0)
3250 { 3250 {
3251 bzero (color, sizeof (XColor)); /* Is this necessary/correct? */ 3251 memset (color, 0, sizeof (XColor)); /* Is this necessary/correct? */
3252 color->pixel = FRAME_FOREGROUND_PIXEL (f); 3252 color->pixel = FRAME_FOREGROUND_PIXEL (f);
3253 p = xpm_cache_color (f, color_name, color, h); 3253 p = xpm_cache_color (f, color_name, color, h);
3254 } 3254 }
@@ -3337,7 +3337,7 @@ static int
3337xpm_image_p (Lisp_Object object) 3337xpm_image_p (Lisp_Object object)
3338{ 3338{
3339 struct image_keyword fmt[XPM_LAST]; 3339 struct image_keyword fmt[XPM_LAST];
3340 bcopy (xpm_format, fmt, sizeof fmt); 3340 memcpy (fmt, xpm_format, sizeof fmt);
3341 return (parse_image_spec (object, fmt, XPM_LAST, Qxpm) 3341 return (parse_image_spec (object, fmt, XPM_LAST, Qxpm)
3342 /* Either `:file' or `:data' must be present. */ 3342 /* Either `:file' or `:data' must be present. */
3343 && fmt[XPM_FILE].count + fmt[XPM_DATA].count == 1 3343 && fmt[XPM_FILE].count + fmt[XPM_DATA].count == 1
@@ -3358,7 +3358,7 @@ x_create_bitmap_from_xpm_data (struct frame *f, char **bits)
3358 XpmAttributes attrs; 3358 XpmAttributes attrs;
3359 Pixmap bitmap, mask; 3359 Pixmap bitmap, mask;
3360 3360
3361 bzero (&attrs, sizeof attrs); 3361 memset (&attrs, 0, sizeof attrs);
3362 3362
3363 attrs.visual = FRAME_X_VISUAL (f); 3363 attrs.visual = FRAME_X_VISUAL (f);
3364 attrs.colormap = FRAME_X_COLORMAP (f); 3364 attrs.colormap = FRAME_X_COLORMAP (f);
@@ -3406,7 +3406,7 @@ xpm_load (struct frame *f, struct image *img)
3406 3406
3407 /* Configure the XPM lib. Use the visual of frame F. Allocate 3407 /* Configure the XPM lib. Use the visual of frame F. Allocate
3408 close colors. Return colors allocated. */ 3408 close colors. Return colors allocated. */
3409 bzero (&attrs, sizeof attrs); 3409 memset (&attrs, 0, sizeof attrs);
3410 3410
3411#ifndef HAVE_NTGUI 3411#ifndef HAVE_NTGUI
3412 attrs.visual = FRAME_X_VISUAL (f); 3412 attrs.visual = FRAME_X_VISUAL (f);
@@ -3453,7 +3453,7 @@ xpm_load (struct frame *f, struct image *img)
3453 /* Allocate an XpmColorSymbol array. */ 3453 /* Allocate an XpmColorSymbol array. */
3454 size = attrs.numsymbols * sizeof *xpm_syms; 3454 size = attrs.numsymbols * sizeof *xpm_syms;
3455 xpm_syms = (XpmColorSymbol *) alloca (size); 3455 xpm_syms = (XpmColorSymbol *) alloca (size);
3456 bzero (xpm_syms, size); 3456 memset (xpm_syms, 0, size);
3457 attrs.colorsymbols = xpm_syms; 3457 attrs.colorsymbols = xpm_syms;
3458 3458
3459 /* Fill the color symbol array. */ 3459 /* Fill the color symbol array. */
@@ -4152,7 +4152,7 @@ init_color_table (void)
4152{ 4152{
4153 int size = CT_SIZE * sizeof (*ct_table); 4153 int size = CT_SIZE * sizeof (*ct_table);
4154 ct_table = (struct ct_color **) xmalloc (size); 4154 ct_table = (struct ct_color **) xmalloc (size);
4155 bzero (ct_table, size); 4155 memset (ct_table, 0, size);
4156 ct_colors_allocated = 0; 4156 ct_colors_allocated = 0;
4157} 4157}
4158 4158
@@ -4848,7 +4848,7 @@ x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how)
4848 /* Create the bit array serving as mask. */ 4848 /* Create the bit array serving as mask. */
4849 row_width = (img->width + 7) / 8; 4849 row_width = (img->width + 7) / 8;
4850 mask_img = xmalloc (row_width * img->height); 4850 mask_img = xmalloc (row_width * img->height);
4851 bzero (mask_img, row_width * img->height); 4851 memset (mask_img, 0, row_width * img->height);
4852 4852
4853 /* Create a memory device context for IMG->pixmap. */ 4853 /* Create a memory device context for IMG->pixmap. */
4854 frame_dc = get_frame_dc (f); 4854 frame_dc = get_frame_dc (f);
@@ -5000,7 +5000,7 @@ pbm_image_p (Lisp_Object object)
5000{ 5000{
5001 struct image_keyword fmt[PBM_LAST]; 5001 struct image_keyword fmt[PBM_LAST];
5002 5002
5003 bcopy (pbm_format, fmt, sizeof fmt); 5003 memcpy (fmt, pbm_format, sizeof fmt);
5004 5004
5005 if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm)) 5005 if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm))
5006 return 0; 5006 return 0;
@@ -5212,7 +5212,7 @@ pbm_load (struct frame *f, struct image *img)
5212 unsigned long bg = FRAME_BACKGROUND_PIXEL (f); 5212 unsigned long bg = FRAME_BACKGROUND_PIXEL (f);
5213 5213
5214 /* Parse the image specification. */ 5214 /* Parse the image specification. */
5215 bcopy (pbm_format, fmt, sizeof fmt); 5215 memcpy (fmt, pbm_format, sizeof fmt);
5216 parse_image_spec (img->spec, fmt, PBM_LAST, Qpbm); 5216 parse_image_spec (img->spec, fmt, PBM_LAST, Qpbm);
5217 5217
5218 /* Get foreground and background colors, maybe allocate colors. */ 5218 /* Get foreground and background colors, maybe allocate colors. */
@@ -5415,7 +5415,7 @@ static int
5415png_image_p (Lisp_Object object) 5415png_image_p (Lisp_Object object)
5416{ 5416{
5417 struct image_keyword fmt[PNG_LAST]; 5417 struct image_keyword fmt[PNG_LAST];
5418 bcopy (png_format, fmt, sizeof fmt); 5418 memcpy (fmt, png_format, sizeof fmt);
5419 5419
5420 if (!parse_image_spec (object, fmt, PNG_LAST, Qpng)) 5420 if (!parse_image_spec (object, fmt, PNG_LAST, Qpng))
5421 return 0; 5421 return 0;
@@ -5554,7 +5554,7 @@ png_read_from_memory (png_structp png_ptr, png_bytep data, png_size_t length)
5554 if (length > tbr->len - tbr->index) 5554 if (length > tbr->len - tbr->index)
5555 fn_png_error (png_ptr, "Read error"); 5555 fn_png_error (png_ptr, "Read error");
5556 5556
5557 bcopy (tbr->bytes + tbr->index, data, length); 5557 memcpy (data, tbr->bytes + tbr->index, length);
5558 tbr->index = tbr->index + length; 5558 tbr->index = tbr->index + length;
5559} 5559}
5560 5560
@@ -5756,7 +5756,7 @@ png_load (struct frame *f, struct image *img)
5756 { 5756 {
5757 png_color_16 user_bg; 5757 png_color_16 user_bg;
5758 5758
5759 bzero (&user_bg, sizeof user_bg); 5759 memset (&user_bg, 0, sizeof user_bg);
5760 user_bg.red = color.red >> shift; 5760 user_bg.red = color.red >> shift;
5761 user_bg.green = color.green >> shift; 5761 user_bg.green = color.green >> shift;
5762 user_bg.blue = color.blue >> shift; 5762 user_bg.blue = color.blue >> shift;
@@ -5776,7 +5776,7 @@ png_load (struct frame *f, struct image *img)
5776 color.pixel = FRAME_BACKGROUND_PIXEL (f); 5776 color.pixel = FRAME_BACKGROUND_PIXEL (f);
5777 x_query_color (f, &color); 5777 x_query_color (f, &color);
5778 5778
5779 bzero (&frame_background, sizeof frame_background); 5779 memset (&frame_background, 0, sizeof frame_background);
5780 frame_background.red = color.red >> shift; 5780 frame_background.red = color.red >> shift;
5781 frame_background.green = color.green >> shift; 5781 frame_background.green = color.green >> shift;
5782 frame_background.blue = color.blue >> shift; 5782 frame_background.blue = color.blue >> shift;
@@ -6005,7 +6005,7 @@ jpeg_image_p (Lisp_Object object)
6005{ 6005{
6006 struct image_keyword fmt[JPEG_LAST]; 6006 struct image_keyword fmt[JPEG_LAST];
6007 6007
6008 bcopy (jpeg_format, fmt, sizeof fmt); 6008 memcpy (fmt, jpeg_format, sizeof fmt);
6009 6009
6010 if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg)) 6010 if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg))
6011 return 0; 6011 return 0;
@@ -6561,7 +6561,7 @@ static int
6561tiff_image_p (Lisp_Object object) 6561tiff_image_p (Lisp_Object object)
6562{ 6562{
6563 struct image_keyword fmt[TIFF_LAST]; 6563 struct image_keyword fmt[TIFF_LAST];
6564 bcopy (tiff_format, fmt, sizeof fmt); 6564 memcpy (fmt, tiff_format, sizeof fmt);
6565 6565
6566 if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff)) 6566 if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff))
6567 return 0; 6567 return 0;
@@ -6644,7 +6644,7 @@ tiff_read_from_memory (thandle_t data, tdata_t buf, tsize_t size)
6644 6644
6645 if (size > src->len - src->index) 6645 if (size > src->len - src->index)
6646 return (size_t) -1; 6646 return (size_t) -1;
6647 bcopy (src->bytes + src->index, buf, size); 6647 memcpy (buf, src->bytes + src->index, size);
6648 src->index += size; 6648 src->index += size;
6649 return size; 6649 return size;
6650} 6650}
@@ -6999,7 +6999,7 @@ static int
6999gif_image_p (Lisp_Object object) 6999gif_image_p (Lisp_Object object)
7000{ 7000{
7001 struct image_keyword fmt[GIF_LAST]; 7001 struct image_keyword fmt[GIF_LAST];
7002 bcopy (gif_format, fmt, sizeof fmt); 7002 memcpy (fmt, gif_format, sizeof fmt);
7003 7003
7004 if (!parse_image_spec (object, fmt, GIF_LAST, Qgif)) 7004 if (!parse_image_spec (object, fmt, GIF_LAST, Qgif))
7005 return 0; 7005 return 0;
@@ -7086,7 +7086,7 @@ gif_read_from_memory (GifFileType *file, GifByteType *buf, int len)
7086 if (len > src->len - src->index) 7086 if (len > src->len - src->index)
7087 return -1; 7087 return -1;
7088 7088
7089 bcopy (src->bytes + src->index, buf, len); 7089 memcpy (buf, src->bytes + src->index, len);
7090 src->index += len; 7090 src->index += len;
7091 return len; 7091 return len;
7092} 7092}
@@ -7222,7 +7222,7 @@ gif_load (struct frame *f, struct image *img)
7222 if (!gif_color_map) 7222 if (!gif_color_map)
7223 gif_color_map = gif->SColorMap; 7223 gif_color_map = gif->SColorMap;
7224 init_color_table (); 7224 init_color_table ();
7225 bzero (pixel_colors, sizeof pixel_colors); 7225 memset (pixel_colors, 0, sizeof pixel_colors);
7226 7226
7227 if (gif_color_map) 7227 if (gif_color_map)
7228 for (i = 0; i < gif_color_map->ColorCount; ++i) 7228 for (i = 0; i < gif_color_map->ColorCount; ++i)
@@ -7432,7 +7432,7 @@ static int
7432svg_image_p (Lisp_Object object) 7432svg_image_p (Lisp_Object object)
7433{ 7433{
7434 struct image_keyword fmt[SVG_LAST]; 7434 struct image_keyword fmt[SVG_LAST];
7435 bcopy (svg_format, fmt, sizeof fmt); 7435 memcpy (fmt, svg_format, sizeof fmt);
7436 7436
7437 if (!parse_image_spec (object, fmt, SVG_LAST, Qsvg)) 7437 if (!parse_image_spec (object, fmt, SVG_LAST, Qsvg))
7438 return 0; 7438 return 0;
@@ -7839,7 +7839,7 @@ gs_image_p (Lisp_Object object)
7839 Lisp_Object tem; 7839 Lisp_Object tem;
7840 int i; 7840 int i;
7841 7841
7842 bcopy (gs_format, fmt, sizeof fmt); 7842 memcpy (fmt, gs_format, sizeof fmt);
7843 7843
7844 if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript)) 7844 if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript))
7845 return 0; 7845 return 0;
diff --git a/src/indent.c b/src/indent.c
index 66f1f4cac49..2d17ccf5c32 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -546,7 +546,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
546 w = ! NILP (window) ? XWINDOW (window) : NULL; 546 w = ! NILP (window) ? XWINDOW (window) : NULL;
547 547
548 if (tab_width <= 0 || tab_width > 1000) tab_width = 8; 548 if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
549 bzero (&cmp_it, sizeof cmp_it); 549 memset (&cmp_it, 0, sizeof cmp_it);
550 cmp_it.id = -1; 550 cmp_it.id = -1;
551 composition_compute_stop_pos (&cmp_it, scan, scan_byte, end, Qnil); 551 composition_compute_stop_pos (&cmp_it, scan, scan_byte, end, Qnil);
552 552
@@ -1214,7 +1214,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
1214 pos_byte = prev_pos_byte = CHAR_TO_BYTE (from); 1214 pos_byte = prev_pos_byte = CHAR_TO_BYTE (from);
1215 contin_hpos = 0; 1215 contin_hpos = 0;
1216 prev_tab_offset = tab_offset; 1216 prev_tab_offset = tab_offset;
1217 bzero (&cmp_it, sizeof cmp_it); 1217 memset (&cmp_it, 0, sizeof cmp_it);
1218 cmp_it.id = -1; 1218 cmp_it.id = -1;
1219 composition_compute_stop_pos (&cmp_it, pos, pos_byte, to, Qnil); 1219 composition_compute_stop_pos (&cmp_it, pos, pos_byte, to, Qnil);
1220 1220
diff --git a/src/insdel.c b/src/insdel.c
index 2024cfc362f..1085d645f5c 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -164,28 +164,9 @@ gap_left (EMACS_INT charpos, EMACS_INT bytepos, int newgap)
164 /* Move at most 32000 chars before checking again for a quit. */ 164 /* Move at most 32000 chars before checking again for a quit. */
165 if (i > 32000) 165 if (i > 32000)
166 i = 32000; 166 i = 32000;
167#ifdef GAP_USE_BCOPY 167 new_s1 -= i;
168 if (i >= 128 168 from -= i, to -= i;
169 /* bcopy is safe if the two areas of memory do not overlap 169 memmove (to, from, i);
170 or on systems where bcopy is always safe for moving upward. */
171 && (BCOPY_UPWARD_SAFE
172 || to - from >= 128))
173 {
174 /* If overlap is not safe, avoid it by not moving too many
175 characters at once. */
176 if (!BCOPY_UPWARD_SAFE && i > to - from)
177 i = to - from;
178 new_s1 -= i;
179 from -= i, to -= i;
180 bcopy (from, to, i);
181 }
182 else
183#endif
184 {
185 new_s1 -= i;
186 while (--i >= 0)
187 *--to = *--from;
188 }
189 } 170 }
190 171
191 /* Adjust markers, and buffer data structure, to put the gap at BYTEPOS. 172 /* Adjust markers, and buffer data structure, to put the gap at BYTEPOS.
@@ -238,28 +219,9 @@ gap_right (EMACS_INT charpos, EMACS_INT bytepos)
238 /* Move at most 32000 chars before checking again for a quit. */ 219 /* Move at most 32000 chars before checking again for a quit. */
239 if (i > 32000) 220 if (i > 32000)
240 i = 32000; 221 i = 32000;
241#ifdef GAP_USE_BCOPY 222 new_s1 += i;
242 if (i >= 128 223 memmove (to, from, i);
243 /* bcopy is safe if the two areas of memory do not overlap 224 from += i, to += i;
244 or on systems where bcopy is always safe for moving downward. */
245 && (BCOPY_DOWNWARD_SAFE
246 || from - to >= 128))
247 {
248 /* If overlap is not safe, avoid it by not moving too many
249 characters at once. */
250 if (!BCOPY_DOWNWARD_SAFE && i > from - to)
251 i = from - to;
252 new_s1 += i;
253 bcopy (from, to, i);
254 from += i, to += i;
255 }
256 else
257#endif
258 {
259 new_s1 += i;
260 while (--i >= 0)
261 *to++ = *from++;
262 }
263 } 225 }
264 226
265 adjust_markers_gap_motion (GPT_BYTE + GAP_SIZE, bytepos + GAP_SIZE, 227 adjust_markers_gap_motion (GPT_BYTE + GAP_SIZE, bytepos + GAP_SIZE,
@@ -585,7 +547,7 @@ make_gap_smaller (EMACS_INT nbytes_removed)
585 /* Pretend that the last unwanted part of the gap is the entire gap, 547 /* Pretend that the last unwanted part of the gap is the entire gap,
586 and that the first desired part of the gap is part of the buffer 548 and that the first desired part of the gap is part of the buffer
587 text. */ 549 text. */
588 bzero (GPT_ADDR, new_gap_size); 550 memset (GPT_ADDR, 0, new_gap_size);
589 GPT += new_gap_size; 551 GPT += new_gap_size;
590 GPT_BYTE += new_gap_size; 552 GPT_BYTE += new_gap_size;
591 Z += new_gap_size; 553 Z += new_gap_size;
@@ -636,7 +598,7 @@ copy_text (const unsigned char *from_addr, unsigned char *to_addr,
636{ 598{
637 if (from_multibyte == to_multibyte) 599 if (from_multibyte == to_multibyte)
638 { 600 {
639 bcopy (from_addr, to_addr, nbytes); 601 memcpy (to_addr, from_addr, nbytes);
640 return nbytes; 602 return nbytes;
641 } 603 }
642 else if (from_multibyte) 604 else if (from_multibyte)
@@ -966,7 +928,7 @@ insert_1_both (const unsigned char *string,
966 MODIFF++; 928 MODIFF++;
967 CHARS_MODIFF = MODIFF; 929 CHARS_MODIFF = MODIFF;
968 930
969 bcopy (string, GPT_ADDR, nbytes); 931 memcpy (GPT_ADDR, string, nbytes);
970 932
971 GAP_SIZE -= nbytes; 933 GAP_SIZE -= nbytes;
972 GPT += nchars; 934 GPT += nchars;
@@ -1007,7 +969,7 @@ insert_1_both (const unsigned char *string,
1007 copy them into the buffer. 969 copy them into the buffer.
1008 970
1009 It does not work to use `insert' for this, because a GC could happen 971 It does not work to use `insert' for this, because a GC could happen
1010 before we bcopy the stuff into the buffer, and relocate the string 972 before we copy the stuff into the buffer, and relocate the string
1011 without insert noticing. */ 973 without insert noticing. */
1012 974
1013void 975void
@@ -1182,7 +1144,7 @@ insert_from_gap (EMACS_INT nchars, EMACS_INT nbytes)
1182 into the current buffer. 1144 into the current buffer.
1183 1145
1184 It does not work to use `insert' for this, because a malloc could happen 1146 It does not work to use `insert' for this, because a malloc could happen
1185 and relocate BUF's text before the bcopy happens. */ 1147 and relocate BUF's text before the copy happens. */
1186 1148
1187void 1149void
1188insert_from_buffer (struct buffer *buf, 1150insert_from_buffer (struct buffer *buf,
@@ -1712,7 +1674,7 @@ replace_range_2 (EMACS_INT from, EMACS_INT from_byte,
1712 make_gap (insbytes - GAP_SIZE); 1674 make_gap (insbytes - GAP_SIZE);
1713 1675
1714 /* Copy the replacement text into the buffer. */ 1676 /* Copy the replacement text into the buffer. */
1715 bcopy (ins, GPT_ADDR, insbytes); 1677 memcpy (GPT_ADDR, ins, insbytes);
1716 1678
1717#ifdef BYTE_COMBINING_DEBUG 1679#ifdef BYTE_COMBINING_DEBUG
1718 /* We have copied text into the gap, but we have not marked 1680 /* We have copied text into the gap, but we have not marked
diff --git a/src/intervals.c b/src/intervals.c
index 3a7a0bf8c96..86cbe1effcc 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -1558,7 +1558,7 @@ reproduce_tree (INTERVAL source, INTERVAL parent)
1558{ 1558{
1559 register INTERVAL t = make_interval (); 1559 register INTERVAL t = make_interval ();
1560 1560
1561 bcopy (source, t, INTERVAL_SIZE); 1561 memcpy (t, source, INTERVAL_SIZE);
1562 copy_properties (source, t); 1562 copy_properties (source, t);
1563 SET_INTERVAL_PARENT (t, parent); 1563 SET_INTERVAL_PARENT (t, parent);
1564 if (! NULL_LEFT_CHILD (source)) 1564 if (! NULL_LEFT_CHILD (source))
@@ -1574,7 +1574,7 @@ reproduce_tree_obj (INTERVAL source, Lisp_Object parent)
1574{ 1574{
1575 register INTERVAL t = make_interval (); 1575 register INTERVAL t = make_interval ();
1576 1576
1577 bcopy (source, t, INTERVAL_SIZE); 1577 memcpy (t, source, INTERVAL_SIZE);
1578 copy_properties (source, t); 1578 copy_properties (source, t);
1579 SET_INTERVAL_OBJECT (t, parent); 1579 SET_INTERVAL_OBJECT (t, parent);
1580 if (! NULL_LEFT_CHILD (source)) 1580 if (! NULL_LEFT_CHILD (source))
diff --git a/src/keyboard.c b/src/keyboard.c
index c7d3ee413cd..be2dad36bab 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -716,7 +716,7 @@ echo_char (Lisp_Object c)
716 ptr = buffer + offset; 716 ptr = buffer + offset;
717 } 717 }
718 718
719 bcopy (text, ptr, len); 719 memcpy (ptr, text, len);
720 ptr += len; 720 ptr += len;
721 } 721 }
722 722
@@ -3481,13 +3481,13 @@ print_help (Lisp_Object object)
3481static void 3481static void
3482save_getcjmp (jmp_buf temp) 3482save_getcjmp (jmp_buf temp)
3483{ 3483{
3484 bcopy (getcjmp, temp, sizeof getcjmp); 3484 memcpy (temp, getcjmp, sizeof getcjmp);
3485} 3485}
3486 3486
3487static void 3487static void
3488restore_getcjmp (jmp_buf temp) 3488restore_getcjmp (jmp_buf temp)
3489{ 3489{
3490 bcopy (temp, getcjmp, sizeof getcjmp); 3490 memcpy (getcjmp, temp, sizeof getcjmp);
3491} 3491}
3492 3492
3493/* Low level keyboard/mouse input. 3493/* Low level keyboard/mouse input.
@@ -3675,7 +3675,7 @@ kbd_buffer_store_event_hold (register struct input_event *event,
3675 3675
3676 if (hold_quit) 3676 if (hold_quit)
3677 { 3677 {
3678 bcopy (event, (char *) hold_quit, sizeof (*event)); 3678 memcpy (hold_quit, event, sizeof (*event));
3679 return; 3679 return;
3680 } 3680 }
3681 3681
@@ -6336,8 +6336,8 @@ apply_modifiers_uncached (int modifiers, char *base, int base_len, int base_len_
6336 6336
6337 new_name = make_uninit_multibyte_string (mod_len + base_len, 6337 new_name = make_uninit_multibyte_string (mod_len + base_len,
6338 mod_len + base_len_byte); 6338 mod_len + base_len_byte);
6339 bcopy (new_mods, SDATA (new_name), mod_len); 6339 memcpy (SDATA (new_name), new_mods, mod_len);
6340 bcopy (base, SDATA (new_name) + mod_len, base_len_byte); 6340 memcpy (SDATA (new_name) + mod_len, base, base_len_byte);
6341 6341
6342 return Fintern (new_name, Qnil); 6342 return Fintern (new_name, Qnil);
6343 } 6343 }
@@ -7448,7 +7448,7 @@ store_user_signal_events (void)
7448 7448
7449 if (nstored == 0) 7449 if (nstored == 0)
7450 { 7450 {
7451 bzero (&buf, sizeof buf); 7451 memset (&buf, 0, sizeof buf);
7452 buf.kind = USER_SIGNAL_EVENT; 7452 buf.kind = USER_SIGNAL_EVENT;
7453 buf.frame_or_window = selected_frame; 7453 buf.frame_or_window = selected_frame;
7454 } 7454 }
@@ -7552,7 +7552,7 @@ menu_bar_items (Lisp_Object old)
7552 nmaps = 0; 7552 nmaps = 0;
7553 if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) 7553 if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
7554 maps[nmaps++] = tem; 7554 maps[nmaps++] = tem;
7555 bcopy (tmaps, (void *) (maps + nmaps), nminor * sizeof (maps[0])); 7555 memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0]));
7556 nmaps += nminor; 7556 nmaps += nminor;
7557 maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map); 7557 maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map);
7558 } 7558 }
@@ -7593,9 +7593,9 @@ menu_bar_items (Lisp_Object old)
7593 tem2 = XVECTOR (menu_bar_items_vector)->contents[i + 2]; 7593 tem2 = XVECTOR (menu_bar_items_vector)->contents[i + 2];
7594 tem3 = XVECTOR (menu_bar_items_vector)->contents[i + 3]; 7594 tem3 = XVECTOR (menu_bar_items_vector)->contents[i + 3];
7595 if (end > i + 4) 7595 if (end > i + 4)
7596 bcopy (&XVECTOR (menu_bar_items_vector)->contents[i + 4], 7596 memmove (&XVECTOR (menu_bar_items_vector)->contents[i],
7597 &XVECTOR (menu_bar_items_vector)->contents[i], 7597 &XVECTOR (menu_bar_items_vector)->contents[i + 4],
7598 (end - i - 4) * sizeof (Lisp_Object)); 7598 (end - i - 4) * sizeof (Lisp_Object));
7599 XVECTOR (menu_bar_items_vector)->contents[end - 4] = tem0; 7599 XVECTOR (menu_bar_items_vector)->contents[end - 4] = tem0;
7600 XVECTOR (menu_bar_items_vector)->contents[end - 3] = tem1; 7600 XVECTOR (menu_bar_items_vector)->contents[end - 3] = tem1;
7601 XVECTOR (menu_bar_items_vector)->contents[end - 2] = tem2; 7601 XVECTOR (menu_bar_items_vector)->contents[end - 2] = tem2;
@@ -7640,9 +7640,9 @@ menu_bar_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy1, void *dumm
7640 if (EQ (key, XVECTOR (menu_bar_items_vector)->contents[i])) 7640 if (EQ (key, XVECTOR (menu_bar_items_vector)->contents[i]))
7641 { 7641 {
7642 if (menu_bar_items_index > i + 4) 7642 if (menu_bar_items_index > i + 4)
7643 bcopy (&XVECTOR (menu_bar_items_vector)->contents[i + 4], 7643 memmove (&XVECTOR (menu_bar_items_vector)->contents[i],
7644 &XVECTOR (menu_bar_items_vector)->contents[i], 7644 &XVECTOR (menu_bar_items_vector)->contents[i + 4],
7645 (menu_bar_items_index - i - 4) * sizeof (Lisp_Object)); 7645 (menu_bar_items_index - i - 4) * sizeof (Lisp_Object));
7646 menu_bar_items_index -= 4; 7646 menu_bar_items_index -= 4;
7647 } 7647 }
7648 } 7648 }
@@ -8090,7 +8090,7 @@ tool_bar_items (Lisp_Object reuse, int *nitems)
8090 nmaps = 0; 8090 nmaps = 0;
8091 if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) 8091 if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
8092 maps[nmaps++] = tem; 8092 maps[nmaps++] = tem;
8093 bcopy (tmaps, (void *) (maps + nmaps), nminor * sizeof (maps[0])); 8093 memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0]));
8094 nmaps += nminor; 8094 nmaps += nminor;
8095 maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map); 8095 maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map);
8096 } 8096 }
@@ -8140,9 +8140,9 @@ process_tool_bar_item (Lisp_Object key, Lisp_Object def, Lisp_Object data, void
8140 if (EQ (key, v[TOOL_BAR_ITEM_KEY])) 8140 if (EQ (key, v[TOOL_BAR_ITEM_KEY]))
8141 { 8141 {
8142 if (ntool_bar_items > i + TOOL_BAR_ITEM_NSLOTS) 8142 if (ntool_bar_items > i + TOOL_BAR_ITEM_NSLOTS)
8143 bcopy (v + TOOL_BAR_ITEM_NSLOTS, v, 8143 memmove (v, v + TOOL_BAR_ITEM_NSLOTS,
8144 ((ntool_bar_items - i - TOOL_BAR_ITEM_NSLOTS) 8144 ((ntool_bar_items - i - TOOL_BAR_ITEM_NSLOTS)
8145 * sizeof (Lisp_Object))); 8145 * sizeof (Lisp_Object)));
8146 ntool_bar_items -= TOOL_BAR_ITEM_NSLOTS; 8146 ntool_bar_items -= TOOL_BAR_ITEM_NSLOTS;
8147 break; 8147 break;
8148 } 8148 }
@@ -8425,7 +8425,7 @@ append_tool_bar_item (void)
8425 tool_bar_items_vector. */ 8425 tool_bar_items_vector. */
8426 to = XVECTOR (tool_bar_items_vector)->contents + ntool_bar_items; 8426 to = XVECTOR (tool_bar_items_vector)->contents + ntool_bar_items;
8427 from = XVECTOR (tool_bar_item_properties)->contents; 8427 from = XVECTOR (tool_bar_item_properties)->contents;
8428 bcopy (from, to, TOOL_BAR_ITEM_NSLOTS * sizeof *to); 8428 memcpy (to, from, TOOL_BAR_ITEM_NSLOTS * sizeof *to);
8429 ntool_bar_items += TOOL_BAR_ITEM_NSLOTS; 8429 ntool_bar_items += TOOL_BAR_ITEM_NSLOTS;
8430} 8430}
8431 8431
@@ -8718,7 +8718,7 @@ read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps)
8718 thiswidth = SCHARS (desc); 8718 thiswidth = SCHARS (desc);
8719 if (thiswidth + i > width) 8719 if (thiswidth + i > width)
8720 thiswidth = width - i; 8720 thiswidth = width - i;
8721 bcopy (SDATA (desc), menu + i, thiswidth); 8721 memcpy (menu + i, SDATA (desc), thiswidth);
8722 i += thiswidth; 8722 i += thiswidth;
8723 strcpy (menu + i, " = "); 8723 strcpy (menu + i, " = ");
8724 i += 3; 8724 i += 3;
@@ -8728,7 +8728,7 @@ read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps)
8728 thiswidth = SCHARS (s); 8728 thiswidth = SCHARS (s);
8729 if (thiswidth + i > width) 8729 if (thiswidth + i > width)
8730 thiswidth = width - i; 8730 thiswidth = width - i;
8731 bcopy (SDATA (s), menu + i, thiswidth); 8731 memcpy (menu + i, SDATA (s), thiswidth);
8732 i += thiswidth; 8732 i += thiswidth;
8733 menu[i] = 0; 8733 menu[i] = 0;
8734 } 8734 }
@@ -9212,8 +9212,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9212 if (!NILP (orig_keymap)) 9212 if (!NILP (orig_keymap))
9213 submaps[nmaps++] = orig_keymap; 9213 submaps[nmaps++] = orig_keymap;
9214 9214
9215 bcopy (maps, (void *) (submaps + nmaps), 9215 memcpy (submaps + nmaps, maps, nminor * sizeof (submaps[0]));
9216 nminor * sizeof (submaps[0]));
9217 9216
9218 nmaps += nminor; 9217 nmaps += nminor;
9219 9218
@@ -10147,7 +10146,7 @@ will read just one key sequence. */)
10147 specbind (Qinput_method_use_echo_area, 10146 specbind (Qinput_method_use_echo_area,
10148 (NILP (command_loop) ? Qt : Qnil)); 10147 (NILP (command_loop) ? Qt : Qnil));
10149 10148
10150 bzero (keybuf, sizeof keybuf); 10149 memset (keybuf, 0, sizeof keybuf);
10151 GCPRO1 (keybuf[0]); 10150 GCPRO1 (keybuf[0]);
10152 gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0])); 10151 gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0]));
10153 10152
@@ -10207,7 +10206,7 @@ DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector,
10207 specbind (Qinput_method_use_echo_area, 10206 specbind (Qinput_method_use_echo_area,
10208 (NILP (command_loop) ? Qt : Qnil)); 10207 (NILP (command_loop) ? Qt : Qnil));
10209 10208
10210 bzero (keybuf, sizeof keybuf); 10209 memset (keybuf, 0, sizeof keybuf);
10211 GCPRO1 (keybuf[0]); 10210 GCPRO1 (keybuf[0]);
10212 gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0])); 10211 gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0]));
10213 10212
@@ -10597,12 +10596,10 @@ DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0,
10597 else 10596 else
10598 { 10597 {
10599 val = Fvector (NUM_RECENT_KEYS, keys); 10598 val = Fvector (NUM_RECENT_KEYS, keys);
10600 bcopy (keys + recent_keys_index, 10599 memcpy (XVECTOR (val)->contents, keys + recent_keys_index,
10601 XVECTOR (val)->contents, 10600 (NUM_RECENT_KEYS - recent_keys_index) * sizeof (Lisp_Object));
10602 (NUM_RECENT_KEYS - recent_keys_index) * sizeof (Lisp_Object)); 10601 memcpy (XVECTOR (val)->contents + NUM_RECENT_KEYS - recent_keys_index,
10603 bcopy (keys, 10602 keys, recent_keys_index * sizeof (Lisp_Object));
10604 XVECTOR (val)->contents + NUM_RECENT_KEYS - recent_keys_index,
10605 recent_keys_index * sizeof (Lisp_Object));
10606 return val; 10603 return val;
10607 } 10604 }
10608} 10605}
diff --git a/src/keymap.c b/src/keymap.c
index c896e6ceb96..7e8b05f9c60 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1534,7 +1534,8 @@ current_minor_maps (Lisp_Object **modeptr, Lisp_Object **mapptr)
1534 { 1534 {
1535 if (cmm_modes) 1535 if (cmm_modes)
1536 { 1536 {
1537 bcopy (cmm_modes, newmodes, cmm_size * sizeof cmm_modes[0]); 1537 memcpy (newmodes, cmm_modes,
1538 cmm_size * sizeof cmm_modes[0]);
1538 free (cmm_modes); 1539 free (cmm_modes);
1539 } 1540 }
1540 cmm_modes = newmodes; 1541 cmm_modes = newmodes;
@@ -1545,7 +1546,8 @@ current_minor_maps (Lisp_Object **modeptr, Lisp_Object **mapptr)
1545 { 1546 {
1546 if (cmm_maps) 1547 if (cmm_maps)
1547 { 1548 {
1548 bcopy (cmm_maps, newmaps, cmm_size * sizeof cmm_maps[0]); 1549 memcpy (newmaps, cmm_maps,
1550 cmm_size * sizeof cmm_maps[0]);
1549 free (cmm_maps); 1551 free (cmm_maps);
1550 } 1552 }
1551 cmm_maps = newmaps; 1553 cmm_maps = newmaps;
@@ -3100,12 +3102,12 @@ You type Translation\n\
3100 *p++ = '\f'; 3102 *p++ = '\f';
3101 *p++ = '\n'; 3103 *p++ = '\n';
3102 *p++ = '`'; 3104 *p++ = '`';
3103 bcopy (SDATA (SYMBOL_NAME (modes[i])), p, 3105 memcpy (p, SDATA (SYMBOL_NAME (modes[i])),
3104 SCHARS (SYMBOL_NAME (modes[i]))); 3106 SCHARS (SYMBOL_NAME (modes[i])));
3105 p += SCHARS (SYMBOL_NAME (modes[i])); 3107 p += SCHARS (SYMBOL_NAME (modes[i]));
3106 *p++ = '\''; 3108 *p++ = '\'';
3107 bcopy (" Minor Mode Bindings", p, sizeof (" Minor Mode Bindings") - 1); 3109 memcpy (p, " Minor Mode Bindings", strlen (" Minor Mode Bindings"));
3108 p += sizeof (" Minor Mode Bindings") - 1; 3110 p += strlen (" Minor Mode Bindings");
3109 *p = 0; 3111 *p = 0;
3110 3112
3111 describe_map_tree (maps[i], 1, shadow, prefix, 3113 describe_map_tree (maps[i], 1, shadow, prefix,
diff --git a/src/lisp.h b/src/lisp.h
index 3a3cde27897..02c9ed03e13 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -647,7 +647,7 @@ extern size_t pure_size;
647 (XSTRING (string)->size = (newsize)) 647 (XSTRING (string)->size = (newsize))
648 648
649#define STRING_COPYIN(string, index, new, count) \ 649#define STRING_COPYIN(string, index, new, count) \
650 bcopy (new, SDATA (string) + index, count) 650 memcpy (SDATA (string) + index, new, count)
651 651
652/* Type checking. */ 652/* Type checking. */
653 653
@@ -2628,7 +2628,6 @@ EXFUN (Fredisplay, 1);
2628extern Lisp_Object sit_for (Lisp_Object, int, int); 2628extern Lisp_Object sit_for (Lisp_Object, int, int);
2629extern void init_display (void); 2629extern void init_display (void);
2630extern void syms_of_display (void); 2630extern void syms_of_display (void);
2631extern void safe_bcopy (const char *, char *, int);
2632 2631
2633/* Defined in xdisp.c */ 2632/* Defined in xdisp.c */
2634extern Lisp_Object Qinhibit_point_motion_hooks; 2633extern Lisp_Object Qinhibit_point_motion_hooks;
@@ -3400,6 +3399,18 @@ extern int emacs_open (const char *, int, int);
3400extern int emacs_close (int); 3399extern int emacs_close (int);
3401extern int emacs_read (int, char *, unsigned int); 3400extern int emacs_read (int, char *, unsigned int);
3402extern int emacs_write (int, const char *, unsigned int); 3401extern int emacs_write (int, const char *, unsigned int);
3402#ifndef HAVE_MEMSET
3403extern void *memset P_ ((void *, int, size_t));
3404#endif
3405#ifndef HAVE_MEMCPY
3406extern void *memcpy P_ ((void *, void *, size_t));
3407#endif
3408#ifndef HAVE_MEMMOVE
3409extern void *memmove P_ ((void *, void *, size_t));
3410#endif
3411#ifndef HAVE_MEMCMP
3412extern int memcmp P_ ((void *, void *, size_t));
3413#endif
3403 3414
3404/* Defined in filelock.c */ 3415/* Defined in filelock.c */
3405EXFUN (Funlock_buffer, 0); 3416EXFUN (Funlock_buffer, 0);
diff --git a/src/lread.c b/src/lread.c
index b35d2be78eb..8df689c4afa 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1125,8 +1125,7 @@ Return t if the file exists and loads successfully. */)
1125 specbind (Qold_style_backquotes, Qnil); 1125 specbind (Qold_style_backquotes, Qnil);
1126 record_unwind_protect (load_warn_old_style_backquotes, file); 1126 record_unwind_protect (load_warn_old_style_backquotes, file);
1127 1127
1128 if (!bcmp (SDATA (found) + SBYTES (found) - 4, 1128 if (!memcmp (SDATA (found) + SBYTES (found) - 4, ".elc", 4)
1129 ".elc", 4)
1130 || (fd >= 0 && (version = safe_to_load_p (fd)) > 0)) 1129 || (fd >= 0 && (version = safe_to_load_p (fd)) > 0))
1131 /* Load .elc files directly, but not when they are 1130 /* Load .elc files directly, but not when they are
1132 remote and have no handler! */ 1131 remote and have no handler! */
@@ -2430,8 +2429,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2430 invalid_syntax ("#&...", 5); 2429 invalid_syntax ("#&...", 5);
2431 2430
2432 val = Fmake_bool_vector (length, Qnil); 2431 val = Fmake_bool_vector (length, Qnil);
2433 bcopy (SDATA (tmp), XBOOL_VECTOR (val)->data, 2432 memcpy (XBOOL_VECTOR (val)->data, SDATA (tmp), size_in_chars);
2434 size_in_chars);
2435 /* Clear the extraneous bits in the last byte. */ 2433 /* Clear the extraneous bits in the last byte. */
2436 if (XINT (length) != size_in_chars * BOOL_VECTOR_BITS_PER_CHAR) 2434 if (XINT (length) != size_in_chars * BOOL_VECTOR_BITS_PER_CHAR)
2437 XBOOL_VECTOR (val)->data[size_in_chars - 1] 2435 XBOOL_VECTOR (val)->data[size_in_chars - 1]
@@ -3786,7 +3784,7 @@ oblookup (Lisp_Object obarray, register const char *ptr, int size, int size_byte
3786 { 3784 {
3787 if (SBYTES (SYMBOL_NAME (tail)) == size_byte 3785 if (SBYTES (SYMBOL_NAME (tail)) == size_byte
3788 && SCHARS (SYMBOL_NAME (tail)) == size 3786 && SCHARS (SYMBOL_NAME (tail)) == size
3789 && !bcmp (SDATA (SYMBOL_NAME (tail)), ptr, size_byte)) 3787 && !memcmp (SDATA (SYMBOL_NAME (tail)), ptr, size_byte))
3790 return tail; 3788 return tail;
3791 else if (XSYMBOL (tail)->next == 0) 3789 else if (XSYMBOL (tail)->next == 0)
3792 break; 3790 break;
diff --git a/src/msdos.c b/src/msdos.c
index 7e489bb6c47..897963bb24a 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -35,7 +35,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
35#include <sys/time.h> 35#include <sys/time.h>
36#include <dos.h> 36#include <dos.h>
37#include <errno.h> 37#include <errno.h>
38#include <string.h> /* for bzero and string functions */ 38#include <string.h> /* for memset and string functions */
39#include <sys/stat.h> /* for _fixpath */ 39#include <sys/stat.h> /* for _fixpath */
40#include <unistd.h> /* for chdir, dup, dup2, etc. */ 40#include <unistd.h> /* for chdir, dup, dup2, etc. */
41#include <dir.h> /* for getdisk */ 41#include <dir.h> /* for getdisk */
@@ -2929,12 +2929,10 @@ and then the scan code. */)
2929 else 2929 else
2930 { 2930 {
2931 val = Fvector (NUM_RECENT_DOSKEYS, keys); 2931 val = Fvector (NUM_RECENT_DOSKEYS, keys);
2932 bcopy (keys + recent_doskeys_index, 2932 memcpy (XVECTOR (val)->contents, keys + recent_doskeys_index,
2933 XVECTOR (val)->contents, 2933 (NUM_RECENT_DOSKEYS - recent_doskeys_index) * sizeof (Lisp_Object));
2934 (NUM_RECENT_DOSKEYS - recent_doskeys_index) * sizeof (Lisp_Object)); 2934 memcpy (XVECTOR (val)->contents + NUM_RECENT_DOSKEYS - recent_doskeys_index,
2935 bcopy (keys, 2935 keys, recent_doskeys_index * sizeof (Lisp_Object));
2936 XVECTOR (val)->contents + NUM_RECENT_DOSKEYS - recent_doskeys_index,
2937 recent_doskeys_index * sizeof (Lisp_Object));
2938 return val; 2936 return val;
2939 } 2937 }
2940} 2938}
diff --git a/src/nsfns.m b/src/nsfns.m
index 01ef46a3ca1..7180abd6113 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1159,7 +1159,7 @@ be shared by the new frame. */)
1159 1159
1160 f->output_method = output_ns; 1160 f->output_method = output_ns;
1161 f->output_data.ns = (struct ns_output *)xmalloc (sizeof *(f->output_data.ns)); 1161 f->output_data.ns = (struct ns_output *)xmalloc (sizeof *(f->output_data.ns));
1162 bzero (f->output_data.ns, sizeof (*(f->output_data.ns))); 1162 memset (f->output_data.ns, 0, sizeof (*(f->output_data.ns)));
1163 1163
1164 FRAME_FONTSET (f) = -1; 1164 FRAME_FONTSET (f) = -1;
1165 1165
diff --git a/src/nsfont.m b/src/nsfont.m
index db2399a7fa0..3cc1f7fb076 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -776,8 +776,8 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
776 xmalloc (0x100 * sizeof (struct font_metrics *)); 776 xmalloc (0x100 * sizeof (struct font_metrics *));
777 if (!font_info->glyphs || !font_info->metrics) 777 if (!font_info->glyphs || !font_info->metrics)
778 return Qnil; 778 return Qnil;
779 bzero (font_info->glyphs, 0x100 * sizeof (unsigned short *)); 779 memset (font_info->glyphs, 0, 0x100 * sizeof (unsigned short *));
780 bzero (font_info->metrics, 0x100 * sizeof (struct font_metrics *)); 780 memset (font_info->metrics, 0, 0x100 * sizeof (struct font_metrics *));
781 781
782 BLOCK_INPUT; 782 BLOCK_INPUT;
783 783
@@ -816,8 +816,8 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
816 [font_info->nsfont retain]; 816 [font_info->nsfont retain];
817 817
818 /* set up ns_font (defined in nsgui.h) */ 818 /* set up ns_font (defined in nsgui.h) */
819 font_info->name = (char *)xmalloc (strlen (fontName) + 1); 819 font_info->name = (char *)xmalloc (strlen (fontName)+1);
820 bcopy (fontName, font_info->name, strlen (fontName) + 1); 820 strcpy (font_info->name, fontName);
821 font_info->bold = [fontMgr traitsOfFont: nsfont] & NSBoldFontMask; 821 font_info->bold = [fontMgr traitsOfFont: nsfont] & NSBoldFontMask;
822 font_info->ital = 822 font_info->ital =
823 synthItal || ([fontMgr traitsOfFont: nsfont] & NSItalicFontMask); 823 synthItal || ([fontMgr traitsOfFont: nsfont] & NSItalicFontMask);
@@ -972,7 +972,7 @@ nsfont_text_extents (struct font *font, unsigned int *code, int nglyphs,
972 int totalWidth = 0; 972 int totalWidth = 0;
973 int i; 973 int i;
974 974
975 bzero (metrics, sizeof (struct font_metrics)); 975 memset (metrics, 0, sizeof (struct font_metrics));
976 976
977 for (i =0; i<nglyphs; i++) 977 for (i =0; i<nglyphs; i++)
978 { 978 {
@@ -1395,7 +1395,7 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block)
1395 sfont = [font_info->nsfont screenFont]; 1395 sfont = [font_info->nsfont screenFont];
1396 1396
1397 font_info->metrics[block] = xmalloc (0x100 * sizeof (struct font_metrics)); 1397 font_info->metrics[block] = xmalloc (0x100 * sizeof (struct font_metrics));
1398 bzero (font_info->metrics[block], 0x100 * sizeof (struct font_metrics)); 1398 memset (font_info->metrics[block], 0, 0x100 * sizeof (struct font_metrics));
1399 if (!(font_info->metrics[block])) 1399 if (!(font_info->metrics[block]))
1400 abort (); 1400 abort ();
1401 1401
diff --git a/src/nsimage.m b/src/nsimage.m
index 3e6a8c77ed7..6912156eb99 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -315,9 +315,9 @@ static EmacsImage *ImageList = nil;
315 315
316 [self addRepresentation: bmRep]; 316 [self addRepresentation: bmRep];
317 317
318 bzero (planes[0], w*h); 318 memset (planes[0], 0, w*h);
319 bzero (planes[1], w*h); 319 memset (planes[1], 0, w*h);
320 bzero (planes[2], w*h); 320 memset (planes[2], 0, w*h);
321 [self setXBMColor: [NSColor blackColor]]; 321 [self setXBMColor: [NSColor blackColor]];
322 return self; 322 return self;
323} 323}
@@ -379,7 +379,7 @@ static EmacsImage *ImageList = nil;
379 379
380 [bmRep getBitmapDataPlanes: pixmapData]; 380 [bmRep getBitmapDataPlanes: pixmapData];
381 for (i =0; i<4; i++) 381 for (i =0; i<4; i++)
382 bzero (pixmapData[i], width*height); 382 memset (pixmapData[i], 0, width*height);
383 [self addRepresentation: bmRep]; 383 [self addRepresentation: bmRep];
384 return self; 384 return self;
385} 385}
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 9034b051297..5c9ce2a6d27 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -219,8 +219,8 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
219 219
220 /* Save the frame's previous menu bar contents data */ 220 /* Save the frame's previous menu bar contents data */
221 if (previous_menu_items_used) 221 if (previous_menu_items_used)
222 bcopy (XVECTOR (f->menu_bar_vector)->contents, previous_items, 222 memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents,
223 previous_menu_items_used * sizeof (Lisp_Object)); 223 previous_menu_items_used * sizeof (Lisp_Object));
224 224
225 /* parse stage 1: extract from lisp */ 225 /* parse stage 1: extract from lisp */
226 save_menu_items (); 226 save_menu_items ();
diff --git a/src/nsterm.m b/src/nsterm.m
index afafc153f9e..62f1c0bcd57 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -2163,11 +2163,11 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
2163 { 2163 {
2164 EmacsImage **newBimgs 2164 EmacsImage **newBimgs
2165 = xmalloc (max_used_fringe_bitmap * sizeof (EmacsImage *)); 2165 = xmalloc (max_used_fringe_bitmap * sizeof (EmacsImage *));
2166 bzero (newBimgs, max_used_fringe_bitmap * sizeof (EmacsImage *)); 2166 memset (newBimgs, 0, max_used_fringe_bitmap * sizeof (EmacsImage *));
2167 2167
2168 if (nBimgs) 2168 if (nBimgs)
2169 { 2169 {
2170 bcopy (bimgs, newBimgs, nBimgs * sizeof (EmacsImage *)); 2170 memcpy (newBimgs, bimgs, nBimgs * sizeof (EmacsImage *));
2171 xfree (bimgs); 2171 xfree (bimgs);
2172 } 2172 }
2173 2173
@@ -3707,7 +3707,7 @@ ns_term_init (Lisp_Object display_name)
3707 name: nil object: nil]; */ 3707 name: nil object: nil]; */
3708 3708
3709 dpyinfo = (struct ns_display_info *)xmalloc (sizeof (struct ns_display_info)); 3709 dpyinfo = (struct ns_display_info *)xmalloc (sizeof (struct ns_display_info));
3710 bzero (dpyinfo, sizeof (struct ns_display_info)); 3710 memset (dpyinfo, 0, sizeof (struct ns_display_info));
3711 3711
3712 ns_initialize_display_info (dpyinfo); 3712 ns_initialize_display_info (dpyinfo);
3713 terminal = ns_create_terminal (dpyinfo); 3713 terminal = ns_create_terminal (dpyinfo);
diff --git a/src/print.c b/src/print.c
index ea00a90d37b..ce8bc3b4e78 100644
--- a/src/print.c
+++ b/src/print.c
@@ -289,7 +289,7 @@ int print_output_debug_flag = 1;
289static Lisp_Object 289static Lisp_Object
290print_unwind (Lisp_Object saved_text) 290print_unwind (Lisp_Object saved_text)
291{ 291{
292 bcopy (SDATA (saved_text), print_buffer, SCHARS (saved_text)); 292 memcpy (print_buffer, SDATA (saved_text), SCHARS (saved_text));
293 return Qnil; 293 return Qnil;
294} 294}
295 295
@@ -316,7 +316,7 @@ printchar (unsigned int ch, Lisp_Object fun)
316 if (print_buffer_pos_byte + len >= print_buffer_size) 316 if (print_buffer_pos_byte + len >= print_buffer_size)
317 print_buffer = (char *) xrealloc (print_buffer, 317 print_buffer = (char *) xrealloc (print_buffer,
318 print_buffer_size *= 2); 318 print_buffer_size *= 2);
319 bcopy (str, print_buffer + print_buffer_pos_byte, len); 319 memcpy (print_buffer + print_buffer_pos_byte, str, len);
320 print_buffer_pos += 1; 320 print_buffer_pos += 1;
321 print_buffer_pos_byte += len; 321 print_buffer_pos_byte += len;
322 } 322 }
@@ -364,7 +364,7 @@ strout (const char *ptr, int size, int size_byte, Lisp_Object printcharfun,
364 print_buffer = (char *) xrealloc (print_buffer, 364 print_buffer = (char *) xrealloc (print_buffer,
365 print_buffer_size); 365 print_buffer_size);
366 } 366 }
367 bcopy (ptr, print_buffer + print_buffer_pos_byte, size_byte); 367 memcpy (print_buffer + print_buffer_pos_byte, ptr, size_byte);
368 print_buffer_pos += size; 368 print_buffer_pos += size;
369 print_buffer_pos_byte += size_byte; 369 print_buffer_pos_byte += size_byte;
370 } 370 }
@@ -461,7 +461,7 @@ print_string (Lisp_Object string, Lisp_Object printcharfun)
461 if (chars < bytes) 461 if (chars < bytes)
462 { 462 {
463 newstr = make_uninit_multibyte_string (chars, bytes); 463 newstr = make_uninit_multibyte_string (chars, bytes);
464 bcopy (SDATA (string), SDATA (newstr), chars); 464 memcpy (SDATA (newstr), SDATA (string), chars);
465 str_to_multibyte (SDATA (newstr), bytes, chars); 465 str_to_multibyte (SDATA (newstr), bytes, chars);
466 string = newstr; 466 string = newstr;
467 } 467 }
@@ -480,7 +480,7 @@ print_string (Lisp_Object string, Lisp_Object printcharfun)
480 USE_SAFE_ALLOCA; 480 USE_SAFE_ALLOCA;
481 481
482 SAFE_ALLOCA (buffer, char *, nbytes); 482 SAFE_ALLOCA (buffer, char *, nbytes);
483 bcopy (SDATA (string), buffer, nbytes); 483 memcpy (buffer, SDATA (string), nbytes);
484 484
485 strout (buffer, chars, SBYTES (string), 485 strout (buffer, chars, SBYTES (string),
486 printcharfun, STRING_MULTIBYTE (string)); 486 printcharfun, STRING_MULTIBYTE (string));
@@ -1032,7 +1032,7 @@ print_error_message (Lisp_Object data, Lisp_Object stream, char *context, Lisp_O
1032 { 1032 {
1033 Lisp_Object cname = SYMBOL_NAME (caller); 1033 Lisp_Object cname = SYMBOL_NAME (caller);
1034 char *name = alloca (SBYTES (cname)); 1034 char *name = alloca (SBYTES (cname));
1035 bcopy (SDATA (cname), name, SBYTES (cname)); 1035 memcpy (name, SDATA (cname), SBYTES (cname));
1036 message_dolog (name, SBYTES (cname), 0, 0); 1036 message_dolog (name, SBYTES (cname), 0, 0);
1037 message_dolog (": ", 2, 0, 0); 1037 message_dolog (": ", 2, 0, 0);
1038 } 1038 }
diff --git a/src/process.c b/src/process.c
index c7460d81255..67052cac720 100644
--- a/src/process.c
+++ b/src/process.c
@@ -2440,7 +2440,7 @@ conv_lisp_to_sockaddr (int family, Lisp_Object address, struct sockaddr *sa, int
2440 register unsigned char *cp = NULL; 2440 register unsigned char *cp = NULL;
2441 register int i; 2441 register int i;
2442 2442
2443 bzero (sa, len); 2443 memset (sa, 0, len);
2444 2444
2445 if (VECTORP (address)) 2445 if (VECTORP (address))
2446 { 2446 {
@@ -2635,12 +2635,12 @@ set_socket_option (int s, Lisp_Object opt, Lisp_Object val)
2635 /* This is broken, at least in the Linux 2.4 kernel. 2635 /* This is broken, at least in the Linux 2.4 kernel.
2636 To unbind, the arg must be a zero integer, not the empty string. 2636 To unbind, the arg must be a zero integer, not the empty string.
2637 This should work on all systems. KFS. 2003-09-23. */ 2637 This should work on all systems. KFS. 2003-09-23. */
2638 bzero (devname, sizeof devname); 2638 memset (devname, 0, sizeof devname);
2639 if (STRINGP (val)) 2639 if (STRINGP (val))
2640 { 2640 {
2641 char *arg = (char *) SDATA (val); 2641 char *arg = (char *) SDATA (val);
2642 int len = min (strlen (arg), IFNAMSIZ); 2642 int len = min (strlen (arg), IFNAMSIZ);
2643 bcopy (arg, devname, len); 2643 memcpy (devname, arg, len);
2644 } 2644 }
2645 else if (!NILP (val)) 2645 else if (!NILP (val))
2646 error ("Bad option value for %s", name); 2646 error ("Bad option value for %s", name);
@@ -3349,7 +3349,7 @@ usage: (make-network-process &rest ARGS) */)
3349 host = Qnil; 3349 host = Qnil;
3350 } 3350 }
3351 CHECK_STRING (service); 3351 CHECK_STRING (service);
3352 bzero (&address_un, sizeof address_un); 3352 memset (&address_un, 0, sizeof address_un);
3353 address_un.sun_family = AF_LOCAL; 3353 address_un.sun_family = AF_LOCAL;
3354 strncpy (address_un.sun_path, SDATA (service), sizeof address_un.sun_path); 3354 strncpy (address_un.sun_path, SDATA (service), sizeof address_un.sun_path);
3355 ai.ai_addr = (struct sockaddr *) &address_un; 3355 ai.ai_addr = (struct sockaddr *) &address_un;
@@ -3433,7 +3433,7 @@ usage: (make-network-process &rest ARGS) */)
3433 port = svc_info->s_port; 3433 port = svc_info->s_port;
3434 } 3434 }
3435 3435
3436 bzero (&address_in, sizeof address_in); 3436 memset (&address_in, 0, sizeof address_in);
3437 address_in.sin_family = family; 3437 address_in.sin_family = family;
3438 address_in.sin_addr.s_addr = INADDR_ANY; 3438 address_in.sin_addr.s_addr = INADDR_ANY;
3439 address_in.sin_port = port; 3439 address_in.sin_port = port;
@@ -3457,8 +3457,8 @@ usage: (make-network-process &rest ARGS) */)
3457 3457
3458 if (host_info_ptr) 3458 if (host_info_ptr)
3459 { 3459 {
3460 bcopy (host_info_ptr->h_addr, (char *) &address_in.sin_addr, 3460 memcpy (&address_in.sin_addr, host_info_ptr->h_addr,
3461 host_info_ptr->h_length); 3461 host_info_ptr->h_length);
3462 family = host_info_ptr->h_addrtype; 3462 family = host_info_ptr->h_addrtype;
3463 address_in.sin_family = family; 3463 address_in.sin_family = family;
3464 } 3464 }
@@ -3470,8 +3470,8 @@ usage: (make-network-process &rest ARGS) */)
3470 if (numeric_addr == -1) 3470 if (numeric_addr == -1)
3471 error ("Unknown host \"%s\"", SDATA (host)); 3471 error ("Unknown host \"%s\"", SDATA (host));
3472 3472
3473 bcopy ((char *)&numeric_addr, (char *) &address_in.sin_addr, 3473 memcpy (&address_in.sin_addr, &numeric_addr,
3474 sizeof (address_in.sin_addr)); 3474 sizeof (address_in.sin_addr));
3475 } 3475 }
3476 3476
3477 } 3477 }
@@ -3655,7 +3655,7 @@ usage: (make-network-process &rest ARGS) */)
3655 if (is_server) 3655 if (is_server)
3656 { 3656 {
3657 Lisp_Object remote; 3657 Lisp_Object remote;
3658 bzero (datagram_address[s].sa, lres->ai_addrlen); 3658 memset (datagram_address[s].sa, 0, lres->ai_addrlen);
3659 if (remote = Fplist_get (contact, QCremote), !NILP (remote)) 3659 if (remote = Fplist_get (contact, QCremote), !NILP (remote))
3660 { 3660 {
3661 int rfamily, rlen; 3661 int rfamily, rlen;
@@ -3666,7 +3666,7 @@ usage: (make-network-process &rest ARGS) */)
3666 } 3666 }
3667 } 3667 }
3668 else 3668 else
3669 bcopy (lres->ai_addr, datagram_address[s].sa, lres->ai_addrlen); 3669 memcpy (datagram_address[s].sa, lres->ai_addr, lres->ai_addrlen);
3670 } 3670 }
3671#endif 3671#endif
3672 contact = Fplist_put (contact, QCaddress, 3672 contact = Fplist_put (contact, QCaddress,
@@ -3933,7 +3933,7 @@ format; see the description of ADDRESS in `make-network-process'. */)
3933 char namebuf[sizeof (ifq->ifr_name) + 1]; 3933 char namebuf[sizeof (ifq->ifr_name) + 1];
3934 if (ifq->ifr_addr.sa_family != AF_INET) 3934 if (ifq->ifr_addr.sa_family != AF_INET)
3935 continue; 3935 continue;
3936 bcopy (ifq->ifr_name, namebuf, sizeof (ifq->ifr_name)); 3936 memcpy (namebuf, ifq->ifr_name, sizeof (ifq->ifr_name));
3937 namebuf[sizeof (ifq->ifr_name)] = 0; 3937 namebuf[sizeof (ifq->ifr_name)] = 0;
3938 res = Fcons (Fcons (build_string (namebuf), 3938 res = Fcons (Fcons (build_string (namebuf),
3939 conv_sockaddr_to_lisp (&ifq->ifr_addr, 3939 conv_sockaddr_to_lisp (&ifq->ifr_addr,
@@ -4036,7 +4036,7 @@ FLAGS is the current flags of the interface. */)
4036 4036
4037 CHECK_STRING (ifname); 4037 CHECK_STRING (ifname);
4038 4038
4039 bzero (rq.ifr_name, sizeof rq.ifr_name); 4039 memset (rq.ifr_name, 0, sizeof rq.ifr_name);
4040 strncpy (rq.ifr_name, SDATA (ifname), sizeof (rq.ifr_name)); 4040 strncpy (rq.ifr_name, SDATA (ifname), sizeof (rq.ifr_name));
4041 4041
4042 s = socket (AF_INET, SOCK_STREAM, 0); 4042 s = socket (AF_INET, SOCK_STREAM, 0);
@@ -5277,7 +5277,7 @@ read_process_output (Lisp_Object proc, register int channel)
5277 chars = (char *) alloca (carryover + readmax); 5277 chars = (char *) alloca (carryover + readmax);
5278 if (carryover) 5278 if (carryover)
5279 /* See the comment above. */ 5279 /* See the comment above. */
5280 bcopy (SDATA (p->decoding_buf), chars, carryover); 5280 memcpy (chars, SDATA (p->decoding_buf), carryover);
5281 5281
5282#ifdef DATAGRAM_SOCKETS 5282#ifdef DATAGRAM_SOCKETS
5283 /* We have a working select, so proc_buffered_char is always -1. */ 5283 /* We have a working select, so proc_buffered_char is always -1. */
@@ -5421,8 +5421,8 @@ read_process_output (Lisp_Object proc, register int channel)
5421 { 5421 {
5422 if (SCHARS (p->decoding_buf) < coding->carryover_bytes) 5422 if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
5423 p->decoding_buf = make_uninit_string (coding->carryover_bytes); 5423 p->decoding_buf = make_uninit_string (coding->carryover_bytes);
5424 bcopy (coding->carryover, SDATA (p->decoding_buf), 5424 memcpy (SDATA (p->decoding_buf), coding->carryover,
5425 coding->carryover_bytes); 5425 coding->carryover_bytes);
5426 p->decoding_carryover = coding->carryover_bytes; 5426 p->decoding_carryover = coding->carryover_bytes;
5427 } 5427 }
5428 if (SBYTES (text) > 0) 5428 if (SBYTES (text) > 0)
@@ -5513,8 +5513,8 @@ read_process_output (Lisp_Object proc, register int channel)
5513 { 5513 {
5514 if (SCHARS (p->decoding_buf) < coding->carryover_bytes) 5514 if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
5515 p->decoding_buf = make_uninit_string (coding->carryover_bytes); 5515 p->decoding_buf = make_uninit_string (coding->carryover_bytes);
5516 bcopy (coding->carryover, SDATA (p->decoding_buf), 5516 memcpy (SDATA (p->decoding_buf), coding->carryover,
5517 coding->carryover_bytes); 5517 coding->carryover_bytes);
5518 p->decoding_carryover = coding->carryover_bytes; 5518 p->decoding_carryover = coding->carryover_bytes;
5519 } 5519 }
5520 /* Adjust the multibyteness of TEXT to that of the buffer. */ 5520 /* Adjust the multibyteness of TEXT to that of the buffer. */
@@ -6517,11 +6517,11 @@ process has been transmitted to the serial port. */)
6517 if (!proc_encode_coding_system[new_outfd]) 6517 if (!proc_encode_coding_system[new_outfd])
6518 proc_encode_coding_system[new_outfd] 6518 proc_encode_coding_system[new_outfd]
6519 = (struct coding_system *) xmalloc (sizeof (struct coding_system)); 6519 = (struct coding_system *) xmalloc (sizeof (struct coding_system));
6520 bcopy (proc_encode_coding_system[old_outfd], 6520 memcpy (proc_encode_coding_system[new_outfd],
6521 proc_encode_coding_system[new_outfd], 6521 proc_encode_coding_system[old_outfd],
6522 sizeof (struct coding_system)); 6522 sizeof (struct coding_system));
6523 bzero (proc_encode_coding_system[old_outfd], 6523 memset (proc_encode_coding_system[old_outfd], 0,
6524 sizeof (struct coding_system)); 6524 sizeof (struct coding_system));
6525 6525
6526 XPROCESS (proc)->outfd = new_outfd; 6526 XPROCESS (proc)->outfd = new_outfd;
6527 } 6527 }
@@ -7234,10 +7234,10 @@ init_process (void)
7234 chan_process[i] = Qnil; 7234 chan_process[i] = Qnil;
7235 proc_buffered_char[i] = -1; 7235 proc_buffered_char[i] = -1;
7236 } 7236 }
7237 bzero (proc_decode_coding_system, sizeof proc_decode_coding_system); 7237 memset (proc_decode_coding_system, 0, sizeof proc_decode_coding_system);
7238 bzero (proc_encode_coding_system, sizeof proc_encode_coding_system); 7238 memset (proc_encode_coding_system, 0, sizeof proc_encode_coding_system);
7239#ifdef DATAGRAM_SOCKETS 7239#ifdef DATAGRAM_SOCKETS
7240 bzero (datagram_address, sizeof datagram_address); 7240 memset (datagram_address, 0, sizeof datagram_address);
7241#endif 7241#endif
7242 7242
7243#ifdef HAVE_SOCKETS 7243#ifdef HAVE_SOCKETS
diff --git a/src/ralloc.c b/src/ralloc.c
index dd68e7c8afc..0a2b156e393 100644
--- a/src/ralloc.c
+++ b/src/ralloc.c
@@ -37,11 +37,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
37typedef POINTER_TYPE *POINTER; 37typedef POINTER_TYPE *POINTER;
38typedef size_t SIZE; 38typedef size_t SIZE;
39 39
40/* Declared in dispnew.c, this version doesn't screw up if regions
41 overlap. */
42
43extern void safe_bcopy (const char *, char *, int);
44
45#ifdef DOUG_LEA_MALLOC 40#ifdef DOUG_LEA_MALLOC
46#define M_TOP_PAD -2 41#define M_TOP_PAD -2
47extern int mallopt (int, int); 42extern int mallopt (int, int);
@@ -61,9 +56,6 @@ typedef void *POINTER;
61#include <unistd.h> 56#include <unistd.h>
62#include <malloc.h> 57#include <malloc.h>
63 58
64#define safe_bcopy(x, y, z) memmove (y, x, z)
65#define bzero(x, len) memset (x, 0, len)
66
67#endif /* not emacs */ 59#endif /* not emacs */
68 60
69 61
@@ -676,7 +668,7 @@ resize_bloc (bloc_ptr bloc, SIZE size)
676 } 668 }
677 else 669 else
678 { 670 {
679 safe_bcopy (b->data, b->new_data, b->size); 671 memmove (b->new_data, b->data, b->size);
680 *b->variable = b->data = b->new_data; 672 *b->variable = b->data = b->new_data;
681 } 673 }
682 } 674 }
@@ -687,8 +679,8 @@ resize_bloc (bloc_ptr bloc, SIZE size)
687 } 679 }
688 else 680 else
689 { 681 {
690 safe_bcopy (bloc->data, bloc->new_data, old_size); 682 memmove (bloc->new_data, bloc->data, old_size);
691 bzero ((char *) bloc->new_data + old_size, size - old_size); 683 memset (bloc->new_data + old_size, 0, size - old_size);
692 *bloc->variable = bloc->data = bloc->new_data; 684 *bloc->variable = bloc->data = bloc->new_data;
693 } 685 }
694 } 686 }
@@ -703,7 +695,7 @@ resize_bloc (bloc_ptr bloc, SIZE size)
703 } 695 }
704 else 696 else
705 { 697 {
706 safe_bcopy (b->data, b->new_data, b->size); 698 memmove (b->new_data, b->data, b->size);
707 *b->variable = b->data = b->new_data; 699 *b->variable = b->data = b->new_data;
708 } 700 }
709 } 701 }
@@ -856,7 +848,7 @@ r_alloc_sbrk (long int size)
856 header. */ 848 header. */
857 for (b = last_bloc; b != NIL_BLOC; b = b->prev) 849 for (b = last_bloc; b != NIL_BLOC; b = b->prev)
858 { 850 {
859 safe_bcopy (b->data, b->new_data, b->size); 851 memmove (b->new_data, b->data, b->size);
860 *b->variable = b->data = b->new_data; 852 *b->variable = b->data = b->new_data;
861 } 853 }
862 854
@@ -883,7 +875,7 @@ r_alloc_sbrk (long int size)
883 last_heap = first_heap; 875 last_heap = first_heap;
884 } 876 }
885 877
886 bzero (address, size); 878 memset (address, 0, size);
887 } 879 }
888 else /* size < 0 */ 880 else /* size < 0 */
889 { 881 {
@@ -902,7 +894,7 @@ r_alloc_sbrk (long int size)
902 894
903 for (b = first_bloc; b != NIL_BLOC; b = b->next) 895 for (b = first_bloc; b != NIL_BLOC; b = b->next)
904 { 896 {
905 safe_bcopy (b->data, b->new_data, b->size); 897 memmove (b->new_data, b->data, b->size);
906 *b->variable = b->data = b->new_data; 898 *b->variable = b->data = b->new_data;
907 } 899 }
908 } 900 }
@@ -1082,7 +1074,7 @@ r_alloc_thaw (void)
1082 abort (); 1074 abort ();
1083 1075
1084 /* This frees all unused blocs. It is not too inefficient, as the resize 1076 /* This frees all unused blocs. It is not too inefficient, as the resize
1085 and bcopy is done only once. Afterwards, all unreferenced blocs are 1077 and memcpy is done only once. Afterwards, all unreferenced blocs are
1086 already shrunk to zero size. */ 1078 already shrunk to zero size. */
1087 if (!r_alloc_freeze_level) 1079 if (!r_alloc_freeze_level)
1088 { 1080 {
@@ -1292,8 +1284,8 @@ r_alloc_init (void)
1292 even though it is after the sbrk value. */ 1284 even though it is after the sbrk value. */
1293 /* Doubly true, with the additional call that explicitly adds the 1285 /* Doubly true, with the additional call that explicitly adds the
1294 rest of that page to the address space. */ 1286 rest of that page to the address space. */
1295 bzero (first_heap->start, 1287 memset (first_heap->start, 0,
1296 (char *) first_heap->end - (char *) first_heap->start); 1288 (char *) first_heap->end - (char *) first_heap->start);
1297 virtual_break_value = break_value = first_heap->bloc_start = first_heap->end; 1289 virtual_break_value = break_value = first_heap->bloc_start = first_heap->end;
1298#endif 1290#endif
1299 1291
diff --git a/src/regex.c b/src/regex.c
index 10ab857b00a..b563d93fe29 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -248,37 +248,16 @@ xrealloc (block, size)
248# endif 248# endif
249# define realloc xrealloc 249# define realloc xrealloc
250 250
251/* When used in Emacs's lib-src, we need to get bzero and bcopy somehow. 251/* This is the normal way of making sure we have memcpy, memcmp and memset. */
252 If nothing else has been done, use the method below. */ 252# if defined HAVE_STRING_H || defined STDC_HEADERS || defined _LIBC
253# ifdef INHIBIT_STRING_HEADER 253# include <string.h>
254# if !(defined HAVE_BZERO && defined HAVE_BCOPY) 254# else
255# if !defined bzero && !defined bcopy 255# include <strings.h>
256# undef INHIBIT_STRING_HEADER 256# ifndef memcmp
257# endif 257# define memcmp(s1, s2, n) bcmp (s1, s2, n)
258# endif 258# endif
259# endif 259# ifndef memcpy
260 260# define memcpy(d, s, n) (bcopy (s, d, n), (d))
261/* This is the normal way of making sure we have memcpy, memcmp and bzero.
262 This is used in most programs--a few other programs avoid this
263 by defining INHIBIT_STRING_HEADER. */
264# ifndef INHIBIT_STRING_HEADER
265# if defined HAVE_STRING_H || defined STDC_HEADERS || defined _LIBC
266# include <string.h>
267# ifndef bzero
268# ifndef _LIBC
269# define bzero(s, n) (memset (s, '\0', n), (s))
270# else
271# define bzero(s, n) __bzero (s, n)
272# endif
273# endif
274# else
275# include <strings.h>
276# ifndef memcmp
277# define memcmp(s1, s2, n) bcmp (s1, s2, n)
278# endif
279# ifndef memcpy
280# define memcpy(d, s, n) (bcopy (s, d, n), (d))
281# endif
282# endif 261# endif
283# endif 262# endif
284 263
@@ -464,7 +443,7 @@ init_syntax_once ()
464 if (done) 443 if (done)
465 return; 444 return;
466 445
467 bzero (re_syntax_table, sizeof re_syntax_table); 446 memset (re_syntax_table, 0, sizeof re_syntax_table);
468 447
469 for (c = 0; c < CHAR_SET_SIZE; ++c) 448 for (c = 0; c < CHAR_SET_SIZE; ++c)
470 if (ISALNUM (c)) 449 if (ISALNUM (c))
@@ -2948,7 +2927,7 @@ regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct
2948 BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH); 2927 BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH);
2949 2928
2950 /* Clear the whole map. */ 2929 /* Clear the whole map. */
2951 bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH); 2930 memset (b, 0, (1 << BYTEWIDTH) / BYTEWIDTH);
2952 2931
2953 /* charset_not matches newline according to a syntax bit. */ 2932 /* charset_not matches newline according to a syntax bit. */
2954 if ((re_opcode_t) b[-2] == charset_not 2933 if ((re_opcode_t) b[-2] == charset_not
@@ -4303,7 +4282,7 @@ re_compile_fastmap (struct re_pattern_buffer *bufp)
4303 4282
4304 assert (fastmap && bufp->buffer); 4283 assert (fastmap && bufp->buffer);
4305 4284
4306 bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */ 4285 memset (fastmap, 0, 1 << BYTEWIDTH); /* Assume nothing's valid. */
4307 bufp->fastmap_accurate = 1; /* It will be when we're done. */ 4286 bufp->fastmap_accurate = 1; /* It will be when we're done. */
4308 4287
4309 analysis = analyse_first (bufp->buffer, bufp->buffer + bufp->used, 4288 analysis = analyse_first (bufp->buffer, bufp->buffer + bufp->used,
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h
index ea32373e02b..df9929f6823 100644
--- a/src/s/ms-w32.h
+++ b/src/s/ms-w32.h
@@ -63,15 +63,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
63 for received packets, so datagrams are broken too. */ 63 for received packets, so datagrams are broken too. */
64#define BROKEN_DATAGRAM_SOCKETS 1 64#define BROKEN_DATAGRAM_SOCKETS 1
65 65
66#define bzero(b, l) memset(b, 0, l)
67#define bcopy(s, d, l) memmove(d, s, l)
68#define bcmp(a, b, l) memcmp(a, b, l)
69
70/* bcopy (aka memmove aka memcpy at least on x86) under MSVC is quite safe. */
71#define GAP_USE_BCOPY 1
72#define BCOPY_UPWARD_SAFE 1
73#define BCOPY_DOWNWARD_SAFE 1
74
75/* If your system uses COFF (Common Object File Format) then define the 66/* If your system uses COFF (Common Object File Format) then define the
76 preprocessor symbol "COFF". */ 67 preprocessor symbol "COFF". */
77#define COFF 1 68#define COFF 1
@@ -153,8 +144,10 @@ struct sigaction {
153#define HAVE_RANDOM 1 144#define HAVE_RANDOM 1
154#undef HAVE_SYSINFO 145#undef HAVE_SYSINFO
155#undef HAVE_LRAND48 146#undef HAVE_LRAND48
156#define HAVE_BCOPY 1 147#define HAVE_MEMCMP 1
157#define HAVE_BCMP 1 148#define HAVE_MEMCPY 1
149#define HAVE_MEMMOVE 1
150#define HAVE_MEMSET 1
158#define HAVE_LOGB 1 151#define HAVE_LOGB 1
159#define HAVE_FREXP 1 152#define HAVE_FREXP 1
160#define HAVE_FMOD 1 153#define HAVE_FMOD 1
diff --git a/src/s/msdos.h b/src/s/msdos.h
index af272635968..cffa13cef41 100644
--- a/src/s/msdos.h
+++ b/src/s/msdos.h
@@ -104,10 +104,6 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
104#define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\') 104#define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
105#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_)) 105#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
106 106
107/* bcopy under djgpp is quite safe. */
108#define GAP_USE_BCOPY
109#define BCOPY_UPWARD_SAFE 1
110#define BCOPY_DOWNWARD_SAFE 1
111 107
112/* Mode line description of a buffer's type. */ 108/* Mode line description of a buffer's type. */
113#define MODE_LINE_BINARY_TEXT(buf) (NILP(buf->buffer_file_type) ? "T" : "B") 109#define MODE_LINE_BINARY_TEXT(buf) (NILP(buf->buffer_file_type) ? "T" : "B")
diff --git a/src/scroll.c b/src/scroll.c
index f05b59e3bfd..3b033f3bfda 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -258,7 +258,7 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, struct m
258 int *copy_from = (int *) alloca (window_size * sizeof (int)); 258 int *copy_from = (int *) alloca (window_size * sizeof (int));
259 259
260 /* Zero means line is empty. */ 260 /* Zero means line is empty. */
261 bzero (retained_p, window_size * sizeof (char)); 261 memset (retained_p, 0, window_size * sizeof (char));
262 for (k = 0; k < window_size; ++k) 262 for (k = 0; k < window_size; ++k)
263 copy_from[k] = -1; 263 copy_from[k] = -1;
264 264
@@ -677,7 +677,7 @@ do_direct_scrolling (frame, current_matrix, cost_matrix,
677 old matrix. Lines not retained are empty. */ 677 old matrix. Lines not retained are empty. */
678 char *retained_p = (char *) alloca (window_size * sizeof (char)); 678 char *retained_p = (char *) alloca (window_size * sizeof (char));
679 679
680 bzero (retained_p, window_size * sizeof (char)); 680 memset (retained_p, 0, window_size * sizeof (char));
681 681
682 /* Perform some sanity checks when GLYPH_DEBUG is on. */ 682 /* Perform some sanity checks when GLYPH_DEBUG is on. */
683 CHECK_MATRIX (current_matrix); 683 CHECK_MATRIX (current_matrix);
@@ -855,7 +855,7 @@ scrolling_max_lines_saved (int start, int end, int *oldhash, int *newhash, int *
855 avg_length /= end - start; 855 avg_length /= end - start;
856 threshold = avg_length / 4; 856 threshold = avg_length / 4;
857 857
858 bzero (lines, sizeof lines); 858 memset (lines, 0, sizeof lines);
859 859
860 /* Put new lines' hash codes in hash table. Ignore lines shorter 860 /* Put new lines' hash codes in hash table. Ignore lines shorter
861 than the threshold. Thus, if the lines that are in common are 861 than the threshold. Thus, if the lines that are in common are
diff --git a/src/search.c b/src/search.c
index 004e65e7715..a57136fc3fa 100644
--- a/src/search.c
+++ b/src/search.c
@@ -1404,7 +1404,7 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n,
1404 } 1404 }
1405 1405
1406 /* Store this character into the translated pattern. */ 1406 /* Store this character into the translated pattern. */
1407 bcopy (str, pat, charlen); 1407 memcpy (pat, str, charlen);
1408 pat += charlen; 1408 pat += charlen;
1409 base_pat += in_charlen; 1409 base_pat += in_charlen;
1410 len_byte -= in_charlen; 1410 len_byte -= in_charlen;
@@ -2178,8 +2178,7 @@ wordify (Lisp_Object string, int lax)
2178 2178
2179 if (SYNTAX (c) == Sword) 2179 if (SYNTAX (c) == Sword)
2180 { 2180 {
2181 bcopy (SDATA (string) + i_byte_orig, o, 2181 memcpy (o, SDATA (string) + i_byte_orig, i_byte - i_byte_orig);
2182 i_byte - i_byte_orig);
2183 o += i_byte - i_byte_orig; 2182 o += i_byte - i_byte_orig;
2184 } 2183 }
2185 else if (i > 0 && SYNTAX (prev_c) == Sword && --word_count) 2184 else if (i > 0 && SYNTAX (prev_c) == Sword && --word_count)
@@ -2774,7 +2773,7 @@ since only regular expressions have distinguished subexpressions. */)
2774 /* Now add to the end of SUBSTED. */ 2773 /* Now add to the end of SUBSTED. */
2775 if (add_stuff) 2774 if (add_stuff)
2776 { 2775 {
2777 bcopy (add_stuff, substed + substed_len, add_len); 2776 memcpy (substed + substed_len, add_stuff, add_len);
2778 substed_len += add_len; 2777 substed_len += add_len;
2779 } 2778 }
2780 } 2779 }
diff --git a/src/sound.c b/src/sound.c
index 6fa6f548917..87703dca5af 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -550,7 +550,7 @@ wav_init (struct sound *s)
550 struct wav_header *header = (struct wav_header *) s->header; 550 struct wav_header *header = (struct wav_header *) s->header;
551 551
552 if (s->header_size < sizeof *header 552 if (s->header_size < sizeof *header
553 || bcmp (s->header, "RIFF", 4) != 0) 553 || memcmp (s->header, "RIFF", 4) != 0)
554 return 0; 554 return 0;
555 555
556 /* WAV files are in little-endian order. Convert the header 556 /* WAV files are in little-endian order. Convert the header
@@ -658,7 +658,7 @@ au_init (struct sound *s)
658 struct au_header *header = (struct au_header *) s->header; 658 struct au_header *header = (struct au_header *) s->header;
659 659
660 if (s->header_size < sizeof *header 660 if (s->header_size < sizeof *header
661 || bcmp (s->header, ".snd", 4) != 0) 661 || memcmp (s->header, ".snd", 4) != 0)
662 return 0; 662 return 0;
663 663
664 header->magic_number = be2hl (header->magic_number); 664 header->magic_number = be2hl (header->magic_number);
@@ -1380,9 +1380,9 @@ Internal use only, use `play-sound' instead. */)
1380 file = Qnil; 1380 file = Qnil;
1381 GCPRO2 (sound, file); 1381 GCPRO2 (sound, file);
1382 current_sound_device = (struct sound_device *) xmalloc (sizeof (struct sound_device)); 1382 current_sound_device = (struct sound_device *) xmalloc (sizeof (struct sound_device));
1383 bzero (current_sound_device, sizeof (struct sound_device)); 1383 memset (current_sound_device, 0, sizeof (struct sound_device));
1384 current_sound = (struct sound *) xmalloc (sizeof (struct sound)); 1384 current_sound = (struct sound *) xmalloc (sizeof (struct sound));
1385 bzero (current_sound, sizeof (struct sound)); 1385 memset (current_sound, 0, sizeof (struct sound));
1386 record_unwind_protect (sound_cleanup, Qnil); 1386 record_unwind_protect (sound_cleanup, Qnil);
1387 current_sound->header = (char *) alloca (MAX_SOUND_HEADER_BYTES); 1387 current_sound->header = (char *) alloca (MAX_SOUND_HEADER_BYTES);
1388 1388
@@ -1405,7 +1405,8 @@ Internal use only, use `play-sound' instead. */)
1405 { 1405 {
1406 current_sound->data = attrs[SOUND_DATA]; 1406 current_sound->data = attrs[SOUND_DATA];
1407 current_sound->header_size = min (MAX_SOUND_HEADER_BYTES, SBYTES (current_sound->data)); 1407 current_sound->header_size = min (MAX_SOUND_HEADER_BYTES, SBYTES (current_sound->data));
1408 bcopy (SDATA (current_sound->data), current_sound->header, current_sound->header_size); 1408 memcpy (current_sound->header, SDATA (current_sound->data),
1409 current_sound->header_size);
1409 } 1410 }
1410 1411
1411 /* Find out the type of sound. Give up if we can't tell. */ 1412 /* Find out the type of sound. Give up if we can't tell. */
diff --git a/src/syntax.c b/src/syntax.c
index 2f83b0cc644..7f3557f8441 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -1422,7 +1422,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
1422 && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE)); 1422 && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE));
1423 string_multibyte = SBYTES (string) > SCHARS (string); 1423 string_multibyte = SBYTES (string) > SCHARS (string);
1424 1424
1425 bzero (fastmap, sizeof fastmap); 1425 memset (fastmap, 0, sizeof fastmap);
1426 1426
1427 str = SDATA (string); 1427 str = SDATA (string);
1428 size_byte = SBYTES (string); 1428 size_byte = SBYTES (string);
@@ -1471,7 +1471,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
1471 || *class_end != ':' || class_end[1] != ']') 1471 || *class_end != ':' || class_end[1] != ']')
1472 goto not_a_class_name; 1472 goto not_a_class_name;
1473 1473
1474 bcopy (class_beg, class_name, class_end - class_beg); 1474 memcpy (class_name, class_beg, class_end - class_beg);
1475 class_name[class_end - class_beg] = 0; 1475 class_name[class_end - class_beg] = 0;
1476 1476
1477 cc = re_wctype (class_name); 1477 cc = re_wctype (class_name);
@@ -1532,8 +1532,8 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
1532 unsigned char fastmap2[0400]; 1532 unsigned char fastmap2[0400];
1533 int range_start_byte, range_start_char; 1533 int range_start_byte, range_start_char;
1534 1534
1535 bcopy (fastmap2 + 0200, fastmap + 0200, 0200); 1535 memcpy (fastmap + 0200, fastmap2 + 0200, 0200);
1536 bzero (fastmap + 0200, 0200); 1536 memset (fastmap + 0200, 0, 0200);
1537 /* We are sure that this loop stops. */ 1537 /* We are sure that this loop stops. */
1538 for (i = 0200; ! fastmap2[i]; i++); 1538 for (i = 0200; ! fastmap2[i]; i++);
1539 c = BYTE8_TO_CHAR (i); 1539 c = BYTE8_TO_CHAR (i);
@@ -1593,7 +1593,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
1593 || *class_end != ':' || class_end[1] != ']') 1593 || *class_end != ':' || class_end[1] != ']')
1594 goto not_a_class_name_multibyte; 1594 goto not_a_class_name_multibyte;
1595 1595
1596 bcopy (class_beg, class_name, class_end - class_beg); 1596 memcpy (class_name, class_beg, class_end - class_beg);
1597 class_name[class_end - class_beg] = 0; 1597 class_name[class_end - class_beg] = 0;
1598 1598
1599 cc = re_wctype (class_name); 1599 cc = re_wctype (class_name);
@@ -1678,7 +1678,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
1678 1678
1679 if (! multibyte && n_char_ranges > 0) 1679 if (! multibyte && n_char_ranges > 0)
1680 { 1680 {
1681 bzero (fastmap + 0200, 0200); 1681 memset (fastmap + 0200, 0, 0200);
1682 for (i = 0; i < n_char_ranges; i += 2) 1682 for (i = 0; i < n_char_ranges; i += 2)
1683 { 1683 {
1684 int c1 = char_ranges[i]; 1684 int c1 = char_ranges[i];
@@ -1907,7 +1907,7 @@ skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim)
1907 multibyte = (!NILP (current_buffer->enable_multibyte_characters) 1907 multibyte = (!NILP (current_buffer->enable_multibyte_characters)
1908 && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE)); 1908 && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE));
1909 1909
1910 bzero (fastmap, sizeof fastmap); 1910 memset (fastmap, 0, sizeof fastmap);
1911 1911
1912 if (SBYTES (string) > SCHARS (string)) 1912 if (SBYTES (string) > SCHARS (string))
1913 /* As this is very rare case (syntax spec is ASCII only), don't 1913 /* As this is very rare case (syntax spec is ASCII only), don't
diff --git a/src/sysdep.c b/src/sysdep.c
index d32ba6d4de8..cfa0efa7e87 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -623,7 +623,7 @@ sys_subshell (void)
623 dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil); 623 dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil);
624 str = (unsigned char *) alloca (SCHARS (dir) + 2); 624 str = (unsigned char *) alloca (SCHARS (dir) + 2);
625 len = SCHARS (dir); 625 len = SCHARS (dir);
626 bcopy (SDATA (dir), str, len); 626 memcpy (str, SDATA (dir), len);
627 if (str[len - 1] != '/') str[len++] = '/'; 627 if (str[len - 1] != '/') str[len++] = '/';
628 str[len] = 0; 628 str[len] = 0;
629 xyzzy: 629 xyzzy:
@@ -855,7 +855,7 @@ emacs_get_tty (int fd, struct emacs_tty *settings)
855 /* Retrieve the primary parameters - baud rate, character size, etcetera. */ 855 /* Retrieve the primary parameters - baud rate, character size, etcetera. */
856#ifdef HAVE_TCATTR 856#ifdef HAVE_TCATTR
857 /* We have those nifty POSIX tcmumbleattr functions. */ 857 /* We have those nifty POSIX tcmumbleattr functions. */
858 bzero (&settings->main, sizeof (settings->main)); 858 memset (&settings->main, 0, sizeof (settings->main));
859 if (tcgetattr (fd, &settings->main) < 0) 859 if (tcgetattr (fd, &settings->main) < 0)
860 return -1; 860 return -1;
861 861
@@ -922,7 +922,7 @@ emacs_set_tty (int fd, struct emacs_tty *settings, int flushp)
922 { 922 {
923 struct termios new; 923 struct termios new;
924 924
925 bzero (&new, sizeof (new)); 925 memset (&new, 0, sizeof (new));
926 /* Get the current settings, and see if they're what we asked for. */ 926 /* Get the current settings, and see if they're what we asked for. */
927 tcgetattr (fd, &new); 927 tcgetattr (fd, &new);
928 /* We cannot use memcmp on the whole structure here because under 928 /* We cannot use memcmp on the whole structure here because under
@@ -2715,6 +2715,59 @@ rmdir (char *dpath)
2715#endif /* !HAVE_RMDIR */ 2715#endif /* !HAVE_RMDIR */
2716 2716
2717 2717
2718#ifndef HAVE_MEMSET
2719void *
2720memset (void *b, int n, size_t length)
2721{
2722 unsigned char *p = b;
2723 while (length-- > 0)
2724 *p++ = n;
2725 return b;
2726}
2727#endif /* !HAVE_MEMSET */
2728
2729#ifndef HAVE_MEMCPY
2730void *
2731memcpy (void *b1, void *b2, size_t length)
2732{
2733 unsigned char *p1 = b1, *p2 = b2;
2734 while (length-- > 0)
2735 *p1++ = *p2++;
2736 return b1;
2737}
2738#endif /* !HAVE_MEMCPY */
2739
2740#ifndef HAVE_MEMMOVE
2741void *
2742memmove (void *b1, void *b2, size_t length)
2743{
2744 unsigned char *p1 = b1, *p2 = b2;
2745 if (p1 < p2 || p1 >= p2 + length)
2746 while (length-- > 0)
2747 *p1++ = *p2++;
2748 else
2749 {
2750 p1 += length;
2751 p2 += length;
2752 while (length-- > 0)
2753 *--p1 = *--p2;
2754 }
2755 return b1;
2756}
2757#endif /* !HAVE_MEMCPY */
2758
2759#ifndef HAVE_MEMCMP
2760int
2761memcmp (void *b1, void *b2, size_t length)
2762{
2763 unsigned char *p1 = b1, *p2 = b2;
2764 while (length-- > 0)
2765 if (*p1++ != *p2++)
2766 return p1[-1] < p2[-1] ? -1 : 1;
2767 return 0;
2768}
2769#endif /* !HAVE_MEMCMP */
2770
2718#ifndef HAVE_STRSIGNAL 2771#ifndef HAVE_STRSIGNAL
2719char * 2772char *
2720strsignal (int code) 2773strsignal (int code)
diff --git a/src/term.c b/src/term.c
index fb64ca5d6b3..ec30796bfff 100644
--- a/src/term.c
+++ b/src/term.c
@@ -720,7 +720,7 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi
720 encode_terminal_src_size); 720 encode_terminal_src_size);
721 buf = encode_terminal_src + nbytes; 721 buf = encode_terminal_src + nbytes;
722 } 722 }
723 bcopy (SDATA (string), buf, SBYTES (string)); 723 memcpy (buf, SDATA (string), SBYTES (string));
724 buf += SBYTES (string); 724 buf += SBYTES (string);
725 nchars += SCHARS (string); 725 nchars += SCHARS (string);
726 } 726 }
@@ -1225,8 +1225,8 @@ calculate_costs (struct frame *frame)
1225 = (int *) xmalloc (sizeof (int) 1225 = (int *) xmalloc (sizeof (int)
1226 + 2 * max_frame_cols * sizeof (int)); 1226 + 2 * max_frame_cols * sizeof (int));
1227 1227
1228 bzero (char_ins_del_vector, (sizeof (int) 1228 memset (char_ins_del_vector, 0,
1229 + 2 * max_frame_cols * sizeof (int))); 1229 (sizeof (int) + 2 * max_frame_cols * sizeof (int)));
1230 1230
1231 1231
1232 if (f && (!tty->TS_ins_line && !tty->TS_del_line)) 1232 if (f && (!tty->TS_ins_line && !tty->TS_del_line))
@@ -1893,7 +1893,7 @@ produce_special_glyphs (struct it *it, enum display_element_type what)
1893 temp_it.what = IT_CHARACTER; 1893 temp_it.what = IT_CHARACTER;
1894 temp_it.len = 1; 1894 temp_it.len = 1;
1895 temp_it.object = make_number (0); 1895 temp_it.object = make_number (0);
1896 bzero (&temp_it.current, sizeof temp_it.current); 1896 memset (&temp_it.current, 0, sizeof temp_it.current);
1897 1897
1898 if (what == IT_CONTINUATION) 1898 if (what == IT_CONTINUATION)
1899 { 1899 {
@@ -3229,7 +3229,7 @@ create_tty_output (struct frame *f)
3229 abort (); 3229 abort ();
3230 3230
3231 t = xmalloc (sizeof (struct tty_output)); 3231 t = xmalloc (sizeof (struct tty_output));
3232 bzero (t, sizeof (struct tty_output)); 3232 memset (t, 0, sizeof (struct tty_output));
3233 3233
3234 t->display_info = FRAME_TERMINAL (f)->display_info.tty; 3234 t->display_info = FRAME_TERMINAL (f)->display_info.tty;
3235 3235
@@ -3436,7 +3436,7 @@ init_tty (char *name, char *terminal_type, int must_succeed)
3436#else 3436#else
3437 tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info)); 3437 tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info));
3438#endif 3438#endif
3439 bzero (tty, sizeof (struct tty_display_info)); 3439 memset (tty, 0, sizeof (struct tty_display_info));
3440 tty->next = tty_list; 3440 tty->next = tty_list;
3441 tty_list = tty; 3441 tty_list = tty;
3442 3442
@@ -4028,7 +4028,7 @@ delete_tty (struct terminal *terminal)
4028 xfree (tty->termcap_strings_buffer); 4028 xfree (tty->termcap_strings_buffer);
4029 xfree (tty->termcap_term_buffer); 4029 xfree (tty->termcap_term_buffer);
4030 4030
4031 bzero (tty, sizeof (struct tty_display_info)); 4031 memset (tty, 0, sizeof (struct tty_display_info));
4032 xfree (tty); 4032 xfree (tty);
4033} 4033}
4034 4034
diff --git a/src/termcap.c b/src/termcap.c
index 5a6d9483a51..fd8a666d0f2 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -46,11 +46,6 @@ char *malloc ();
46char *realloc (); 46char *realloc ();
47#endif 47#endif
48 48
49/* Do this after the include, in case string.h prototypes bcopy. */
50#if (defined(HAVE_STRING_H) || defined(STDC_HEADERS)) && !defined(bcopy)
51#define bcopy(s, d, n) memcpy ((d), (s), (n))
52#endif
53
54#ifdef HAVE_UNISTD_H 49#ifdef HAVE_UNISTD_H
55#include <unistd.h> 50#include <unistd.h>
56#endif 51#endif
@@ -315,7 +310,7 @@ tgetst1 (char *ptr, char **area)
315 310
316 cut[last_p_param].len = r - cut[last_p_param].beg; 311 cut[last_p_param].len = r - cut[last_p_param].beg;
317 for (i = 0, wp = ret; i <= last_p_param; wp += cut[i++].len) 312 for (i = 0, wp = ret; i <= last_p_param; wp += cut[i++].len)
318 bcopy (cut[i].beg, wp, cut[i].len); 313 memcpy (wp, cut[i].beg, cut[i].len);
319 r = wp; 314 r = wp;
320 } 315 }
321 } 316 }
@@ -739,7 +734,7 @@ gobble_line (int fd, register struct termcap_buffer *bufp, char *append_end)
739 else 734 else
740 { 735 {
741 append_end -= bufp->ptr - buf; 736 append_end -= bufp->ptr - buf;
742 bcopy (bufp->ptr, buf, bufp->full -= bufp->ptr - buf); 737 memcpy (buf, bufp->ptr, bufp->full -= bufp->ptr - buf);
743 bufp->ptr = buf; 738 bufp->ptr = buf;
744 } 739 }
745 if (!(nread = read (fd, buf + bufp->full, bufp->size - bufp->full))) 740 if (!(nread = read (fd, buf + bufp->full, bufp->size - bufp->full)))
diff --git a/src/termhooks.h b/src/termhooks.h
index 9af8a6c4f72..7762dd15efe 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -255,7 +255,7 @@ struct input_event
255 Lisp_Object arg; 255 Lisp_Object arg;
256}; 256};
257 257
258#define EVENT_INIT(event) bzero (&(event), sizeof (struct input_event)) 258#define EVENT_INIT(event) memset (&(event), 0, sizeof (struct input_event))
259 259
260/* Bits in the modifiers member of the input_event structure. 260/* Bits in the modifiers member of the input_event structure.
261 Note that reorder_modifiers assumes that the bits are in canonical 261 Note that reorder_modifiers assumes that the bits are in canonical
diff --git a/src/tparam.c b/src/tparam.c
index a35647799cb..c768581aeb5 100644
--- a/src/tparam.c
+++ b/src/tparam.c
@@ -35,11 +35,6 @@ char *malloc ();
35char *realloc (); 35char *realloc ();
36#endif 36#endif
37 37
38/* Do this after the include, in case string.h prototypes bcopy. */
39#if (defined(HAVE_STRING_H) || defined(STDC_HEADERS)) && !defined(bcopy)
40#define bcopy(s, d, n) memcpy ((d), (s), (n))
41#endif
42
43#endif /* not emacs */ 38#endif /* not emacs */
44 39
45#ifndef NULL 40#ifndef NULL
@@ -151,7 +146,7 @@ tparam1 (char *string, char *outstring, int len, char *up, char *left, register
151 { 146 {
152 outlen = len + 40; 147 outlen = len + 40;
153 new = (char *) xmalloc (outlen); 148 new = (char *) xmalloc (outlen);
154 bcopy (outstring, new, offset); 149 memcpy (new, outstring, offset);
155 } 150 }
156 else 151 else
157 { 152 {
diff --git a/src/unexalpha.c b/src/unexalpha.c
index 196742a19aa..ab71f6c004c 100644
--- a/src/unexalpha.c
+++ b/src/unexalpha.c
@@ -260,7 +260,7 @@ unexec (new_name, a_name, data_start, bss_start, entry_address)
260 260
261 Brk = brk; 261 Brk = brk;
262 262
263 bcopy (data_section, &old_data_scnhdr, sizeof (old_data_scnhdr)); 263 memcpy (&old_data_scnhdr, data_section, sizeof (old_data_scnhdr));
264 264
265 nhdr.aout.dsize = brk - DATA_START; 265 nhdr.aout.dsize = brk - DATA_START;
266 nhdr.aout.bsize = 0; 266 nhdr.aout.bsize = 0;
@@ -328,7 +328,7 @@ unexec (new_name, a_name, data_start, bss_start, entry_address)
328#ifdef _GOT 328#ifdef _GOT
329 if (got_section != NULL) 329 if (got_section != NULL)
330 { 330 {
331 bcopy (got_section, buffer, sizeof (struct scnhdr)); 331 memcpy (buffer, got_section, sizeof (struct scnhdr));
332 332
333 got_section->s_vaddr = vaddr; 333 got_section->s_vaddr = vaddr;
334 got_section->s_paddr = vaddr; 334 got_section->s_paddr = vaddr;
@@ -376,7 +376,7 @@ unexec (new_name, a_name, data_start, bss_start, entry_address)
376 * Construct new symbol table header 376 * Construct new symbol table header
377 */ 377 */
378 378
379 bcopy (oldptr + nhdr.fhdr.f_symptr, buffer, cbHDRR); 379 memcpy (buffer, oldptr + nhdr.fhdr.f_symptr, cbHDRR);
380 380
381#define symhdr ((pHDRR)buffer) 381#define symhdr ((pHDRR)buffer)
382 newsyms = nhdr.aout.tsize + nhdr.aout.dsize; 382 newsyms = nhdr.aout.tsize + nhdr.aout.dsize;
diff --git a/src/unexec.c b/src/unexec.c
index 1a27db1232d..27a15188837 100644
--- a/src/unexec.c
+++ b/src/unexec.c
@@ -472,7 +472,7 @@ write_segment (new, ptr, end)
472 int pagesize = getpagesize (); 472 int pagesize = getpagesize ();
473 char zeros[1 << 13]; 473 char zeros[1 << 13];
474 474
475 bzero (zeros, sizeof (zeros)); 475 memset (zeros, 0, sizeof (zeros));
476 476
477 for (i = 0; ptr < end;) 477 for (i = 0; ptr < end;)
478 { 478 {
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index 3949e5f6e00..1acc009ba90 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -218,7 +218,7 @@ unexec_write_zero (off_t dest, size_t count)
218 char buf[UNEXEC_COPY_BUFSZ]; 218 char buf[UNEXEC_COPY_BUFSZ];
219 ssize_t bytes; 219 ssize_t bytes;
220 220
221 bzero (buf, UNEXEC_COPY_BUFSZ); 221 memset (buf, 0, UNEXEC_COPY_BUFSZ);
222 if (lseek (outfd, dest, SEEK_SET) != dest) 222 if (lseek (outfd, dest, SEEK_SET) != dest)
223 return 0; 223 return 0;
224 224
diff --git a/src/w32fns.c b/src/w32fns.c
index b5af95cca13..96ecf436c45 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -2746,7 +2746,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
2746 { 2746 {
2747 PAINTSTRUCT paintStruct; 2747 PAINTSTRUCT paintStruct;
2748 RECT update_rect; 2748 RECT update_rect;
2749 bzero (&update_rect, sizeof (update_rect)); 2749 memset (&update_rect, 0, sizeof (update_rect));
2750 2750
2751 f = x_window_to_frame (dpyinfo, hwnd); 2751 f = x_window_to_frame (dpyinfo, hwnd);
2752 if (f == 0) 2752 if (f == 0)
@@ -4275,7 +4275,7 @@ This function is an internal primitive--use `make-frame' instead. */)
4275 f->output_method = output_w32; 4275 f->output_method = output_w32;
4276 f->output_data.w32 = 4276 f->output_data.w32 =
4277 (struct w32_output *) xmalloc (sizeof (struct w32_output)); 4277 (struct w32_output *) xmalloc (sizeof (struct w32_output));
4278 bzero (f->output_data.w32, sizeof (struct w32_output)); 4278 memset (f->output_data.w32, 0, sizeof (struct w32_output));
4279 FRAME_FONTSET (f) = -1; 4279 FRAME_FONTSET (f) = -1;
4280 4280
4281 f->icon_name 4281 f->icon_name
@@ -5388,7 +5388,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
5388 f->output_method = output_w32; 5388 f->output_method = output_w32;
5389 f->output_data.w32 = 5389 f->output_data.w32 =
5390 (struct w32_output *) xmalloc (sizeof (struct w32_output)); 5390 (struct w32_output *) xmalloc (sizeof (struct w32_output));
5391 bzero (f->output_data.w32, sizeof (struct w32_output)); 5391 memset (f->output_data.w32, 0, sizeof (struct w32_output));
5392 5392
5393 FRAME_FONTSET (f) = -1; 5393 FRAME_FONTSET (f) = -1;
5394 f->icon_name = Qnil; 5394 f->icon_name = Qnil;
@@ -6046,7 +6046,7 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */)
6046 specbind (Qinhibit_redisplay, Qt); 6046 specbind (Qinhibit_redisplay, Qt);
6047 BLOCK_INPUT; 6047 BLOCK_INPUT;
6048 6048
6049 bzero (&new_file_details, sizeof (new_file_details)); 6049 memset (&new_file_details, 0, sizeof (new_file_details));
6050 /* Apparently NT4 crashes if you give it an unexpected size. 6050 /* Apparently NT4 crashes if you give it an unexpected size.
6051 I'm not sure about Windows 9x, so play it safe. */ 6051 I'm not sure about Windows 9x, so play it safe. */
6052 if (w32_major_version > 4 && w32_major_version < 95) 6052 if (w32_major_version > 4 && w32_major_version < 95)
@@ -6157,10 +6157,10 @@ DEFUN ("system-move-file-to-trash", Fsystem_move_file_to_trash,
6157 /* On Windows, write permission is required to delete/move files. */ 6157 /* On Windows, write permission is required to delete/move files. */
6158 _chmod (path, 0666); 6158 _chmod (path, 0666);
6159 6159
6160 bzero (tmp_path, sizeof (tmp_path)); 6160 memset (tmp_path, 0, sizeof (tmp_path));
6161 strcpy (tmp_path, path); 6161 strcpy (tmp_path, path);
6162 6162
6163 bzero (&file_op, sizeof (file_op)); 6163 memset (&file_op, 0, sizeof (file_op));
6164 file_op.hwnd = HWND_DESKTOP; 6164 file_op.hwnd = HWND_DESKTOP;
6165 file_op.wFunc = FO_DELETE; 6165 file_op.wFunc = FO_DELETE;
6166 file_op.pFrom = tmp_path; 6166 file_op.pFrom = tmp_path;
diff --git a/src/w32font.c b/src/w32font.c
index d4dd3e75a7f..2c76e362ce6 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -225,7 +225,7 @@ w32font_list_family (Lisp_Object frame)
225 HDC dc; 225 HDC dc;
226 FRAME_PTR f = XFRAME (frame); 226 FRAME_PTR f = XFRAME (frame);
227 227
228 bzero (&font_match_pattern, sizeof (font_match_pattern)); 228 memset (&font_match_pattern, 0, sizeof (font_match_pattern));
229 font_match_pattern.lfCharSet = DEFAULT_CHARSET; 229 font_match_pattern.lfCharSet = DEFAULT_CHARSET;
230 230
231 dc = get_frame_dc (f); 231 dc = get_frame_dc (f);
@@ -373,7 +373,7 @@ w32font_text_extents (struct font *font, unsigned *code,
373 373
374 if (metrics) 374 if (metrics)
375 { 375 {
376 bzero (metrics, sizeof (struct font_metrics)); 376 memset (metrics, 0, sizeof (struct font_metrics));
377 metrics->ascent = font->ascent; 377 metrics->ascent = font->ascent;
378 metrics->descent = font->descent; 378 metrics->descent = font->descent;
379 379
@@ -394,9 +394,9 @@ w32font_text_extents (struct font *font, unsigned *code,
394 = xrealloc (w32_font->cached_metrics, 394 = xrealloc (w32_font->cached_metrics,
395 (block + 1) 395 (block + 1)
396 * sizeof (struct w32_metric_cache *)); 396 * sizeof (struct w32_metric_cache *));
397 bzero (w32_font->cached_metrics + w32_font->n_cache_blocks, 397 memset (w32_font->cached_metrics + w32_font->n_cache_blocks, 0,
398 ((block + 1 - w32_font->n_cache_blocks) 398 ((block + 1 - w32_font->n_cache_blocks)
399 * sizeof (struct w32_metric_cache *))); 399 * sizeof (struct w32_metric_cache *)));
400 w32_font->n_cache_blocks = block + 1; 400 w32_font->n_cache_blocks = block + 1;
401 } 401 }
402 402
@@ -404,8 +404,8 @@ w32font_text_extents (struct font *font, unsigned *code,
404 { 404 {
405 w32_font->cached_metrics[block] 405 w32_font->cached_metrics[block]
406 = xmalloc (CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache)); 406 = xmalloc (CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache));
407 bzero (w32_font->cached_metrics[block], 407 memset (w32_font->cached_metrics[block], 0,
408 CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache)); 408 CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache));
409 } 409 }
410 410
411 char_metric = w32_font->cached_metrics[block] + pos_in_block; 411 char_metric = w32_font->cached_metrics[block] + pos_in_block;
@@ -706,7 +706,7 @@ w32font_list_internal (Lisp_Object frame, Lisp_Object font_spec, int opentype_on
706 match_data.list = Qnil; 706 match_data.list = Qnil;
707 match_data.frame = frame; 707 match_data.frame = frame;
708 708
709 bzero (&match_data.pattern, sizeof (LOGFONT)); 709 memset (&match_data.pattern, 0, sizeof (LOGFONT));
710 fill_in_logfont (f, &match_data.pattern, font_spec); 710 fill_in_logfont (f, &match_data.pattern, font_spec);
711 711
712 /* If the charset is unrecognized, then we won't find a font, so don't 712 /* If the charset is unrecognized, then we won't find a font, so don't
@@ -759,7 +759,7 @@ w32font_match_internal (Lisp_Object frame, Lisp_Object font_spec, int opentype_o
759 match_data.frame = frame; 759 match_data.frame = frame;
760 match_data.list = Qnil; 760 match_data.list = Qnil;
761 761
762 bzero (&match_data.pattern, sizeof (LOGFONT)); 762 memset (&match_data.pattern, 0, sizeof (LOGFONT));
763 fill_in_logfont (f, &match_data.pattern, font_spec); 763 fill_in_logfont (f, &match_data.pattern, font_spec);
764 764
765 match_data.opentype_only = opentype_only; 765 match_data.opentype_only = opentype_only;
@@ -795,7 +795,7 @@ w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity,
795 if (!font) 795 if (!font)
796 return 0; 796 return 0;
797 797
798 bzero (&logfont, sizeof (logfont)); 798 memset (&logfont, 0, sizeof (logfont));
799 fill_in_logfont (f, &logfont, font_entity); 799 fill_in_logfont (f, &logfont, font_entity);
800 800
801 /* Prefer truetype fonts, to avoid known problems with type1 fonts, and 801 /* Prefer truetype fonts, to avoid known problems with type1 fonts, and
@@ -824,8 +824,8 @@ w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity,
824 { 824 {
825 metrics = (OUTLINETEXTMETRICW *) alloca (len); 825 metrics = (OUTLINETEXTMETRICW *) alloca (len);
826 if (GetOutlineTextMetricsW (dc, len, metrics)) 826 if (GetOutlineTextMetricsW (dc, len, metrics))
827 bcopy (&metrics->otmTextMetrics, &w32_font->metrics, 827 memcpy (&w32_font->metrics, &metrics->otmTextMetrics,
828 sizeof (TEXTMETRICW)); 828 sizeof (TEXTMETRICW));
829 else 829 else
830 metrics = NULL; 830 metrics = NULL;
831 } 831 }
@@ -2306,7 +2306,7 @@ compute_metrics (HDC dc, struct w32font_info *w32_font, unsigned int code,
2306 if (w32_font->glyph_idx) 2306 if (w32_font->glyph_idx)
2307 options |= GGO_GLYPH_INDEX; 2307 options |= GGO_GLYPH_INDEX;
2308 2308
2309 bzero (&transform, sizeof (transform)); 2309 memset (&transform, 0, sizeof (transform));
2310 transform.eM11.value = 1; 2310 transform.eM11.value = 1;
2311 transform.eM22.value = 1; 2311 transform.eM22.value = 1;
2312 2312
@@ -2340,8 +2340,8 @@ in the font selection dialog. */)
2340 HANDLE oldobj; 2340 HANDLE oldobj;
2341 char buf[100]; 2341 char buf[100];
2342 2342
2343 bzero (&cf, sizeof (cf)); 2343 memset (&cf, 0, sizeof (cf));
2344 bzero (&lf, sizeof (lf)); 2344 memset (&lf, 0, sizeof (lf));
2345 2345
2346 cf.lStructSize = sizeof (cf); 2346 cf.lStructSize = sizeof (cf);
2347 cf.hwndOwner = FRAME_W32_WINDOW (f); 2347 cf.hwndOwner = FRAME_W32_WINDOW (f);
diff --git a/src/w32menu.c b/src/w32menu.c
index 8def7237ba0..c23751d3225 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -450,8 +450,8 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
450 450
451 /* Save the frame's previous menu bar contents data. */ 451 /* Save the frame's previous menu bar contents data. */
452 if (previous_menu_items_used) 452 if (previous_menu_items_used)
453 bcopy (XVECTOR (f->menu_bar_vector)->contents, previous_items, 453 memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents,
454 previous_menu_items_used * sizeof (Lisp_Object)); 454 previous_menu_items_used * sizeof (Lisp_Object));
455 455
456 /* Fill in menu_items with the current menu bar contents. 456 /* Fill in menu_items with the current menu bar contents.
457 This can evaluate Lisp code. */ 457 This can evaluate Lisp code. */
@@ -1522,7 +1522,7 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
1522 if (set_menu_item_info) 1522 if (set_menu_item_info)
1523 { 1523 {
1524 MENUITEMINFO info; 1524 MENUITEMINFO info;
1525 bzero (&info, sizeof (info)); 1525 memset (&info, 0, sizeof (info));
1526 info.cbSize = sizeof (info); 1526 info.cbSize = sizeof (info);
1527 info.fMask = MIIM_DATA; 1527 info.fMask = MIIM_DATA;
1528 1528
@@ -1605,7 +1605,7 @@ w32_menu_display_help (HWND owner, HMENU menu, UINT item, UINT flags)
1605 { 1605 {
1606 MENUITEMINFO info; 1606 MENUITEMINFO info;
1607 1607
1608 bzero (&info, sizeof (info)); 1608 memset (&info, 0, sizeof (info));
1609 info.cbSize = sizeof (info); 1609 info.cbSize = sizeof (info);
1610 info.fMask = MIIM_DATA; 1610 info.fMask = MIIM_DATA;
1611 get_menu_item_info (menu, item, FALSE, &info); 1611 get_menu_item_info (menu, item, FALSE, &info);
@@ -1642,7 +1642,7 @@ w32_free_submenu_strings (HMENU menu)
1642 for (i = 0; i < num; i++) 1642 for (i = 0; i < num; i++)
1643 { 1643 {
1644 MENUITEMINFO info; 1644 MENUITEMINFO info;
1645 bzero (&info, sizeof (info)); 1645 memset (&info, 0, sizeof (info));
1646 info.cbSize = sizeof (info); 1646 info.cbSize = sizeof (info);
1647 info.fMask = MIIM_DATA | MIIM_TYPE | MIIM_SUBMENU; 1647 info.fMask = MIIM_DATA | MIIM_TYPE | MIIM_SUBMENU;
1648 1648
diff --git a/src/w32term.c b/src/w32term.c
index 1a953be944b..7ace4b01f95 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -323,7 +323,7 @@ XGCValues *
323XCreateGC (void *ignore, Window window, unsigned long mask, XGCValues *xgcv) 323XCreateGC (void *ignore, Window window, unsigned long mask, XGCValues *xgcv)
324{ 324{
325 XGCValues *gc = (XGCValues *) xmalloc (sizeof (XGCValues)); 325 XGCValues *gc = (XGCValues *) xmalloc (sizeof (XGCValues));
326 bzero (gc, sizeof (XGCValues)); 326 memset (gc, 0, sizeof (XGCValues));
327 327
328 XChangeGC (ignore, gc, mask, xgcv); 328 XChangeGC (ignore, gc, mask, xgcv);
329 329
@@ -5826,7 +5826,7 @@ w32_initialize_display_info (Lisp_Object display_name)
5826{ 5826{
5827 struct w32_display_info *dpyinfo = &one_w32_display_info; 5827 struct w32_display_info *dpyinfo = &one_w32_display_info;
5828 5828
5829 bzero (dpyinfo, sizeof (*dpyinfo)); 5829 memset (dpyinfo, 0, sizeof (*dpyinfo));
5830 5830
5831 /* Put it on w32_display_name_list. */ 5831 /* Put it on w32_display_name_list. */
5832 w32_display_name_list = Fcons (Fcons (display_name, Qnil), 5832 w32_display_name_list = Fcons (Fcons (display_name, Qnil),
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index f1e5c886b4d..9edd6353ba3 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -97,7 +97,7 @@ uniscribe_list_family (Lisp_Object frame)
97 HDC dc; 97 HDC dc;
98 FRAME_PTR f = XFRAME (frame); 98 FRAME_PTR f = XFRAME (frame);
99 99
100 bzero (&font_match_pattern, sizeof (font_match_pattern)); 100 memset (&font_match_pattern, 0, sizeof (font_match_pattern));
101 /* Limit enumerated fonts to outline fonts to save time. */ 101 /* Limit enumerated fonts to outline fonts to save time. */
102 font_match_pattern.lfOutPrecision = OUT_OUTLINE_PRECIS; 102 font_match_pattern.lfOutPrecision = OUT_OUTLINE_PRECIS;
103 103
diff --git a/src/w32xfns.c b/src/w32xfns.c
index f57903dc68c..8fee42dae48 100644
--- a/src/w32xfns.c
+++ b/src/w32xfns.c
@@ -178,7 +178,7 @@ get_next_msg (W32Msg * lpmsg, BOOL bWait)
178 178
179 if (nQueue) 179 if (nQueue)
180 { 180 {
181 bcopy (&(lpHead->w32msg), lpmsg, sizeof (W32Msg)); 181 memcpy (lpmsg, &lpHead->w32msg, sizeof (W32Msg));
182 182
183 { 183 {
184 int_msg * lpCur = lpHead; 184 int_msg * lpCur = lpHead;
@@ -250,7 +250,7 @@ post_msg (W32Msg * lpmsg)
250 if (!lpNew) 250 if (!lpNew)
251 return (FALSE); 251 return (FALSE);
252 252
253 bcopy (lpmsg, &(lpNew->w32msg), sizeof (W32Msg)); 253 memcpy (&lpNew->w32msg, lpmsg, sizeof (W32Msg));
254 lpNew->lpNext = NULL; 254 lpNew->lpNext = NULL;
255 255
256 enter_crit (); 256 enter_crit ();
@@ -280,7 +280,7 @@ prepend_msg (W32Msg *lpmsg)
280 if (!lpNew) 280 if (!lpNew)
281 return (FALSE); 281 return (FALSE);
282 282
283 bcopy (lpmsg, &(lpNew->w32msg), sizeof (W32Msg)); 283 memcpy (&lpNew->w32msg, lpmsg, sizeof (W32Msg));
284 284
285 enter_crit (); 285 enter_crit ();
286 286
diff --git a/src/window.c b/src/window.c
index 28dfc635682..ef7d14595c1 100644
--- a/src/window.c
+++ b/src/window.c
@@ -243,9 +243,9 @@ make_window (void)
243 p->dedicated = Qnil; 243 p->dedicated = Qnil;
244 p->window_parameters = Qnil; 244 p->window_parameters = Qnil;
245 p->pseudo_window_p = 0; 245 p->pseudo_window_p = 0;
246 bzero (&p->cursor, sizeof (p->cursor)); 246 memset (&p->cursor, 0, sizeof (p->cursor));
247 bzero (&p->last_cursor, sizeof (p->last_cursor)); 247 memset (&p->last_cursor, 0, sizeof (p->last_cursor));
248 bzero (&p->phys_cursor, sizeof (p->phys_cursor)); 248 memset (&p->phys_cursor, 0, sizeof (p->phys_cursor));
249 p->desired_matrix = p->current_matrix = 0; 249 p->desired_matrix = p->current_matrix = 0;
250 p->nrows_scale_factor = p->ncols_scale_factor = 1; 250 p->nrows_scale_factor = p->ncols_scale_factor = 1;
251 p->phys_cursor_type = -1; 251 p->phys_cursor_type = -1;
@@ -1557,9 +1557,9 @@ replace_window (Lisp_Object old, Lisp_Object replacement)
1557 p->total_lines = o->total_lines; 1557 p->total_lines = o->total_lines;
1558 p->desired_matrix = p->current_matrix = 0; 1558 p->desired_matrix = p->current_matrix = 0;
1559 p->vscroll = 0; 1559 p->vscroll = 0;
1560 bzero (&p->cursor, sizeof (p->cursor)); 1560 memset (&p->cursor, 0, sizeof (p->cursor));
1561 bzero (&p->last_cursor, sizeof (p->last_cursor)); 1561 memset (&p->last_cursor, 0, sizeof (p->last_cursor));
1562 bzero (&p->phys_cursor, sizeof (p->phys_cursor)); 1562 memset (&p->phys_cursor, 0, sizeof (p->phys_cursor));
1563 p->phys_cursor_type = -1; 1563 p->phys_cursor_type = -1;
1564 p->phys_cursor_width = -1; 1564 p->phys_cursor_width = -1;
1565 p->must_be_updated_p = 0; 1565 p->must_be_updated_p = 0;
@@ -3481,7 +3481,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3481 3481
3482 XSETFASTINT (w->window_end_pos, 0); 3482 XSETFASTINT (w->window_end_pos, 0);
3483 XSETFASTINT (w->window_end_vpos, 0); 3483 XSETFASTINT (w->window_end_vpos, 0);
3484 bzero (&w->last_cursor, sizeof w->last_cursor); 3484 memset (&w->last_cursor, 0, sizeof w->last_cursor);
3485 w->window_end_valid = Qnil; 3485 w->window_end_valid = Qnil;
3486 if (!(keep_margins_p && samebuf)) 3486 if (!(keep_margins_p && samebuf))
3487 { /* If we're not actually changing the buffer, don't reset hscroll and 3487 { /* If we're not actually changing the buffer, don't reset hscroll and
@@ -3948,7 +3948,7 @@ See Info node `(elisp)Splitting Windows' for more details and examples. */)
3948 p->parent = o->parent; 3948 p->parent = o->parent;
3949 p->buffer = Qt; 3949 p->buffer = Qt;
3950 p->window_end_valid = Qnil; 3950 p->window_end_valid = Qnil;
3951 bzero (&p->last_cursor, sizeof p->last_cursor); 3951 memset (&p->last_cursor, 0, sizeof p->last_cursor);
3952 3952
3953 /* Duplicate special geometry settings. */ 3953 /* Duplicate special geometry settings. */
3954 3954
diff --git a/src/xdisp.c b/src/xdisp.c
index 1ae2ce97030..545f597e7bc 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2576,7 +2576,7 @@ init_iterator (struct it *it, struct window *w,
2576 } 2576 }
2577 2577
2578 /* Clear IT. */ 2578 /* Clear IT. */
2579 bzero (it, sizeof *it); 2579 memset (it, 0, sizeof *it);
2580 it->current.overlay_string_index = -1; 2580 it->current.overlay_string_index = -1;
2581 it->current.dpvec_index = -1; 2581 it->current.dpvec_index = -1;
2582 it->base_face_id = remapped_base_face_id; 2582 it->base_face_id = remapped_base_face_id;
@@ -4912,7 +4912,7 @@ load_overlay_strings (struct it *it, int charpos)
4912 entries = \ 4912 entries = \
4913 (struct overlay_entry *) alloca (new_size \ 4913 (struct overlay_entry *) alloca (new_size \
4914 * sizeof *entries); \ 4914 * sizeof *entries); \
4915 bcopy (old, entries, size * sizeof *entries); \ 4915 memcpy (entries, old, size * sizeof *entries); \
4916 size = new_size; \ 4916 size = new_size; \
4917 } \ 4917 } \
4918 \ 4918 \
@@ -5630,7 +5630,7 @@ reseat_to_string (struct it *it, unsigned char *s, Lisp_Object string,
5630 it->stop_charpos = -1; 5630 it->stop_charpos = -1;
5631 5631
5632 /* Set iterator position and end position. */ 5632 /* Set iterator position and end position. */
5633 bzero (&it->current, sizeof it->current); 5633 memset (&it->current, 0, sizeof it->current);
5634 it->current.overlay_string_index = -1; 5634 it->current.overlay_string_index = -1;
5635 it->current.dpvec_index = -1; 5635 it->current.dpvec_index = -1;
5636 xassert (charpos >= 0); 5636 xassert (charpos >= 0);
@@ -7999,7 +7999,7 @@ add_to_log (char *format, Lisp_Object arg1, Lisp_Object arg2)
7999 7999
8000 len = SBYTES (msg) + 1; 8000 len = SBYTES (msg) + 1;
8001 SAFE_ALLOCA (buffer, char *, len); 8001 SAFE_ALLOCA (buffer, char *, len);
8002 bcopy (SDATA (msg), buffer, len); 8002 memcpy (buffer, SDATA (msg), len);
8003 8003
8004 message_dolog (buffer, len - 1, 1, 0); 8004 message_dolog (buffer, len - 1, 1, 0);
8005 SAFE_FREE (); 8005 SAFE_FREE ();
@@ -8328,7 +8328,7 @@ message3 (Lisp_Object m, int nbytes, int multibyte)
8328 USE_SAFE_ALLOCA; 8328 USE_SAFE_ALLOCA;
8329 8329
8330 SAFE_ALLOCA (buffer, char *, nbytes); 8330 SAFE_ALLOCA (buffer, char *, nbytes);
8331 bcopy (SDATA (m), buffer, nbytes); 8331 memcpy (buffer, SDATA (m), nbytes);
8332 message_dolog (buffer, nbytes, 1, multibyte); 8332 message_dolog (buffer, nbytes, 1, multibyte);
8333 SAFE_FREE (); 8333 SAFE_FREE ();
8334 } 8334 }
@@ -9754,7 +9754,7 @@ x_consider_frame_title (Lisp_Object frame)
9754 higher level than this.) */ 9754 higher level than this.) */
9755 if (! STRINGP (f->name) 9755 if (! STRINGP (f->name)
9756 || SBYTES (f->name) != len 9756 || SBYTES (f->name) != len
9757 || bcmp (title, SDATA (f->name), len) != 0) 9757 || memcmp (title, SDATA (f->name), len) != 0)
9758 x_implicitly_set_name (f, make_string (title, len), Qnil); 9758 x_implicitly_set_name (f, make_string (title, len), Qnil);
9759 } 9759 }
9760} 9760}
@@ -16763,7 +16763,7 @@ append_space_for_newline (struct it *it, int default_face_p)
16763 saved_pos = it->position; 16763 saved_pos = it->position;
16764 16764
16765 it->what = IT_CHARACTER; 16765 it->what = IT_CHARACTER;
16766 bzero (&it->position, sizeof it->position); 16766 memset (&it->position, 0, sizeof it->position);
16767 it->object = make_number (0); 16767 it->object = make_number (0);
16768 it->c = ' '; 16768 it->c = ' ';
16769 it->len = 1; 16769 it->len = 1;
@@ -16883,7 +16883,7 @@ extend_face_to_end_of_line (struct it *it)
16883 (((it->ascent + it->descent) 16883 (((it->ascent + it->descent)
16884 * FONT_BASE (font)) / FONT_HEIGHT (font)); 16884 * FONT_BASE (font)) / FONT_HEIGHT (font));
16885 saved_pos = it->position; 16885 saved_pos = it->position;
16886 bzero (&it->position, sizeof it->position); 16886 memset (&it->position, 0, sizeof it->position);
16887 saved_avoid_cursor = it->avoid_cursor_p; 16887 saved_avoid_cursor = it->avoid_cursor_p;
16888 it->avoid_cursor_p = 1; 16888 it->avoid_cursor_p = 1;
16889 saved_face_id = it->face_id; 16889 saved_face_id = it->face_id;
@@ -16916,7 +16916,7 @@ extend_face_to_end_of_line (struct it *it)
16916 saved_pos = it->position; 16916 saved_pos = it->position;
16917 16917
16918 it->what = IT_CHARACTER; 16918 it->what = IT_CHARACTER;
16919 bzero (&it->position, sizeof it->position); 16919 memset (&it->position, 0, sizeof it->position);
16920 it->object = make_number (0); 16920 it->object = make_number (0);
16921 it->c = ' '; 16921 it->c = ' ';
16922 it->len = 1; 16922 it->len = 1;
@@ -19259,7 +19259,7 @@ decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_
19259 eol_str = invalid_eol_type; 19259 eol_str = invalid_eol_type;
19260 eol_str_len = sizeof (invalid_eol_type) - 1; 19260 eol_str_len = sizeof (invalid_eol_type) - 1;
19261 } 19261 }
19262 bcopy (eol_str, buf, eol_str_len); 19262 memcpy (buf, eol_str, eol_str_len);
19263 buf += eol_str_len; 19263 buf += eol_str_len;
19264 } 19264 }
19265 19265
@@ -20397,7 +20397,7 @@ init_glyph_string (struct glyph_string *s,
20397 XChar2b *char2b, struct window *w, struct glyph_row *row, 20397 XChar2b *char2b, struct window *w, struct glyph_row *row,
20398 enum glyph_row_area area, int start, enum draw_glyphs_face hl) 20398 enum glyph_row_area area, int start, enum draw_glyphs_face hl)
20399{ 20399{
20400 bzero (s, sizeof *s); 20400 memset (s, 0, sizeof *s);
20401 s->w = w; 20401 s->w = w;
20402 s->f = XFRAME (w->frame); 20402 s->f = XFRAME (w->frame);
20403#ifdef HAVE_NTGUI 20403#ifdef HAVE_NTGUI
diff --git a/src/xfaces.c b/src/xfaces.c
index 9a6bbd18f8f..d4d68ebdbc2 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -764,7 +764,7 @@ x_create_gc (f, mask, xgcv)
764{ 764{
765 GC gc = xmalloc (sizeof (*gc)); 765 GC gc = xmalloc (sizeof (*gc));
766 if (gc) 766 if (gc)
767 bcopy (xgcv, gc, sizeof (XGCValues)); 767 memcpy (gc, xgcv, sizeof (XGCValues));
768 return gc; 768 return gc;
769} 769}
770 770
@@ -2190,8 +2190,8 @@ get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name, Lisp_Obje
2190 lface = lface_from_face_name_no_resolve (f, face_name, signal_p); 2190 lface = lface_from_face_name_no_resolve (f, face_name, signal_p);
2191 2191
2192 if (! NILP (lface)) 2192 if (! NILP (lface))
2193 bcopy (XVECTOR (lface)->contents, attrs, 2193 memcpy (attrs, XVECTOR (lface)->contents,
2194 LFACE_VECTOR_SIZE * sizeof *attrs); 2194 LFACE_VECTOR_SIZE * sizeof *attrs);
2195 2195
2196 return !NILP (lface); 2196 return !NILP (lface);
2197} 2197}
@@ -2861,8 +2861,8 @@ The value is TO. */)
2861 copy = Finternal_make_lisp_face (to, new_frame); 2861 copy = Finternal_make_lisp_face (to, new_frame);
2862 } 2862 }
2863 2863
2864 bcopy (XVECTOR (lface)->contents, XVECTOR (copy)->contents, 2864 memcpy (XVECTOR (copy)->contents, XVECTOR (lface)->contents,
2865 LFACE_VECTOR_SIZE * sizeof (Lisp_Object)); 2865 LFACE_VECTOR_SIZE * sizeof (Lisp_Object));
2866 2866
2867 /* Changing a named face means that all realized faces depending on 2867 /* Changing a named face means that all realized faces depending on
2868 that face are invalid. Since we cannot tell which realized faces 2868 that face are invalid. Since we cannot tell which realized faces
@@ -3890,9 +3890,9 @@ Default face attributes override any local face attributes. */)
3890 { 3890 {
3891 /* Ensure that the face vector is fully specified by merging 3891 /* Ensure that the face vector is fully specified by merging
3892 the previously-cached vector. */ 3892 the previously-cached vector. */
3893 bcopy (oldface->lface, attrs, sizeof attrs); 3893 memcpy (attrs, oldface->lface, sizeof attrs);
3894 merge_face_vectors (f, lvec, attrs, 0); 3894 merge_face_vectors (f, lvec, attrs, 0);
3895 bcopy (attrs, lvec, sizeof attrs); 3895 memcpy (lvec, attrs, sizeof attrs);
3896 newface = realize_face (c, lvec, DEFAULT_FACE_ID); 3896 newface = realize_face (c, lvec, DEFAULT_FACE_ID);
3897 3897
3898 if ((! UNSPECIFIEDP (gvec[LFACE_FAMILY_INDEX]) 3898 if ((! UNSPECIFIEDP (gvec[LFACE_FAMILY_INDEX])
@@ -3997,7 +3997,7 @@ face_attr_equal_p (Lisp_Object v1, Lisp_Object v2)
3997 if (SBYTES (v1) != SBYTES (v2)) 3997 if (SBYTES (v1) != SBYTES (v2))
3998 return 0; 3998 return 0;
3999 3999
4000 return bcmp (SDATA (v1), SDATA (v2), SBYTES (v1)) == 0; 4000 return memcmp (SDATA (v1), SDATA (v2), SBYTES (v1)) == 0;
4001 4001
4002 case_Lisp_Int: 4002 case_Lisp_Int:
4003 case Lisp_Symbol: 4003 case Lisp_Symbol:
@@ -4169,9 +4169,9 @@ static struct face *
4169make_realized_face (Lisp_Object *attr) 4169make_realized_face (Lisp_Object *attr)
4170{ 4170{
4171 struct face *face = (struct face *) xmalloc (sizeof *face); 4171 struct face *face = (struct face *) xmalloc (sizeof *face);
4172 bzero (face, sizeof *face); 4172 memset (face, 0, sizeof *face);
4173 face->ascii_face = face; 4173 face->ascii_face = face;
4174 bcopy (attr, face->lface, sizeof face->lface); 4174 memcpy (face->lface, attr, sizeof face->lface);
4175 return face; 4175 return face;
4176} 4176}
4177 4177
@@ -4316,10 +4316,10 @@ make_face_cache (struct frame *f)
4316 int size; 4316 int size;
4317 4317
4318 c = (struct face_cache *) xmalloc (sizeof *c); 4318 c = (struct face_cache *) xmalloc (sizeof *c);
4319 bzero (c, sizeof *c); 4319 memset (c, 0, sizeof *c);
4320 size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets; 4320 size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
4321 c->buckets = (struct face **) xmalloc (size); 4321 c->buckets = (struct face **) xmalloc (size);
4322 bzero (c->buckets, size); 4322 memset (c->buckets, 0, size);
4323 c->size = 50; 4323 c->size = 50;
4324 c->faces_by_id = (struct face **) xmalloc (c->size * sizeof *c->faces_by_id); 4324 c->faces_by_id = (struct face **) xmalloc (c->size * sizeof *c->faces_by_id);
4325 c->f = f; 4325 c->f = f;
@@ -4383,7 +4383,7 @@ free_realized_faces (struct face_cache *c)
4383 4383
4384 c->used = 0; 4384 c->used = 0;
4385 size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets; 4385 size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
4386 bzero (c->buckets, size); 4386 memset (c->buckets, 0, size);
4387 4387
4388 /* Must do a thorough redisplay the next time. Mark current 4388 /* Must do a thorough redisplay the next time. Mark current
4389 matrices as invalid because they will reference faces freed 4389 matrices as invalid because they will reference faces freed
@@ -4680,7 +4680,7 @@ lookup_named_face (struct frame *f, Lisp_Object symbol, int signal_p)
4680 if (! get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0)) 4680 if (! get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
4681 return -1; 4681 return -1;
4682 4682
4683 bcopy (default_face->lface, attrs, sizeof attrs); 4683 memcpy (attrs, default_face->lface, sizeof attrs);
4684 merge_face_vectors (f, symbol_attrs, attrs, 0); 4684 merge_face_vectors (f, symbol_attrs, attrs, 0);
4685 4685
4686 return lookup_face (f, attrs); 4686 return lookup_face (f, attrs);
@@ -4781,7 +4781,7 @@ smaller_face (struct frame *f, int face_id, int steps)
4781 steps = eabs (steps); 4781 steps = eabs (steps);
4782 4782
4783 face = FACE_FROM_ID (f, face_id); 4783 face = FACE_FROM_ID (f, face_id);
4784 bcopy (face->lface, attrs, sizeof attrs); 4784 memcpy (attrs, face->lface, sizeof attrs);
4785 pt = last_pt = XFASTINT (attrs[LFACE_HEIGHT_INDEX]); 4785 pt = last_pt = XFASTINT (attrs[LFACE_HEIGHT_INDEX]);
4786 new_face_id = face_id; 4786 new_face_id = face_id;
4787 last_height = FONT_HEIGHT (face->font); 4787 last_height = FONT_HEIGHT (face->font);
@@ -4832,7 +4832,7 @@ face_with_height (struct frame *f, int face_id, int height)
4832 return face_id; 4832 return face_id;
4833 4833
4834 face = FACE_FROM_ID (f, face_id); 4834 face = FACE_FROM_ID (f, face_id);
4835 bcopy (face->lface, attrs, sizeof attrs); 4835 memcpy (attrs, face->lface, sizeof attrs);
4836 attrs[LFACE_HEIGHT_INDEX] = make_number (height); 4836 attrs[LFACE_HEIGHT_INDEX] = make_number (height);
4837 font_clear_prop (attrs, FONT_SIZE_INDEX); 4837 font_clear_prop (attrs, FONT_SIZE_INDEX);
4838 face_id = lookup_face (f, attrs); 4838 face_id = lookup_face (f, attrs);
@@ -4862,7 +4862,7 @@ lookup_derived_face (struct frame *f, Lisp_Object symbol, int face_id, int signa
4862 if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0)) 4862 if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
4863 return -1; 4863 return -1;
4864 4864
4865 bcopy (default_face->lface, attrs, sizeof attrs); 4865 memcpy (attrs, default_face->lface, sizeof attrs);
4866 merge_face_vectors (f, symbol_attrs, attrs, 0); 4866 merge_face_vectors (f, symbol_attrs, attrs, 0);
4867 return lookup_face (f, attrs); 4867 return lookup_face (f, attrs);
4868} 4868}
@@ -4953,7 +4953,7 @@ x_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, struct face *
4953 Lisp_Object merged_attrs[LFACE_VECTOR_SIZE]; 4953 Lisp_Object merged_attrs[LFACE_VECTOR_SIZE];
4954 int i; 4954 int i;
4955 4955
4956 bcopy (def_attrs, merged_attrs, sizeof merged_attrs); 4956 memcpy (merged_attrs, def_attrs, sizeof merged_attrs);
4957 4957
4958 merge_face_vectors (f, attrs, merged_attrs, 0); 4958 merge_face_vectors (f, attrs, merged_attrs, 0);
4959 4959
@@ -5274,7 +5274,7 @@ Value is ORDER. */)
5274 int indices[DIM (font_sort_order)]; 5274 int indices[DIM (font_sort_order)];
5275 5275
5276 CHECK_LIST (order); 5276 CHECK_LIST (order);
5277 bzero (indices, sizeof indices); 5277 memset (indices, 0, sizeof indices);
5278 i = 0; 5278 i = 0;
5279 5279
5280 for (list = order; 5280 for (list = order;
@@ -5306,9 +5306,9 @@ Value is ORDER. */)
5306 if (indices[i] == 0) 5306 if (indices[i] == 0)
5307 signal_error ("Invalid font sort order", order); 5307 signal_error ("Invalid font sort order", order);
5308 5308
5309 if (bcmp (indices, font_sort_order, sizeof indices) != 0) 5309 if (memcmp (indices, font_sort_order, sizeof indices) != 0)
5310 { 5310 {
5311 bcopy (indices, font_sort_order, sizeof font_sort_order); 5311 memcpy (font_sort_order, indices, sizeof font_sort_order);
5312 free_all_realized_faces (Qnil); 5312 free_all_realized_faces (Qnil);
5313 } 5313 }
5314 5314
@@ -5553,7 +5553,7 @@ realize_default_face (struct frame *f)
5553 /* Realize the face; it must be fully-specified now. */ 5553 /* Realize the face; it must be fully-specified now. */
5554 xassert (lface_fully_specified_p (XVECTOR (lface)->contents)); 5554 xassert (lface_fully_specified_p (XVECTOR (lface)->contents));
5555 check_lface (lface); 5555 check_lface (lface);
5556 bcopy (XVECTOR (lface)->contents, attrs, sizeof attrs); 5556 memcpy (attrs, XVECTOR (lface)->contents, sizeof attrs);
5557 face = realize_face (c, attrs, DEFAULT_FACE_ID); 5557 face = realize_face (c, attrs, DEFAULT_FACE_ID);
5558 5558
5559#ifdef HAVE_WINDOW_SYSTEM 5559#ifdef HAVE_WINDOW_SYSTEM
@@ -6074,7 +6074,7 @@ compute_char_face (struct frame *f, int ch, Lisp_Object prop)
6074 { 6074 {
6075 Lisp_Object attrs[LFACE_VECTOR_SIZE]; 6075 Lisp_Object attrs[LFACE_VECTOR_SIZE];
6076 struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); 6076 struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
6077 bcopy (default_face->lface, attrs, sizeof attrs); 6077 memcpy (attrs, default_face->lface, sizeof attrs);
6078 merge_face_ref (f, prop, attrs, 1, 0); 6078 merge_face_ref (f, prop, attrs, 1, 0);
6079 face_id = lookup_face (f, attrs); 6079 face_id = lookup_face (f, attrs);
6080 } 6080 }
@@ -6163,7 +6163,7 @@ face_at_buffer_position (w, pos, region_beg, region_end,
6163 return default_face->id; 6163 return default_face->id;
6164 6164
6165 /* Begin with attributes from the default face. */ 6165 /* Begin with attributes from the default face. */
6166 bcopy (default_face->lface, attrs, sizeof attrs); 6166 memcpy (attrs, default_face->lface, sizeof attrs);
6167 6167
6168 /* Merge in attributes specified via text properties. */ 6168 /* Merge in attributes specified via text properties. */
6169 if (!NILP (prop)) 6169 if (!NILP (prop))
@@ -6257,7 +6257,7 @@ face_for_overlay_string (w, pos, region_beg, region_end,
6257 return DEFAULT_FACE_ID; 6257 return DEFAULT_FACE_ID;
6258 6258
6259 /* Begin with attributes from the default face. */ 6259 /* Begin with attributes from the default face. */
6260 bcopy (default_face->lface, attrs, sizeof attrs); 6260 memcpy (attrs, default_face->lface, sizeof attrs);
6261 6261
6262 /* Merge in attributes specified via text properties. */ 6262 /* Merge in attributes specified via text properties. */
6263 if (!NILP (prop)) 6263 if (!NILP (prop))
@@ -6358,7 +6358,7 @@ face_at_string_position (w, string, pos, bufpos, region_beg,
6358 return base_face->id; 6358 return base_face->id;
6359 6359
6360 /* Begin with attributes from the base face. */ 6360 /* Begin with attributes from the base face. */
6361 bcopy (base_face->lface, attrs, sizeof attrs); 6361 memcpy (attrs, base_face->lface, sizeof attrs);
6362 6362
6363 /* Merge in attributes specified via text properties. */ 6363 /* Merge in attributes specified via text properties. */
6364 if (!NILP (prop)) 6364 if (!NILP (prop))
@@ -6413,7 +6413,7 @@ merge_faces (struct frame *f, Lisp_Object face_name, int face_id, int base_face_
6413 } 6413 }
6414 6414
6415 /* Begin with attributes from the base face. */ 6415 /* Begin with attributes from the base face. */
6416 bcopy (base_face->lface, attrs, sizeof attrs); 6416 memcpy (attrs, base_face->lface, sizeof attrs);
6417 6417
6418 if (!NILP (face_name)) 6418 if (!NILP (face_name))
6419 { 6419 {
diff --git a/src/xfns.c b/src/xfns.c
index bf312705229..d6df2e2f836 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1925,7 +1925,7 @@ xic_create_fontsetname (char *base_fontname, int motif)
1925 { /* There is no base font name, use the default. */ 1925 { /* There is no base font name, use the default. */
1926 int len = strlen (base_fontname) + 2; 1926 int len = strlen (base_fontname) + 2;
1927 fontsetname = xmalloc (len); 1927 fontsetname = xmalloc (len);
1928 bzero (fontsetname, len); 1928 memset (fontsetname, 0, len);
1929 strcpy (fontsetname, base_fontname); 1929 strcpy (fontsetname, base_fontname);
1930 } 1930 }
1931 else 1931 else
@@ -1946,7 +1946,7 @@ xic_create_fontsetname (char *base_fontname, int motif)
1946 Use the specified font plus the default. */ 1946 Use the specified font plus the default. */
1947 int len = strlen (base_fontname) + strlen (xic_defaut_fontset) + 3; 1947 int len = strlen (base_fontname) + strlen (xic_defaut_fontset) + 3;
1948 fontsetname = xmalloc (len); 1948 fontsetname = xmalloc (len);
1949 bzero (fontsetname, len); 1949 memset (fontsetname, 0, len);
1950 strcpy (fontsetname, base_fontname); 1950 strcpy (fontsetname, base_fontname);
1951 strcat (fontsetname, sep); 1951 strcat (fontsetname, sep);
1952 strcat (fontsetname, xic_defaut_fontset); 1952 strcat (fontsetname, xic_defaut_fontset);
@@ -1983,7 +1983,7 @@ xic_create_fontsetname (char *base_fontname, int motif)
1983 int diff = (p2 - p3) - 2; 1983 int diff = (p2 - p3) - 2;
1984 1984
1985 base = alloca (strlen (base_fontname) + 1); 1985 base = alloca (strlen (base_fontname) + 1);
1986 bcopy (base_fontname, base, p3 - base_fontname); 1986 memcpy (base, base_fontname, p3 - base_fontname);
1987 base[p3 - base_fontname] = '*'; 1987 base[p3 - base_fontname] = '*';
1988 base[(p3 - base_fontname) + 1] = '-'; 1988 base[(p3 - base_fontname) + 1] = '-';
1989 strcpy (base + (p3 - base_fontname) + 2, p2); 1989 strcpy (base + (p3 - base_fontname) + 2, p2);
@@ -1996,33 +1996,33 @@ xic_create_fontsetname (char *base_fontname, int motif)
1996 /* Build the font spec that matches all charsets. */ 1996 /* Build the font spec that matches all charsets. */
1997 len = p - base_fontname + strlen (allcs) + 1; 1997 len = p - base_fontname + strlen (allcs) + 1;
1998 font_allcs = (char *) alloca (len); 1998 font_allcs = (char *) alloca (len);
1999 bzero (font_allcs, len); 1999 memset (font_allcs, 0, len);
2000 bcopy (base_fontname, font_allcs, p - base_fontname); 2000 memcpy (font_allcs, base_fontname, p - base_fontname);
2001 strcat (font_allcs, allcs); 2001 strcat (font_allcs, allcs);
2002 2002
2003 /* Build the font spec that matches all families and 2003 /* Build the font spec that matches all families and
2004 add-styles. */ 2004 add-styles. */
2005 len = p - p1 + strlen (allcs) + strlen (allfamilies) + 1; 2005 len = p - p1 + strlen (allcs) + strlen (allfamilies) + 1;
2006 font_allfamilies = (char *) alloca (len); 2006 font_allfamilies = (char *) alloca (len);
2007 bzero (font_allfamilies, len); 2007 memset (font_allfamilies, 0, len);
2008 strcpy (font_allfamilies, allfamilies); 2008 strcpy (font_allfamilies, allfamilies);
2009 bcopy (p1, font_allfamilies + strlen (allfamilies), p - p1); 2009 memcpy (font_allfamilies + strlen (allfamilies), p1, p - p1);
2010 strcat (font_allfamilies, allcs); 2010 strcat (font_allfamilies, allcs);
2011 2011
2012 /* Build the font spec that matches all. */ 2012 /* Build the font spec that matches all. */
2013 len = p - p2 + strlen (allcs) + strlen (all) + strlen (allfamilies) + 1; 2013 len = p - p2 + strlen (allcs) + strlen (all) + strlen (allfamilies) + 1;
2014 font_all = (char *) alloca (len); 2014 font_all = (char *) alloca (len);
2015 bzero (font_all, len); 2015 memset (font_all, 0, len);
2016 strcpy (font_all, allfamilies); 2016 strcpy (font_all, allfamilies);
2017 strcat (font_all, all); 2017 strcat (font_all, all);
2018 bcopy (p2, font_all + strlen (all) + strlen (allfamilies), p - p2); 2018 memcpy (font_all + strlen (all) + strlen (allfamilies), p2, p - p2);
2019 strcat (font_all, allcs); 2019 strcat (font_all, allcs);
2020 2020
2021 /* Build the actual font set name. */ 2021 /* Build the actual font set name. */
2022 len = strlen (base_fontname) + strlen (font_allcs) 2022 len = strlen (base_fontname) + strlen (font_allcs)
2023 + strlen (font_allfamilies) + strlen (font_all) + 5; 2023 + strlen (font_allfamilies) + strlen (font_all) + 5;
2024 fontsetname = xmalloc (len); 2024 fontsetname = xmalloc (len);
2025 bzero (fontsetname, len); 2025 memset (fontsetname, 0, len);
2026 strcpy (fontsetname, base_fontname); 2026 strcpy (fontsetname, base_fontname);
2027 strcat (fontsetname, sep); 2027 strcat (fontsetname, sep);
2028 strcat (fontsetname, font_allcs); 2028 strcat (fontsetname, font_allcs);
@@ -3194,7 +3194,7 @@ This function is an internal primitive--use `make-frame' instead. */)
3194 3194
3195 f->output_method = output_x_window; 3195 f->output_method = output_x_window;
3196 f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output)); 3196 f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output));
3197 bzero (f->output_data.x, sizeof (struct x_output)); 3197 memset (f->output_data.x, 0, sizeof (struct x_output));
3198 f->output_data.x->icon_bitmap = -1; 3198 f->output_data.x->icon_bitmap = -1;
3199 FRAME_FONTSET (f) = -1; 3199 FRAME_FONTSET (f) = -1;
3200 f->output_data.x->scroll_bar_foreground_pixel = -1; 3200 f->output_data.x->scroll_bar_foreground_pixel = -1;
@@ -4431,7 +4431,7 @@ no value of TYPE. */)
4431 elements." 4431 elements."
4432 This applies even if long is more than 32 bits, the X library 4432 This applies even if long is more than 32 bits, the X library
4433 converts from 32 bit elements received from the X server to long 4433 converts from 32 bit elements received from the X server to long
4434 and passes the long array to us. Thus, for that case bcopy can not 4434 and passes the long array to us. Thus, for that case memcpy can not
4435 be used. We convert to a 32 bit type here, because so much code 4435 be used. We convert to a 32 bit type here, because so much code
4436 assume on that. 4436 assume on that.
4437 4437
@@ -4687,7 +4687,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object parms, Lisp_Obje
4687 counts etc. */ 4687 counts etc. */
4688 f->output_method = output_x_window; 4688 f->output_method = output_x_window;
4689 f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output)); 4689 f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output));
4690 bzero (f->output_data.x, sizeof (struct x_output)); 4690 memset (f->output_data.x, 0, sizeof (struct x_output));
4691 f->output_data.x->icon_bitmap = -1; 4691 f->output_data.x->icon_bitmap = -1;
4692 FRAME_FONTSET (f) = -1; 4692 FRAME_FONTSET (f) = -1;
4693 f->output_data.x->scroll_bar_foreground_pixel = -1; 4693 f->output_data.x->scroll_bar_foreground_pixel = -1;
@@ -5729,9 +5729,9 @@ present and mapped to the usual X keysyms. */)
5729 /* The XKB symbolic key names can be seen most easily in 5729 /* The XKB symbolic key names can be seen most easily in
5730 the PS file generated by `xkbprint -label name 5730 the PS file generated by `xkbprint -label name
5731 $DISPLAY'. */ 5731 $DISPLAY'. */
5732 if (bcmp ("DELE", kb->names->keys[i].name, 4) == 0) 5732 if (memcmp ("DELE", kb->names->keys[i].name, 4) == 0)
5733 delete_keycode = i; 5733 delete_keycode = i;
5734 else if (bcmp ("BKSP", kb->names->keys[i].name, 4) == 0) 5734 else if (memcmp ("BKSP", kb->names->keys[i].name, 4) == 0)
5735 backspace_keycode = i; 5735 backspace_keycode = i;
5736 } 5736 }
5737 5737
diff --git a/src/xfont.c b/src/xfont.c
index b1e793de808..b03bb1585d3 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -562,7 +562,7 @@ xfont_list (Lisp_Object frame, Lisp_Object spec)
562 val = assq_no_quit (QCname, AREF (spec, FONT_EXTRA_INDEX)); 562 val = assq_no_quit (QCname, AREF (spec, FONT_EXTRA_INDEX));
563 if (CONSP (val) && STRINGP (XCDR (val)) && SBYTES (XCDR (val)) < 512) 563 if (CONSP (val) && STRINGP (XCDR (val)) && SBYTES (XCDR (val)) < 512)
564 { 564 {
565 bcopy (SDATA (XCDR (val)), name, SBYTES (XCDR (val)) + 1); 565 memcpy (name, SDATA (XCDR (val)), SBYTES (XCDR (val)) + 1);
566 if (xfont_encode_coding_xlfd (name) < 0) 566 if (xfont_encode_coding_xlfd (name) < 0)
567 return Qnil; 567 return Qnil;
568 list = xfont_list_pattern (display, name, registry, script); 568 list = xfont_list_pattern (display, name, registry, script);
@@ -590,7 +590,7 @@ xfont_match (Lisp_Object frame, Lisp_Object spec)
590 return Qnil; 590 return Qnil;
591 } 591 }
592 else if (SBYTES (XCDR (val)) < 512) 592 else if (SBYTES (XCDR (val)) < 512)
593 bcopy (SDATA (XCDR (val)), name, SBYTES (XCDR (val)) + 1); 593 memcpy (name, SDATA (XCDR (val)), SBYTES (XCDR (val)) + 1);
594 else 594 else
595 return Qnil; 595 return Qnil;
596 if (xfont_encode_coding_xlfd (name) < 0) 596 if (xfont_encode_coding_xlfd (name) < 0)
@@ -669,7 +669,7 @@ xfont_list_family (Lisp_Object frame)
669 if (! *p1 || p1 == p0) 669 if (! *p1 || p1 == p0)
670 continue; 670 continue;
671 if (last_len == p1 - p0 671 if (last_len == p1 - p0
672 && bcmp (last_family, p0, last_len) == 0) 672 && memcmp (last_family, p0, last_len) == 0)
673 continue; 673 continue;
674 last_len = p1 - p0; 674 last_len = p1 - p0;
675 last_family = p0; 675 last_family = p0;
@@ -980,7 +980,7 @@ xfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct f
980 int i, first, x; 980 int i, first, x;
981 981
982 if (metrics) 982 if (metrics)
983 bzero (metrics, sizeof (struct font_metrics)); 983 memset (metrics, 0, sizeof (struct font_metrics));
984 for (i = 0, x = 0, first = 1; i < nglyphs; i++) 984 for (i = 0, x = 0, first = 1; i < nglyphs; i++)
985 { 985 {
986 XChar2b char2b; 986 XChar2b char2b;
diff --git a/src/xmenu.c b/src/xmenu.c
index deb7c091877..701433e7907 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1067,8 +1067,8 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1067 1067
1068 /* Save the frame's previous menu bar contents data. */ 1068 /* Save the frame's previous menu bar contents data. */
1069 if (previous_menu_items_used) 1069 if (previous_menu_items_used)
1070 bcopy (XVECTOR (f->menu_bar_vector)->contents, previous_items, 1070 memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents,
1071 previous_menu_items_used * sizeof (Lisp_Object)); 1071 previous_menu_items_used * sizeof (Lisp_Object));
1072 1072
1073 /* Fill in menu_items with the current menu bar contents. 1073 /* Fill in menu_items with the current menu bar contents.
1074 This can evaluate Lisp code. */ 1074 This can evaluate Lisp code. */
@@ -2452,12 +2452,10 @@ xmenu_show (f, x, y, for_click, keymaps, title, error, timestamp)
2452 item_data 2452 item_data
2453 = (unsigned char *) alloca (maxwidth 2453 = (unsigned char *) alloca (maxwidth
2454 + SBYTES (descrip) + 1); 2454 + SBYTES (descrip) + 1);
2455 bcopy (SDATA (item_name), item_data, 2455 memcpy (item_data, SDATA (item_name), SBYTES (item_name));
2456 SBYTES (item_name));
2457 for (j = SCHARS (item_name); j < maxwidth; j++) 2456 for (j = SCHARS (item_name); j < maxwidth; j++)
2458 item_data[j] = ' '; 2457 item_data[j] = ' ';
2459 bcopy (SDATA (descrip), item_data + j, 2458 memcpy (item_data + j, SDATA (descrip), SBYTES (descrip));
2460 SBYTES (descrip));
2461 item_data[j + SBYTES (descrip)] = 0; 2459 item_data[j + SBYTES (descrip)] = 0;
2462 } 2460 }
2463 else 2461 else
diff --git a/src/xrdb.c b/src/xrdb.c
index f9033f22e7f..513768e3cde 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -233,7 +233,7 @@ magic_file_p (char *string, int string_len, char *class, char *escaped_suffix, c
233 path = (char *) realloc (path, path_size); 233 path = (char *) realloc (path, path_size);
234 } 234 }
235 235
236 bcopy (next, path + path_len, next_len); 236 memcpy (path + path_len, next, next_len);
237 path_len += next_len; 237 path_len += next_len;
238 238
239 p++; 239 p++;
@@ -259,7 +259,7 @@ magic_file_p (char *string, int string_len, char *class, char *escaped_suffix, c
259 path = (char *) realloc (path, path_size); 259 path = (char *) realloc (path, path_size);
260 } 260 }
261 261
262 bcopy (suffix, path + path_len, suffix_len); 262 memcpy (path + path_len, suffix, suffix_len);
263 path_len += suffix_len; 263 path_len += suffix_len;
264 } 264 }
265 265
@@ -644,7 +644,7 @@ x_get_resource (XrmDatabase rdb, char *name, char *class, XrmRepresentation expe
644 if (type == x_rm_string) 644 if (type == x_rm_string)
645 ret_value->addr = (char *) value.addr; 645 ret_value->addr = (char *) value.addr;
646 else 646 else
647 bcopy (value.addr, ret_value->addr, ret_value->size); 647 memcpy (ret_value->addr, value.addr, ret_value->size);
648 648
649 return value.size; 649 return value.size;
650 } 650 }
diff --git a/src/xselect.c b/src/xselect.c
index 6d076235316..df260e3d8f1 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -191,7 +191,7 @@ x_queue_event (struct input_event *event)
191 This only happens for large requests which uses the incremental protocol. */ 191 This only happens for large requests which uses the incremental protocol. */
192 for (queue_tmp = selection_queue; queue_tmp; queue_tmp = queue_tmp->next) 192 for (queue_tmp = selection_queue; queue_tmp; queue_tmp = queue_tmp->next)
193 { 193 {
194 if (!bcmp (&queue_tmp->event, event, sizeof (*event))) 194 if (!memcmp (&queue_tmp->event, event, sizeof (*event)))
195 { 195 {
196 TRACE1 ("DECLINE DUP SELECTION EVENT %08lx", (unsigned long)queue_tmp); 196 TRACE1 ("DECLINE DUP SELECTION EVENT %08lx", (unsigned long)queue_tmp);
197 x_decline_selection_request (event); 197 x_decline_selection_request (event);
@@ -1534,7 +1534,7 @@ x_get_window_property (display, window, property, data_ret, bytes_ret,
1534 elements." 1534 elements."
1535 This applies even if long is more than 32 bits, the X library 1535 This applies even if long is more than 32 bits, the X library
1536 converts from 32 bit elements received from the X server to long 1536 converts from 32 bit elements received from the X server to long
1537 and passes the long array to us. Thus, for that case bcopy can not 1537 and passes the long array to us. Thus, for that case memcpy can not
1538 be used. We convert to a 32 bit type here, because so much code 1538 be used. We convert to a 32 bit type here, because so much code
1539 assume on that. 1539 assume on that.
1540 1540
@@ -1556,7 +1556,7 @@ x_get_window_property (display, window, property, data_ret, bytes_ret,
1556 else 1556 else
1557 { 1557 {
1558 *actual_size_ret *= *actual_format_ret / 8; 1558 *actual_size_ret *= *actual_format_ret / 8;
1559 bcopy (tmp_data, (*data_ret) + offset, *actual_size_ret); 1559 memcpy ((*data_ret) + offset, tmp_data, *actual_size_ret);
1560 offset += *actual_size_ret; 1560 offset += *actual_size_ret;
1561 } 1561 }
1562 1562
@@ -1658,7 +1658,7 @@ receive_incremental_selection (display, window, property, target_type,
1658 *data_ret = (unsigned char *) xrealloc (*data_ret, *size_bytes_ret); 1658 *data_ret = (unsigned char *) xrealloc (*data_ret, *size_bytes_ret);
1659 } 1659 }
1660 1660
1661 bcopy (tmp_data, (*data_ret) + offset, tmp_size_bytes); 1661 memcpy ((*data_ret) + offset, tmp_data, tmp_size_bytes);
1662 offset += tmp_size_bytes; 1662 offset += tmp_size_bytes;
1663 1663
1664 /* Use xfree, not XFree, because x_get_window_property 1664 /* Use xfree, not XFree, because x_get_window_property
diff --git a/src/xsmfns.c b/src/xsmfns.c
index 2ebd4a45c41..29e48e8f22e 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -154,7 +154,7 @@ x_session_check_input (struct input_event *bufp)
154 /* Check if smc_interact_CB was called and we shall generate a 154 /* Check if smc_interact_CB was called and we shall generate a
155 SAVE_SESSION_EVENT. */ 155 SAVE_SESSION_EVENT. */
156 if (emacs_event.kind != NO_EVENT) 156 if (emacs_event.kind != NO_EVENT)
157 bcopy (&emacs_event, bufp, sizeof (struct input_event)); 157 memcpy (bufp, &emacs_event, sizeof (struct input_event));
158 158
159 return emacs_event.kind != NO_EVENT ? 1 : 0; 159 return emacs_event.kind != NO_EVENT ? 1 : 0;
160} 160}
diff --git a/src/xterm.c b/src/xterm.c
index 49c2ed6299d..d1bf9eaa5ea 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -4131,7 +4131,7 @@ x_send_scroll_bar_event (Lisp_Object window, int part, int portion, int whole)
4131 4131
4132 scroll_bar_windows = (struct window **) xrealloc (scroll_bar_windows, 4132 scroll_bar_windows = (struct window **) xrealloc (scroll_bar_windows,
4133 nbytes); 4133 nbytes);
4134 bzero (&scroll_bar_windows[i], nbytes - old_nbytes); 4134 memset (&scroll_bar_windows[i], 0, nbytes - old_nbytes);
4135 scroll_bar_windows_size = new_size; 4135 scroll_bar_windows_size = new_size;
4136 } 4136 }
4137 4137
@@ -5608,7 +5608,7 @@ static struct x_display_info *next_noop_dpyinfo;
5608 if (f->output_data.x->saved_menu_event == 0) \ 5608 if (f->output_data.x->saved_menu_event == 0) \
5609 f->output_data.x->saved_menu_event \ 5609 f->output_data.x->saved_menu_event \
5610 = (XEvent *) xmalloc (sizeof (XEvent)); \ 5610 = (XEvent *) xmalloc (sizeof (XEvent)); \
5611 bcopy (&event, f->output_data.x->saved_menu_event, size); \ 5611 memcpy (f->output_data.x->saved_menu_event, &event, size); \
5612 inev.ie.kind = MENU_BAR_ACTIVATE_EVENT; \ 5612 inev.ie.kind = MENU_BAR_ACTIVATE_EVENT; \
5613 XSETFRAME (inev.ie.frame_or_window, f); \ 5613 XSETFRAME (inev.ie.frame_or_window, f); \
5614 } \ 5614 } \
@@ -6245,7 +6245,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6245 this enables ComposeCharacter to work whether or 6245 this enables ComposeCharacter to work whether or
6246 not it is combined with Meta. */ 6246 not it is combined with Meta. */
6247 if (modifiers & dpyinfo->meta_mod_mask) 6247 if (modifiers & dpyinfo->meta_mod_mask)
6248 bzero (&compose_status, sizeof (compose_status)); 6248 memset (&compose_status, 0, sizeof (compose_status));
6249 6249
6250#ifdef HAVE_X_I18N 6250#ifdef HAVE_X_I18N
6251 if (FRAME_XIC (f)) 6251 if (FRAME_XIC (f))
@@ -6293,7 +6293,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6293 if (compose_status.chars_matched > 0 && nbytes == 0) 6293 if (compose_status.chars_matched > 0 && nbytes == 0)
6294 break; 6294 break;
6295 6295
6296 bzero (&compose_status, sizeof (compose_status)); 6296 memset (&compose_status, 0, sizeof (compose_status));
6297 orig_keysym = keysym; 6297 orig_keysym = keysym;
6298 6298
6299 /* Common for all keysym input events. */ 6299 /* Common for all keysym input events. */
@@ -6707,7 +6707,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6707 by the rest of Emacs, we put it here. */ 6707 by the rest of Emacs, we put it here. */
6708 int tool_bar_p = 0; 6708 int tool_bar_p = 0;
6709 6709
6710 bzero (&compose_status, sizeof (compose_status)); 6710 memset (&compose_status, 0, sizeof (compose_status));
6711 last_mouse_glyph_frame = 0; 6711 last_mouse_glyph_frame = 0;
6712 last_user_time = event.xbutton.time; 6712 last_user_time = event.xbutton.time;
6713 6713
@@ -7553,7 +7553,7 @@ x_check_errors (Display *dpy, char *format)
7553 if (x_error_message->string[0]) 7553 if (x_error_message->string[0])
7554 { 7554 {
7555 char string[X_ERROR_MESSAGE_SIZE]; 7555 char string[X_ERROR_MESSAGE_SIZE];
7556 bcopy (x_error_message->string, string, X_ERROR_MESSAGE_SIZE); 7556 memcpy (string, x_error_message->string, X_ERROR_MESSAGE_SIZE);
7557 x_uncatch_errors (); 7557 x_uncatch_errors ();
7558 error (format, string); 7558 error (format, string);
7559 } 7559 }
@@ -8077,7 +8077,7 @@ xim_initialize (struct x_display_info *dpyinfo, char *resource_name)
8077 xim_inst->dpyinfo = dpyinfo; 8077 xim_inst->dpyinfo = dpyinfo;
8078 len = strlen (resource_name); 8078 len = strlen (resource_name);
8079 xim_inst->resource_name = (char *) xmalloc (len + 1); 8079 xim_inst->resource_name = (char *) xmalloc (len + 1);
8080 bcopy (resource_name, xim_inst->resource_name, len + 1); 8080 memcpy (xim_inst->resource_name, resource_name, len + 1);
8081 XRegisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, 8081 XRegisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb,
8082 resource_name, EMACS_CLASS, 8082 resource_name, EMACS_CLASS,
8083 xim_instantiate_callback, 8083 xim_instantiate_callback,
@@ -9929,7 +9929,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9929 /* We have definitely succeeded. Record the new connection. */ 9929 /* We have definitely succeeded. Record the new connection. */
9930 9930
9931 dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info)); 9931 dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info));
9932 bzero (dpyinfo, sizeof *dpyinfo); 9932 memset (dpyinfo, 0, sizeof *dpyinfo);
9933 9933
9934 terminal = x_create_terminal (dpyinfo); 9934 terminal = x_create_terminal (dpyinfo);
9935 9935