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.
This commit is contained in:
Andreas Schwab 2010-07-08 00:18:28 +02:00
parent cb768704a4
commit 72af86bd8c
92 changed files with 801 additions and 761 deletions

View file

@ -1,3 +1,8 @@
2010-07-07 Andreas Schwab <schwab@linux-m68k.org>
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-07 Dan Nicolaescu <dann@ics.uci.edu> 2010-07-07 Dan Nicolaescu <dann@ics.uci.edu>
* configure.in (getenv): Remove K&R declaration. * configure.in (getenv): Remove K&R declaration.

View file

@ -79,8 +79,6 @@ USER_FULL_NAME If defined, overrides the default pw->pw_gecos for getting at t
AIX AIX
AMPERSAND_FULL_NAME AMPERSAND_FULL_NAME
BCOPY_DOWNWARD_SAFE
BCOPY_UPWARD_SAFE
BITS_PER_EMACS_INT BITS_PER_EMACS_INT
BITS_PER_LONG BITS_PER_LONG
BITS_PER_CHAR BITS_PER_CHAR
@ -118,7 +116,6 @@ EMACS_UINT
FILE_SYSTEM_CASE FILE_SYSTEM_CASE
FLOAT_CHECK_DOMAIN FLOAT_CHECK_DOMAIN
FSCALE FSCALE
GAP_USE_BCOPY
GC_LISP_OBJECT_ALIGNMENT GC_LISP_OBJECT_ALIGNMENT
GC_MARK_SECONDARY_STACK GC_MARK_SECONDARY_STACK
GC_MARK_STACK GC_MARK_STACK
@ -128,8 +125,6 @@ GNU_LIBRARY_PENDING_OUTPUT_COUNT
GNU_LINUX GNU_LINUX
GNU_MALLOC GNU_MALLOC
HAVE_AIX_SMT_EXP HAVE_AIX_SMT_EXP
HAVE_BCMP
HAVE_BCOPY
HAVE_CBRT HAVE_CBRT
HAVE_CLOSEDIR HAVE_CLOSEDIR
HAVE_DUP2 HAVE_DUP2
@ -319,10 +314,7 @@ _start
abort abort
access access
alloca alloca
bcmp
bcopy
brk brk
bzero
calloc calloc
chdir chdir
chmod chmod

View file

@ -1,3 +1,9 @@
2010-07-07 Andreas Schwab <schwab@linux-m68k.org>
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
2010-06-12 Eli Zaretskii <eliz@gnu.org> 2010-06-12 Eli Zaretskii <eliz@gnu.org>
* unidata/bidimirror.awk: New file. * unidata/bidimirror.awk: New file.

4
configure vendored
View file

@ -11168,12 +11168,12 @@ esac
for ac_func in gethostname getdomainname dup2 \ for ac_func in gethostname getdomainname dup2 \
rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \ rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \
random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime setsid \ random lrand48 logb frexp fmod rint cbrt ftime setsid \
strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \ strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \
utimes getrlimit setrlimit setpgid getcwd getwd shutdown getaddrinfo \ utimes getrlimit setrlimit setpgid getcwd getwd shutdown getaddrinfo \
__fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \ __fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \
sendto recvfrom getsockopt setsockopt getsockname getpeername \ sendto recvfrom getsockopt setsockopt getsockname getpeername \
gai_strerror mkstemp getline getdelim mremap memmove fsync sync bzero \ gai_strerror mkstemp getline getdelim mremap memmove fsync sync \
memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign \ memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign \
cfmakeraw cfsetspeed isnan copysign cfmakeraw cfsetspeed isnan copysign
do : do :

View file

@ -2615,12 +2615,12 @@ AC_SUBST(BLESSMAIL_TARGET)
AC_CHECK_FUNCS(gethostname getdomainname dup2 \ AC_CHECK_FUNCS(gethostname getdomainname dup2 \
rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \ rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \
random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime setsid \ random lrand48 logb frexp fmod rint cbrt ftime setsid \
strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \ strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \
utimes getrlimit setrlimit setpgid getcwd getwd shutdown getaddrinfo \ utimes getrlimit setrlimit setpgid getcwd getwd shutdown getaddrinfo \
__fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \ __fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \
sendto recvfrom getsockopt setsockopt getsockname getpeername \ sendto recvfrom getsockopt setsockopt getsockname getpeername \
gai_strerror mkstemp getline getdelim mremap memmove fsync sync bzero \ gai_strerror mkstemp getline getdelim mremap memmove fsync sync \
memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign \ memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign \
cfmakeraw cfsetspeed isnan copysign) cfmakeraw cfsetspeed isnan copysign)
@ -3574,10 +3574,6 @@ SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. */
#include <string.h> #include <string.h>
#endif #endif
#ifdef HAVE_STRINGS_H
#include <strings.h> /* May be needed for bcopy & al. */
#endif
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif #endif
@ -3619,16 +3615,6 @@ typedef unsigned size_t;
# endif # endif
#endif #endif
#ifndef HAVE_BCOPY
#define bcopy(a,b,s) memcpy (b,a,s)
#endif
#ifndef HAVE_BZERO
#define bzero(a,s) memset (a,0,s)
#endif
#ifndef HAVE_BCMP
#define BCMP memcmp
#endif
#endif /* EMACS_CONFIG_H */ #endif /* EMACS_CONFIG_H */
/* /*

View file

@ -1,3 +1,9 @@
2010-07-07 Andreas Schwab <schwab@linux-m68k.org>
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
2010-07-06 Andreas Schwab <schwab@linux-m68k.org> 2010-07-06 Andreas Schwab <schwab@linux-m68k.org>
* movemail.c: Add MAIL_USE_POP around prototypes. * movemail.c: Add MAIL_USE_POP around prototypes.

View file

@ -647,7 +647,7 @@ add_sym (char *name, struct sym *nested_in_class)
} }
sym = (struct sym *) xmalloc (sizeof *sym + strlen (name)); sym = (struct sym *) xmalloc (sizeof *sym + strlen (name));
bzero (sym, sizeof *sym); memset (sym, 0, sizeof *sym);
strcpy (sym->name, name); strcpy (sym->name, name);
sym->namesp = scope; sym->namesp = scope;
sym->next = class_table[h]; sym->next = class_table[h];
@ -1042,7 +1042,7 @@ struct sym *
make_namespace (char *name, struct sym *context) make_namespace (char *name, struct sym *context)
{ {
struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name)); struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name));
bzero (s, sizeof *s); memset (s, 0, sizeof *s);
strcpy (s->name, name); strcpy (s->name, name);
s->next = all_namespaces; s->next = all_namespaces;
s->namesp = context; s->namesp = context;

View file

@ -612,7 +612,7 @@ pop_retrieve (popserver server, int message, int markfrom, char **msg_buf)
} }
ptr[cp++] = '>'; ptr[cp++] = '>';
} }
bcopy (fromserver, &ptr[cp], ret); memcpy (&ptr[cp], fromserver, ret);
cp += ret; cp += ret;
ptr[cp++] = '\n'; ptr[cp++] = '\n';
} }
@ -1020,7 +1020,7 @@ socket_connection (char *host, int flags)
} }
#endif #endif
bzero ((char *) &addr, sizeof (addr)); memset (&addr, 0, sizeof (addr));
addr.sin_family = AF_INET; addr.sin_family = AF_INET;
/** "kpop" service is never used: look for 20060515 to see why **/ /** "kpop" service is never used: look for 20060515 to see why **/
@ -1096,8 +1096,7 @@ socket_connection (char *host, int flags)
if (it->ai_addrlen == sizeof (addr)) if (it->ai_addrlen == sizeof (addr))
{ {
struct sockaddr_in *in_a = (struct sockaddr_in *) it->ai_addr; struct sockaddr_in *in_a = (struct sockaddr_in *) it->ai_addr;
bcopy (&in_a->sin_addr, (char *) &addr.sin_addr, memcpy (&addr.sin_addr, &in_a->sin_addr, sizeof (addr.sin_addr));
sizeof (addr.sin_addr));
if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr))) if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr)))
break; break;
} }
@ -1125,8 +1124,7 @@ socket_connection (char *host, int flags)
while (*hostent->h_addr_list) while (*hostent->h_addr_list)
{ {
bcopy (*hostent->h_addr_list, (char *) &addr.sin_addr, memcpy (&addr.sin_addr, *hostent->h_addr_list, hostent->h_length);
hostent->h_length);
if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr))) if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr)))
break; break;
hostent->h_addr_list++; hostent->h_addr_list++;
@ -1318,8 +1316,8 @@ pop_getline (popserver server, char **line)
} }
else else
{ {
bcopy (server->buffer + server->buffer_index, memmove (server->buffer, server->buffer + server->buffer_index,
server->buffer, server->data); server->data);
/* Record the fact that we've searched the data already in /* Record the fact that we've searched the data already in
the buffer for a CRLF, so that when we search below, we the buffer for a CRLF, so that when we search below, we
don't have to search the same data twice. There's a "- don't have to search the same data twice. There's a "-

View file

@ -1,3 +1,13 @@
2010-07-07 Andreas Schwab <schwab@linux-m68k.org>
* 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.
2010-07-05 Jan Djärv <jan.h.d@swipnet.se> 2010-07-05 Jan Djärv <jan.h.d@swipnet.se>
* xlwmenu.c (XlwMenuSetValues, XlwMenuInitialize): Correct prototype. * xlwmenu.c (XlwMenuSetValues, XlwMenuInitialize): Correct prototype.

View file

@ -77,8 +77,8 @@ XtApplyToWidgets (Widget w, XtApplyToWidgetsProc proc, XtPointer arg)
int nkids = cw->composite.num_children; int nkids = cw->composite.num_children;
Widget *kids = (Widget *) malloc (sizeof (Widget) * nkids); Widget *kids = (Widget *) malloc (sizeof (Widget) * nkids);
int i; int i;
lwlib_bcopy ((char *) cw->composite.children, (char *) kids, memcpy ((char *) kids, (char *) cw->composite.children,
sizeof (Widget) * nkids); sizeof (Widget) * nkids);
for (i = 0; i < nkids; i++) for (i = 0; i < nkids; i++)
/* This prevent us from using gadgets, why is it here? */ /* This prevent us from using gadgets, why is it here? */
/* if (XtIsWidget (kids [i])) */ /* if (XtIsWidget (kids [i])) */

View file

@ -104,24 +104,6 @@ static void destroy_one_instance (widget_instance *);
static void lw_pop_all_widgets (LWLIB_ID, Boolean); static void lw_pop_all_widgets (LWLIB_ID, Boolean);
static Boolean get_one_value (widget_instance *, widget_value *); static Boolean get_one_value (widget_instance *, widget_value *);
static void show_one_widget_busy (Widget, Boolean); static void show_one_widget_busy (Widget, Boolean);
void
lwlib_memset (char *address, int value, size_t length)
{
int i;
for (i = 0; i < length; i++)
address[i] = value;
}
void
lwlib_bcopy (char *from, char *to, int length)
{
int i;
for (i = 0; i < length; i++)
to[i] = from[i];
}
/* utility functions for widget_instance and widget_info */ /* utility functions for widget_instance and widget_info */
char * char *
safe_strdup (const char *s) safe_strdup (const char *s)
@ -179,7 +161,7 @@ malloc_widget_value (void)
wv = (widget_value *) malloc (sizeof (widget_value)); wv = (widget_value *) malloc (sizeof (widget_value));
malloc_cpt++; malloc_cpt++;
} }
lwlib_memset ((void*) wv, 0, sizeof (widget_value)); memset ((void*) wv, 0, sizeof (widget_value));
return wv; return wv;
} }
@ -302,7 +284,7 @@ free_widget_info (widget_info *info)
safe_free_str (info->type); safe_free_str (info->type);
safe_free_str (info->name); safe_free_str (info->name);
free_widget_value_tree (info->val); free_widget_value_tree (info->val);
lwlib_memset ((void*)info, 0xDEADBEEF, sizeof (widget_info)); memset ((void*)info, 0xDEADBEEF, sizeof (widget_info));
free (info); free (info);
} }
@ -331,7 +313,7 @@ allocate_widget_instance (info, parent, pop_up_p)
{ {
widget_instance* instance = widget_instance* instance =
(widget_instance*)malloc (sizeof (widget_instance)); (widget_instance*)malloc (sizeof (widget_instance));
bzero (instance, sizeof *instance); memset (instance, 0, sizeof *instance);
instance->parent = parent; instance->parent = parent;
instance->pop_up_p = pop_up_p; instance->pop_up_p = pop_up_p;
instance->info = info; instance->info = info;
@ -348,7 +330,7 @@ allocate_widget_instance (info, parent, pop_up_p)
static void static void
free_widget_instance (widget_instance *instance) free_widget_instance (widget_instance *instance)
{ {
lwlib_memset ((void*)instance, 0xDEADBEEF, sizeof (widget_instance)); memset ((void*)instance, 0xDEADBEEF, sizeof (widget_instance));
free (instance); free (instance);
} }
@ -1453,7 +1435,7 @@ lw_separator_p (char *label, enum menu_separator *type, int motif_p)
int separator_p = 0; int separator_p = 0;
if (strlen (label) >= 3 if (strlen (label) >= 3
&& bcmp (label, "--:", 3) == 0) && memcmp (label, "--:", 3) == 0)
{ {
static struct separator_table static struct separator_table
{ {
@ -1496,7 +1478,7 @@ lw_separator_p (char *label, enum menu_separator *type, int motif_p)
} }
} }
else if (strlen (label) > 3 else if (strlen (label) > 3
&& bcmp (label, "--", 2) == 0 && memcmp (label, "--", 2) == 0
&& label[2] != '-') && label[2] != '-')
{ {
/* Alternative, more Emacs-style names. */ /* Alternative, more Emacs-style names. */

View file

@ -189,8 +189,6 @@ void lw_set_main_areas (Widget parent,
int lw_separator_p (char *label, enum menu_separator *type, int lw_separator_p (char *label, enum menu_separator *type,
int motif_p); int motif_p);
void lwlib_bcopy (char*, char*, int);
#endif /* LWLIB_H */ #endif /* LWLIB_H */
/* arch-tag: 44d818d5-7eb2-4d87-acd7-b992bb0d5d20 /* arch-tag: 44d818d5-7eb2-4d87-acd7-b992bb0d5d20

View file

@ -1861,7 +1861,7 @@ XlwMenuInitialize (Widget request, Widget w, ArgList args, Cardinal *num_args)
/* _XtCreate is freeing the object that was passed to us, /* _XtCreate is freeing the object that was passed to us,
so make a copy that we will actually keep. */ so make a copy that we will actually keep. */
lwlib_bcopy (mw->menu.contents, tem, sizeof (widget_value)); memcpy (tem, mw->menu.contents, sizeof (widget_value));
mw->menu.contents = tem; mw->menu.contents = tem;
#endif #endif

View file

@ -1,3 +1,8 @@
2010-07-07 Andreas Schwab <schwab@linux-m68k.org>
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
2010-07-02 Eli Zaretskii <eliz@gnu.org> 2010-07-02 Eli Zaretskii <eliz@gnu.org>
* sed1v2.inp (LIB_GCC): Edit to empty. * sed1v2.inp (LIB_GCC): Edit to empty.

View file

@ -38,6 +38,8 @@
/^#undef HAVE_CBRT *$/s/^.*$/#define HAVE_CBRT 1/ /^#undef HAVE_CBRT *$/s/^.*$/#define HAVE_CBRT 1/
/^#undef HAVE_DIFFTIME *$/s/^.*$/#define HAVE_DIFFTIME 1/ /^#undef HAVE_DIFFTIME *$/s/^.*$/#define HAVE_DIFFTIME 1/
/^#undef HAVE_FPATHCONF *$/s/^.*$/#define HAVE_FPATHCONF 1/ /^#undef HAVE_FPATHCONF *$/s/^.*$/#define HAVE_FPATHCONF 1/
/^#undef HAVE_MEMCPY *$/s/^.*$/#define HAVE_MEMCPY 1/
/^#undef HAVE_MEMSET *$/s/^.*$/#define HAVE_MEMSET 1/
/^#undef HAVE_MEMCMP *$/s/^.*$/#define HAVE_MEMCMP 1/ /^#undef HAVE_MEMCMP *$/s/^.*$/#define HAVE_MEMCMP 1/
/^#undef HAVE_MEMMOVE *$/s/^.*$/#define HAVE_MEMMOVE 1/ /^#undef HAVE_MEMMOVE *$/s/^.*$/#define HAVE_MEMMOVE 1/
/^#undef HAVE_SETRLIMIT *$/s/^.*$/#define HAVE_SETRLIMIT 1/ /^#undef HAVE_SETRLIMIT *$/s/^.*$/#define HAVE_SETRLIMIT 1/
@ -84,14 +86,6 @@ s/^#undef POINTER_TYPE *$/#define POINTER_TYPE void/
#else\ #else\
#undef HAVE_STDINT_H\ #undef HAVE_STDINT_H\
#endif #endif
# GCC 3.x has a built-in bzero, which conflicts with the define at
# the end of config.in
/^#undef HAVE_BZERO/c\
#if __GNUC__ >= 3\
#define HAVE_BZERO 1\
#else\
#undef HAVE_BZERO\
#endif
# Comment out any remaining undef directives, because some of them # Comment out any remaining undef directives, because some of them
# might be defined in sys/config.h we include at the top of config.h. # might be defined in sys/config.h we include at the top of config.h.

View file

@ -1,3 +1,8 @@
2010-07-07 Andreas Schwab <schwab@linux-m68k.org>
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
2010-07-02 Juanma Barranquero <lekktu@gmail.com> 2010-07-02 Juanma Barranquero <lekktu@gmail.com>
* config.nt (__P): Remove. * config.nt (__P): Remove.

View file

@ -212,8 +212,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#undef HAVE_SYSINFO #undef HAVE_SYSINFO
#undef HAVE_RANDOM #undef HAVE_RANDOM
#undef HAVE_LRAND48 #undef HAVE_LRAND48
#undef HAVE_BCOPY #undef HAVE_MEMCPY
#undef HAVE_BCMP #undef HAVE_MEMMOVE
#undef HAVE_MEMSET
#undef HAVE_MEMCMP
#undef HAVE_LOGB #undef HAVE_LOGB
#undef HAVE_FREXP #undef HAVE_FREXP
#undef HAVE_FMOD #undef HAVE_FMOD

View file

@ -1,3 +1,174 @@
2010-07-07 Andreas Schwab <schwab@linux-m68k.org>
* 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.
2010-07-07 Jan Djärv <jan.h.d@swipnet.se> 2010-07-07 Jan Djärv <jan.h.d@swipnet.se>
* process.c (kbd_is_on_hold): New variable. * process.c (kbd_is_on_hold): New variable.

View file

@ -636,10 +636,12 @@ overrun_check_malloc (size)
val = (unsigned char *) malloc (size + overhead); val = (unsigned char *) malloc (size + overhead);
if (val && check_depth == 1) if (val && check_depth == 1)
{ {
bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4); memcpy (val, xmalloc_overrun_check_header,
XMALLOC_OVERRUN_CHECK_SIZE - 4);
val += XMALLOC_OVERRUN_CHECK_SIZE; val += XMALLOC_OVERRUN_CHECK_SIZE;
XMALLOC_PUT_SIZE(val, size); XMALLOC_PUT_SIZE(val, size);
bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE); memcpy (val + size, xmalloc_overrun_check_trailer,
XMALLOC_OVERRUN_CHECK_SIZE);
} }
--check_depth; --check_depth;
return (POINTER_TYPE *)val; return (POINTER_TYPE *)val;
@ -659,28 +661,29 @@ overrun_check_realloc (block, size)
if (val if (val
&& check_depth == 1 && check_depth == 1
&& bcmp (xmalloc_overrun_check_header, && memcmp (xmalloc_overrun_check_header,
val - XMALLOC_OVERRUN_CHECK_SIZE, val - XMALLOC_OVERRUN_CHECK_SIZE,
XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0)
{ {
size_t osize = XMALLOC_GET_SIZE (val); size_t osize = XMALLOC_GET_SIZE (val);
if (bcmp (xmalloc_overrun_check_trailer, if (memcmp (xmalloc_overrun_check_trailer, val + osize,
val + osize, XMALLOC_OVERRUN_CHECK_SIZE))
XMALLOC_OVERRUN_CHECK_SIZE))
abort (); abort ();
bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE); memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE);
val -= XMALLOC_OVERRUN_CHECK_SIZE; val -= XMALLOC_OVERRUN_CHECK_SIZE;
bzero (val, XMALLOC_OVERRUN_CHECK_SIZE); memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE);
} }
val = (unsigned char *) realloc ((POINTER_TYPE *)val, size + overhead); val = (unsigned char *) realloc ((POINTER_TYPE *)val, size + overhead);
if (val && check_depth == 1) if (val && check_depth == 1)
{ {
bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4); memcpy (val, xmalloc_overrun_check_header,
XMALLOC_OVERRUN_CHECK_SIZE - 4);
val += XMALLOC_OVERRUN_CHECK_SIZE; val += XMALLOC_OVERRUN_CHECK_SIZE;
XMALLOC_PUT_SIZE(val, size); XMALLOC_PUT_SIZE(val, size);
bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE); memcpy (val + size, xmalloc_overrun_check_trailer,
XMALLOC_OVERRUN_CHECK_SIZE);
} }
--check_depth; --check_depth;
return (POINTER_TYPE *)val; return (POINTER_TYPE *)val;
@ -697,22 +700,21 @@ overrun_check_free (block)
++check_depth; ++check_depth;
if (val if (val
&& check_depth == 1 && check_depth == 1
&& bcmp (xmalloc_overrun_check_header, && memcmp (xmalloc_overrun_check_header,
val - XMALLOC_OVERRUN_CHECK_SIZE, val - XMALLOC_OVERRUN_CHECK_SIZE,
XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0)
{ {
size_t osize = XMALLOC_GET_SIZE (val); size_t osize = XMALLOC_GET_SIZE (val);
if (bcmp (xmalloc_overrun_check_trailer, if (memcmp (xmalloc_overrun_check_trailer, val + osize,
val + osize, XMALLOC_OVERRUN_CHECK_SIZE))
XMALLOC_OVERRUN_CHECK_SIZE))
abort (); abort ();
#ifdef XMALLOC_CLEAR_FREE_MEMORY #ifdef XMALLOC_CLEAR_FREE_MEMORY
val -= XMALLOC_OVERRUN_CHECK_SIZE; val -= XMALLOC_OVERRUN_CHECK_SIZE;
memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_SIZE*2); memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_SIZE*2);
#else #else
bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE); memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE);
val -= XMALLOC_OVERRUN_CHECK_SIZE; val -= XMALLOC_OVERRUN_CHECK_SIZE;
bzero (val, XMALLOC_OVERRUN_CHECK_SIZE); memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE);
#endif #endif
} }
@ -799,7 +801,7 @@ xstrdup (const char *s)
{ {
size_t len = strlen (s) + 1; size_t len = strlen (s) + 1;
char *p = (char *) xmalloc (len); char *p = (char *) xmalloc (len);
bcopy (s, p, len); memcpy (p, s, len);
return p; return p;
} }
@ -1873,7 +1875,7 @@ allocate_string (void)
int i; int i;
b = (struct string_block *) lisp_malloc (sizeof *b, MEM_TYPE_STRING); b = (struct string_block *) lisp_malloc (sizeof *b, MEM_TYPE_STRING);
bzero (b, sizeof *b); memset (b, 0, sizeof *b);
b->next = string_blocks; b->next = string_blocks;
string_blocks = b; string_blocks = b;
++n_string_blocks; ++n_string_blocks;
@ -1897,7 +1899,7 @@ allocate_string (void)
MALLOC_UNBLOCK_INPUT; MALLOC_UNBLOCK_INPUT;
/* Probably not strictly necessary, but play it safe. */ /* Probably not strictly necessary, but play it safe. */
bzero (s, sizeof *s); memset (s, 0, sizeof *s);
--total_free_strings; --total_free_strings;
++total_strings; ++total_strings;
@ -2005,8 +2007,7 @@ allocate_string_data (struct Lisp_String *s, int nchars, int nbytes)
s->size_byte = nbytes; s->size_byte = nbytes;
s->data[nbytes] = '\0'; s->data[nbytes] = '\0';
#ifdef GC_CHECK_STRING_OVERRUN #ifdef GC_CHECK_STRING_OVERRUN
bcopy (string_overrun_cookie, (char *) data + needed, memcpy (data + needed, string_overrun_cookie, GC_STRING_OVERRUN_COOKIE_SIZE);
GC_STRING_OVERRUN_COOKIE_SIZE);
#endif #endif
/* If S had already data assigned, mark that as free by setting its /* If S had already data assigned, mark that as free by setting its
@ -2197,9 +2198,9 @@ compact_small_strings (void)
from_end = (struct sdata *) ((char *) from + nbytes + GC_STRING_EXTRA); from_end = (struct sdata *) ((char *) from + nbytes + GC_STRING_EXTRA);
#ifdef GC_CHECK_STRING_OVERRUN #ifdef GC_CHECK_STRING_OVERRUN
if (bcmp (string_overrun_cookie, if (memcmp (string_overrun_cookie,
((char *) from_end) - GC_STRING_OVERRUN_COOKIE_SIZE, (char *) from_end - GC_STRING_OVERRUN_COOKIE_SIZE,
GC_STRING_OVERRUN_COOKIE_SIZE)) GC_STRING_OVERRUN_COOKIE_SIZE))
abort (); abort ();
#endif #endif
@ -2221,7 +2222,7 @@ compact_small_strings (void)
if (from != to) if (from != to)
{ {
xassert (tb != b || to <= from); xassert (tb != b || to <= from);
safe_bcopy ((char *) from, (char *) to, nbytes + GC_STRING_EXTRA); memmove (to, from, nbytes + GC_STRING_EXTRA);
to->string->data = SDATA_DATA (to); to->string->data = SDATA_DATA (to);
} }
@ -2280,7 +2281,7 @@ INIT must be an integer that represents a character. */)
end = p + nbytes; end = p + nbytes;
while (p != end) while (p != end)
{ {
bcopy (str, p, len); memcpy (p, str, len);
p += len; p += len;
} }
} }
@ -2362,7 +2363,7 @@ make_unibyte_string (const char *contents, int length)
{ {
register Lisp_Object val; register Lisp_Object val;
val = make_uninit_string (length); val = make_uninit_string (length);
bcopy (contents, SDATA (val), length); memcpy (SDATA (val), contents, length);
STRING_SET_UNIBYTE (val); STRING_SET_UNIBYTE (val);
return val; return val;
} }
@ -2376,7 +2377,7 @@ make_multibyte_string (const char *contents, int nchars, int nbytes)
{ {
register Lisp_Object val; register Lisp_Object val;
val = make_uninit_multibyte_string (nchars, nbytes); val = make_uninit_multibyte_string (nchars, nbytes);
bcopy (contents, SDATA (val), nbytes); memcpy (SDATA (val), contents, nbytes);
return val; return val;
} }
@ -2389,7 +2390,7 @@ make_string_from_bytes (const char *contents, int nchars, int nbytes)
{ {
register Lisp_Object val; register Lisp_Object val;
val = make_uninit_multibyte_string (nchars, nbytes); val = make_uninit_multibyte_string (nchars, nbytes);
bcopy (contents, SDATA (val), nbytes); memcpy (SDATA (val), contents, nbytes);
if (SBYTES (val) == SCHARS (val)) if (SBYTES (val) == SCHARS (val))
STRING_SET_UNIBYTE (val); STRING_SET_UNIBYTE (val);
return val; return val;
@ -2414,7 +2415,7 @@ make_specified_string (const char *contents, int nchars, int nbytes, int multiby
nchars = nbytes; nchars = nbytes;
} }
val = make_uninit_multibyte_string (nchars, nbytes); val = make_uninit_multibyte_string (nchars, nbytes);
bcopy (contents, SDATA (val), nbytes); memcpy (SDATA (val), contents, nbytes);
if (!multibyte) if (!multibyte)
STRING_SET_UNIBYTE (val); STRING_SET_UNIBYTE (val);
return val; return val;
@ -2587,7 +2588,7 @@ make_float (double float_value)
new = (struct float_block *) lisp_align_malloc (sizeof *new, new = (struct float_block *) lisp_align_malloc (sizeof *new,
MEM_TYPE_FLOAT); MEM_TYPE_FLOAT);
new->next = float_block; new->next = float_block;
bzero ((char *) new->gcmarkbits, sizeof new->gcmarkbits); memset (new->gcmarkbits, 0, sizeof new->gcmarkbits);
float_block = new; float_block = new;
float_block_index = 0; float_block_index = 0;
n_float_blocks++; n_float_blocks++;
@ -2709,7 +2710,7 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0,
register struct cons_block *new; register struct cons_block *new;
new = (struct cons_block *) lisp_align_malloc (sizeof *new, new = (struct cons_block *) lisp_align_malloc (sizeof *new,
MEM_TYPE_CONS); MEM_TYPE_CONS);
bzero ((char *) new->gcmarkbits, sizeof new->gcmarkbits); memset (new->gcmarkbits, 0, sizeof new->gcmarkbits);
new->next = cons_block; new->next = cons_block;
cons_block = new; cons_block = new;
cons_block_index = 0; cons_block_index = 0;
@ -2950,8 +2951,8 @@ allocate_terminal (void)
struct terminal *t = ALLOCATE_PSEUDOVECTOR (struct terminal, struct terminal *t = ALLOCATE_PSEUDOVECTOR (struct terminal,
next_terminal, PVEC_TERMINAL); next_terminal, PVEC_TERMINAL);
/* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */ /* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */
bzero (&(t->next_terminal), memset (&t->next_terminal, 0,
((char*)(t+1)) - ((char*)&(t->next_terminal))); (char*) (t + 1) - (char*) &t->next_terminal);
return t; return t;
} }
@ -2962,8 +2963,8 @@ allocate_frame (void)
struct frame *f = ALLOCATE_PSEUDOVECTOR (struct frame, struct frame *f = ALLOCATE_PSEUDOVECTOR (struct frame,
face_cache, PVEC_FRAME); face_cache, PVEC_FRAME);
/* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */ /* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */
bzero (&(f->face_cache), memset (&f->face_cache, 0,
((char*)(f+1)) - ((char*)&(f->face_cache))); (char *) (f + 1) - (char *) &f->face_cache);
return f; return f;
} }
@ -4713,7 +4714,7 @@ make_pure_string (const char *data, int nchars, int nbytes, int multibyte)
if (s->data == NULL) if (s->data == NULL)
{ {
s->data = (unsigned char *) pure_alloc (nbytes + 1, -1); s->data = (unsigned char *) pure_alloc (nbytes + 1, -1);
bcopy (data, s->data, nbytes); memcpy (s->data, data, nbytes);
s->data[nbytes] = '\0'; s->data[nbytes] = '\0';
} }
s->size = nchars; s->size = nchars;
@ -4980,9 +4981,9 @@ returns nil, because real GC can't be done. */)
if (stack_copy) if (stack_copy)
{ {
if ((EMACS_INT) (&stack_top_variable - stack_bottom) > 0) if ((EMACS_INT) (&stack_top_variable - stack_bottom) > 0)
bcopy (stack_bottom, stack_copy, i); memcpy (stack_copy, stack_bottom, i);
else else
bcopy (&stack_top_variable, stack_copy, i); memcpy (stack_copy, &stack_top_variable, i);
} }
} }
} }

View file

@ -116,7 +116,7 @@ start_atimer (enum atimer_type type, EMACS_TIME time, atimer_callback fn,
t = (struct atimer *) xmalloc (sizeof *t); t = (struct atimer *) xmalloc (sizeof *t);
/* Fill the atimer structure. */ /* Fill the atimer structure. */
bzero (t, sizeof *t); memset (t, 0, sizeof *t);
t->type = type; t->type = type;
t->fn = fn; t->fn = fn;
t->client_data = client_data; t->client_data = client_data;
@ -308,7 +308,7 @@ set_alarm (void)
EMACS_SET_USECS (time, 1000); EMACS_SET_USECS (time, 1000);
} }
bzero (&it, sizeof it); memset (&it, 0, sizeof it);
it.it_value = time; it.it_value = time;
setitimer (ITIMER_REAL, &it, 0); setitimer (ITIMER_REAL, &it, 0);
#else /* not HAVE_SETITIMER */ #else /* not HAVE_SETITIMER */

View file

@ -514,7 +514,7 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to)
PER_BUFFER_VALUE (to, offset) = obj; PER_BUFFER_VALUE (to, offset) = obj;
} }
bcopy (from->local_flags, to->local_flags, sizeof to->local_flags); memcpy (to->local_flags, from->local_flags, sizeof to->local_flags);
to->overlays_before = copy_overlays (to, from->overlays_before); to->overlays_before = copy_overlays (to, from->overlays_before);
to->overlays_after = copy_overlays (to, from->overlays_after); to->overlays_after = copy_overlays (to, from->overlays_after);
@ -4413,8 +4413,8 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, int after,
Lisp_Object *copy = (Lisp_Object *) alloca (size * sizeof (Lisp_Object)); Lisp_Object *copy = (Lisp_Object *) alloca (size * sizeof (Lisp_Object));
int i; int i;
bcopy (XVECTOR (last_overlay_modification_hooks)->contents, memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents,
copy, size * sizeof (Lisp_Object)); size * sizeof (Lisp_Object));
gcpro1.var = copy; gcpro1.var = copy;
gcpro1.nvars = size; gcpro1.nvars = size;
@ -4877,7 +4877,7 @@ mmap_realloc (var, nbytes)
} }
else if (mmap_alloc (var, nbytes)) else if (mmap_alloc (var, nbytes))
{ {
bcopy (old_ptr, *var, r->nbytes_specified); memcpy (*var, old_ptr, r->nbytes_specified);
mmap_free_1 (MMAP_REGION (old_ptr)); mmap_free_1 (MMAP_REGION (old_ptr));
result = *var; result = *var;
r = MMAP_REGION (result); r = MMAP_REGION (result);
@ -5058,7 +5058,7 @@ init_buffer_once (void)
{ {
int idx; int idx;
bzero (buffer_permanent_local_flags, sizeof buffer_permanent_local_flags); memset (buffer_permanent_local_flags, 0, sizeof buffer_permanent_local_flags);
/* Make sure all markable slots in buffer_defaults /* Make sure all markable slots in buffer_defaults
are initialized reasonably, so mark_buffer won't choke. */ are initialized reasonably, so mark_buffer won't choke. */
@ -5146,7 +5146,7 @@ init_buffer_once (void)
if (sizeof (EMACS_INT) != sizeof (Lisp_Object)) abort (); if (sizeof (EMACS_INT) != sizeof (Lisp_Object)) abort ();
/* 0 means not a lisp var, -1 means always local, else mask */ /* 0 means not a lisp var, -1 means always local, else mask */
bzero (&buffer_local_flags, sizeof buffer_local_flags); memset (&buffer_local_flags, 0, sizeof buffer_local_flags);
XSETINT (buffer_local_flags.filename, -1); XSETINT (buffer_local_flags.filename, -1);
XSETINT (buffer_local_flags.directory, -1); XSETINT (buffer_local_flags.directory, -1);
XSETINT (buffer_local_flags.backed_up, -1); XSETINT (buffer_local_flags.backed_up, -1);

View file

@ -348,8 +348,7 @@ invoke it. If KEYS is omitted or nil, the return value of
/* Make a copy of string so that if a GC relocates specs, /* Make a copy of string so that if a GC relocates specs,
`string' will still be valid. */ `string' will still be valid. */
string = (unsigned char *) alloca (SBYTES (specs) + 1); string = (unsigned char *) alloca (SBYTES (specs) + 1);
bcopy (SDATA (specs), string, memcpy (string, SDATA (specs), SBYTES (specs) + 1);
SBYTES (specs) + 1);
} }
else else
{ {

View file

@ -775,10 +775,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
PT_BYTE + process_coding.produced); PT_BYTE + process_coding.produced);
carryover = process_coding.carryover_bytes; carryover = process_coding.carryover_bytes;
if (carryover > 0) if (carryover > 0)
/* As CARRYOVER should not be that large, we had memcpy (buf, process_coding.carryover,
better avoid overhead of bcopy. */ process_coding.carryover_bytes);
BCOPY_SHORT (process_coding.carryover, buf,
process_coding.carryover_bytes);
} }
} }
@ -916,7 +914,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
pattern = Fexpand_file_name (Vtemp_file_name_pattern, tmpdir); pattern = Fexpand_file_name (Vtemp_file_name_pattern, tmpdir);
tempfile = (char *) alloca (SBYTES (pattern) + 1); tempfile = (char *) alloca (SBYTES (pattern) + 1);
bcopy (SDATA (pattern), tempfile, SBYTES (pattern) + 1); memcpy (tempfile, SDATA (pattern), SBYTES (pattern) + 1);
coding_systems = Qt; coding_systems = Qt;
#ifdef HAVE_MKSTEMP #ifdef HAVE_MKSTEMP
@ -1099,8 +1097,8 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L
pwd_var = (char *) alloca (i + 6); pwd_var = (char *) alloca (i + 6);
#endif #endif
temp = pwd_var + 4; temp = pwd_var + 4;
bcopy ("PWD=", pwd_var, 4); memcpy (pwd_var, "PWD=", 4);
bcopy (SDATA (current_dir), temp, i); memcpy (temp, SDATA (current_dir), i);
if (!IS_DIRECTORY_SEP (temp[i - 1])) temp[i++] = DIRECTORY_SEP; if (!IS_DIRECTORY_SEP (temp[i - 1])) temp[i++] = DIRECTORY_SEP;
temp[i] = 0; temp[i] = 0;
@ -1325,7 +1323,7 @@ getenv_internal_1 (char *var, int varlen, char **value, int *valuelen, Lisp_Obje
/* NT environment variables are case insensitive. */ /* NT environment variables are case insensitive. */
&& ! strnicmp (SDATA (entry), var, varlen) && ! strnicmp (SDATA (entry), var, varlen)
#else /* not WINDOWSNT */ #else /* not WINDOWSNT */
&& ! bcmp (SDATA (entry), var, varlen) && ! memcmp (SDATA (entry), var, varlen)
#endif /* not WINDOWSNT */ #endif /* not WINDOWSNT */
) )
{ {

View file

@ -128,7 +128,7 @@ casify_object (enum case_action flag, Lisp_Object obj)
unsigned char *old_dst = dst; unsigned char *old_dst = dst;
o_size += o_size; /* Probably overkill, but extremely rare. */ o_size += o_size; /* Probably overkill, but extremely rare. */
SAFE_ALLOCA (dst, void *, o_size); SAFE_ALLOCA (dst, void *, o_size);
bcopy (old_dst, dst, o - old_dst); memcpy (dst, old_dst, o - old_dst);
o = dst + (o - old_dst); o = dst + (o - old_dst);
} }
c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i_byte, len); c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i_byte, len);

View file

@ -1715,7 +1715,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
msglen = strlen (msg); msglen = strlen (msg);
if (dst + msglen <= (dst_bytes ? dst_end : src)) if (dst + msglen <= (dst_bytes ? dst_end : src))
{ {
bcopy (msg, dst, msglen); memcpy (dst, msg, msglen);
dst += msglen; dst += msglen;
} }
@ -1728,7 +1728,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
msglen = strlen (msg); msglen = strlen (msg);
if (dst + msglen > (dst_bytes ? dst_end : src)) if (dst + msglen > (dst_bytes ? dst_end : src))
break; break;
bcopy (msg, dst, msglen); memcpy (dst, msg, msglen);
dst += msglen; dst += msglen;
} }
goto ccl_finish; goto ccl_finish;
@ -1761,7 +1761,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
int i = src_end - src; int i = src_end - src;
if (dst_bytes && (dst_end - dst) < i) if (dst_bytes && (dst_end - dst) < i)
i = dst_end - dst; i = dst_end - dst;
bcopy (src, dst, i); memcpy (dst, src, i);
src += i; src += i;
dst += i; dst += i;
#else #else

View file

@ -668,7 +668,7 @@ str_as_multibyte (unsigned char *str, int len, int nbytes, int *nchars)
to = p; to = p;
nbytes = endp - p; nbytes = endp - p;
endp = str + len; endp = str + len;
safe_bcopy ((char *) p, (char *) (endp - nbytes), nbytes); memmove (endp - nbytes, p, nbytes);
p = endp - nbytes; p = endp - nbytes;
if (nbytes >= MAX_MULTIBYTE_LENGTH) if (nbytes >= MAX_MULTIBYTE_LENGTH)
@ -746,7 +746,7 @@ str_to_multibyte (unsigned char *str, int len, int bytes)
to = p; to = p;
bytes = endp - p; bytes = endp - p;
endp = str + len; endp = str + len;
safe_bcopy ((char *) p, (char *) (endp - bytes), bytes); memmove (endp - bytes, p, bytes);
p = endp - bytes; p = endp - bytes;
while (p < endp) while (p < endp)
{ {

View file

@ -636,18 +636,6 @@ extern Lisp_Object Vauto_fill_chars;
extern Lisp_Object Vchar_script_table; extern Lisp_Object Vchar_script_table;
extern Lisp_Object Vscript_representative_chars; extern Lisp_Object Vscript_representative_chars;
/* Copy LEN bytes from FROM to TO. This macro should be used only
when a caller knows that LEN is short and the obvious copy loop is
faster than calling bcopy which has some overhead. Copying a
multibyte sequence of a character is the typical case. */
#define BCOPY_SHORT(from, to, len) \
do { \
int i = len; \
unsigned char *from_p = from, *to_p = to; \
while (i--) *to_p++ = *from_p++; \
} while (0)
#define DEFSYM(sym, name) \ #define DEFSYM(sym, name) \
do { (sym) = intern_c_string ((name)); staticpro (&(sym)); } while (0) do { (sym) = intern_c_string ((name)); staticpro (&(sym)); } while (0)

View file

@ -522,7 +522,7 @@ load_charset_map_from_file (struct charset *charset, Lisp_Object mapfile, int co
SAFE_ALLOCA (head, struct charset_map_entries *, SAFE_ALLOCA (head, struct charset_map_entries *,
sizeof (struct charset_map_entries)); sizeof (struct charset_map_entries));
entries = head; entries = head;
bzero (entries, sizeof (struct charset_map_entries)); memset (entries, 0, sizeof (struct charset_map_entries));
n_entries = 0; n_entries = 0;
eof = 0; eof = 0;
@ -549,7 +549,7 @@ load_charset_map_from_file (struct charset *charset, Lisp_Object mapfile, int co
SAFE_ALLOCA (entries->next, struct charset_map_entries *, SAFE_ALLOCA (entries->next, struct charset_map_entries *,
sizeof (struct charset_map_entries)); sizeof (struct charset_map_entries));
entries = entries->next; entries = entries->next;
bzero (entries, sizeof (struct charset_map_entries)); memset (entries, 0, sizeof (struct charset_map_entries));
} }
idx = n_entries % 0x10000; idx = n_entries % 0x10000;
entries->entry[idx].from = from; entries->entry[idx].from = from;
@ -585,7 +585,7 @@ load_charset_map_from_vector (struct charset *charset, Lisp_Object vec, int cont
SAFE_ALLOCA (head, struct charset_map_entries *, SAFE_ALLOCA (head, struct charset_map_entries *,
sizeof (struct charset_map_entries)); sizeof (struct charset_map_entries));
entries = head; entries = head;
bzero (entries, sizeof (struct charset_map_entries)); memset (entries, 0, sizeof (struct charset_map_entries));
n_entries = 0; n_entries = 0;
for (i = 0; i < len; i += 2) for (i = 0; i < len; i += 2)
@ -622,7 +622,7 @@ load_charset_map_from_vector (struct charset *charset, Lisp_Object vec, int cont
SAFE_ALLOCA (entries->next, struct charset_map_entries *, SAFE_ALLOCA (entries->next, struct charset_map_entries *,
sizeof (struct charset_map_entries)); sizeof (struct charset_map_entries));
entries = entries->next; entries = entries->next;
bzero (entries, sizeof (struct charset_map_entries)); memset (entries, 0, sizeof (struct charset_map_entries));
} }
idx = n_entries % 0x10000; idx = n_entries % 0x10000;
entries->entry[idx].from = from; entries->entry[idx].from = from;
@ -935,7 +935,7 @@ usage: (define-charset-internal ...) */)
if (! charset.code_linear_p) if (! charset.code_linear_p)
{ {
charset.code_space_mask = (unsigned char *) xmalloc (256); charset.code_space_mask = (unsigned char *) xmalloc (256);
bzero (charset.code_space_mask, 256); memset (charset.code_space_mask, 0, 256);
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
for (j = charset.code_space[i * 4]; j <= charset.code_space[i * 4 + 1]; for (j = charset.code_space[i * 4]; j <= charset.code_space[i * 4 + 1];
j++) j++)
@ -1058,7 +1058,7 @@ usage: (define-charset-internal ...) */)
charset.unified_p = 0; charset.unified_p = 0;
bzero (charset.fast_map, sizeof (charset.fast_map)); memset (charset.fast_map, 0, sizeof (charset.fast_map));
if (! NILP (args[charset_arg_code_offset])) if (! NILP (args[charset_arg_code_offset]))
{ {
@ -1191,8 +1191,8 @@ usage: (define-charset-internal ...) */)
struct charset *new_table struct charset *new_table
= (struct charset *) xmalloc (sizeof (struct charset) = (struct charset *) xmalloc (sizeof (struct charset)
* (charset_table_size + 16)); * (charset_table_size + 16));
bcopy (charset_table, new_table, memcpy (new_table, charset_table,
sizeof (struct charset) * charset_table_size); sizeof (struct charset) * charset_table_size);
charset_table_size += 16; charset_table_size += 16;
charset_table = new_table; charset_table = new_table;
} }

View file

@ -430,7 +430,7 @@ cmgoto (struct tty_display_info *tty, int row, int col)
void void
Wcm_clear (struct tty_display_info *tty) Wcm_clear (struct tty_display_info *tty)
{ {
bzero (tty->Wcm, sizeof (struct cm)); memset (tty->Wcm, 0, sizeof (struct cm));
UP = 0; UP = 0;
BC = 0; BC = 0;
} }

View file

@ -6550,7 +6550,7 @@ decode_eol (struct coding_system *coding)
for (p = pend - 2; p >= pbeg; p--) for (p = pend - 2; p >= pbeg; p--)
if (*p == '\r') if (*p == '\r')
{ {
safe_bcopy ((char *) (p + 1), (char *) p, pend-- - p - 1); memmove (p, p + 1, pend-- - p - 1);
n++; n++;
} }
} }
@ -7814,7 +7814,7 @@ decode_coding_object (struct coding_system *coding,
} }
if (BEGV < GPT && GPT < BEGV + coding->produced_char) if (BEGV < GPT && GPT < BEGV + coding->produced_char)
move_gap_both (BEGV, BEGV_BYTE); move_gap_both (BEGV, BEGV_BYTE);
bcopy (BEGV_ADDR, destination, coding->produced); memcpy (destination, BEGV_ADDR, coding->produced);
coding->destination = destination; coding->destination = destination;
} }
} }
@ -9482,7 +9482,7 @@ usage: (set-coding-system-priority &rest coding-systems) */)
int changed[coding_category_max]; int changed[coding_category_max];
enum coding_category priorities[coding_category_max]; enum coding_category priorities[coding_category_max];
bzero (changed, sizeof changed); memset (changed, 0, sizeof changed);
for (i = j = 0; i < nargs; i++) for (i = j = 0; i < nargs; i++)
{ {
@ -9517,7 +9517,7 @@ usage: (set-coding-system-priority &rest coding-systems) */)
priorities[i] = coding_priorities[j]; priorities[i] = coding_priorities[j];
} }
bcopy (priorities, coding_priorities, sizeof priorities); memcpy (coding_priorities, priorities, sizeof priorities);
/* Update `coding-category-list'. */ /* Update `coding-category-list'. */
Vcoding_category_list = Qnil; Vcoding_category_list = Qnil;
@ -9568,11 +9568,11 @@ make_subsidiaries (Lisp_Object base)
char *buf = (char *) alloca (base_name_len + 6); char *buf = (char *) alloca (base_name_len + 6);
int i; int i;
bcopy (SDATA (SYMBOL_NAME (base)), buf, base_name_len); memcpy (buf, SDATA (SYMBOL_NAME (base)), base_name_len);
subsidiaries = Fmake_vector (make_number (3), Qnil); subsidiaries = Fmake_vector (make_number (3), Qnil);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
bcopy (suffixes[i], buf + base_name_len, strlen (suffixes[i]) + 1); memcpy (buf + base_name_len, suffixes[i], strlen (suffixes[i]) + 1);
ASET (subsidiaries, i, intern (buf)); ASET (subsidiaries, i, intern (buf));
} }
return subsidiaries; return subsidiaries;

View file

@ -102,15 +102,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if ALSA is available. */ /* Define to 1 if ALSA is available. */
#undef HAVE_ALSA #undef HAVE_ALSA
/* Define to 1 if you have the `bcmp' function. */
#undef HAVE_BCMP
/* Define to 1 if you have the `bcopy' function. */
#undef HAVE_BCOPY
/* Define to 1 if you have the `bzero' function. */
#undef HAVE_BZERO
/* Define to 1 if you have the `cbrt' function. */ /* Define to 1 if you have the `cbrt' function. */
#undef HAVE_CBRT #undef HAVE_CBRT
@ -1141,10 +1132,6 @@ SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. */
#include <string.h> #include <string.h>
#endif #endif
#ifdef HAVE_STRINGS_H
#include <strings.h> /* May be needed for bcopy & al. */
#endif
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif #endif
@ -1186,16 +1173,6 @@ typedef unsigned size_t;
# endif # endif
#endif #endif
#ifndef HAVE_BCOPY
#define bcopy(a,b,s) memcpy (b,a,s)
#endif
#ifndef HAVE_BZERO
#define bzero(a,s) memset (a,0,s)
#endif
#ifndef HAVE_BCMP
#define BCMP memcmp
#endif
#endif /* EMACS_CONFIG_H */ #endif /* EMACS_CONFIG_H */
/* /*

View file

@ -2264,13 +2264,13 @@ bool-vector. IDX starts at 0. */)
USE_SAFE_ALLOCA; USE_SAFE_ALLOCA;
SAFE_ALLOCA (str, unsigned char *, nbytes); SAFE_ALLOCA (str, unsigned char *, nbytes);
bcopy (SDATA (array), str, nbytes); memcpy (str, SDATA (array), nbytes);
allocate_string_data (XSTRING (array), nchars, allocate_string_data (XSTRING (array), nchars,
nbytes + new_bytes - prev_bytes); nbytes + new_bytes - prev_bytes);
bcopy (str, SDATA (array), idxval_byte); memcpy (SDATA (array), str, idxval_byte);
p1 = SDATA (array) + idxval_byte; p1 = SDATA (array) + idxval_byte;
bcopy (str + idxval_byte + prev_bytes, p1 + new_bytes, memcpy (p1 + new_bytes, str + idxval_byte + prev_bytes,
nbytes - (idxval_byte + prev_bytes)); nbytes - (idxval_byte + prev_bytes));
SAFE_FREE (); SAFE_FREE ();
clear_string_char_byte_cache (); clear_string_char_byte_cache ();
} }

View file

@ -289,15 +289,14 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m
int nchars; int nchars;
fullname = make_uninit_multibyte_string (nbytes, nbytes); fullname = make_uninit_multibyte_string (nbytes, nbytes);
bcopy (SDATA (directory), SDATA (fullname), memcpy (SDATA (fullname), SDATA (directory),
directory_nbytes); directory_nbytes);
if (needsep) if (needsep)
SSET (fullname, directory_nbytes, DIRECTORY_SEP); SSET (fullname, directory_nbytes, DIRECTORY_SEP);
bcopy (SDATA (name), memcpy (SDATA (fullname) + directory_nbytes + needsep,
SDATA (fullname) + directory_nbytes + needsep, SDATA (name), len);
len);
nchars = chars_in_text (SDATA (fullname), nbytes); nchars = chars_in_text (SDATA (fullname), nbytes);
@ -857,11 +856,11 @@ file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_ad
_djstat_flags = _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE; _djstat_flags = _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE;
#endif /* MSDOS */ #endif /* MSDOS */
bcopy (SDATA (dirname), fullname, pos); memcpy (fullname, SDATA (dirname), pos);
if (!IS_DIRECTORY_SEP (fullname[pos - 1])) if (!IS_DIRECTORY_SEP (fullname[pos - 1]))
fullname[pos++] = DIRECTORY_SEP; fullname[pos++] = DIRECTORY_SEP;
bcopy (dp->d_name, fullname + pos, len); memcpy (fullname + pos, dp->d_name, len);
fullname[pos + len] = 0; fullname[pos + len] = 0;
#ifdef S_IFLNK #ifdef S_IFLNK

View file

@ -436,62 +436,15 @@ DEFUN ("dump-redisplay-history", Fdump_redisplay_history,
#endif /* GLYPH_DEBUG == 0 */ #endif /* GLYPH_DEBUG == 0 */
/* Like bcopy except never gets confused by overlap. Let this be the #ifdef PROFILING
first function defined in this file, or change emacs.c where the /* FIXME: only used to find text start for profiling. */
address of this function is used. */
void void
safe_bcopy (const char *from, char *to, int size) safe_bcopy (const char *from, char *to, int size)
{ {
if (size <= 0 || from == to) abort ();
return;
/* If the source and destination don't overlap, then bcopy can
handle it. If they do overlap, but the destination is lower in
memory than the source, we'll assume bcopy can handle that. */
if (to < from || from + size <= to)
bcopy (from, to, size);
/* Otherwise, we'll copy from the end. */
else
{
register const char *endf = from + size;
register char *endt = to + size;
/* If TO - FROM is large, then we should break the copy into
nonoverlapping chunks of TO - FROM bytes each. However, if
TO - FROM is small, then the bcopy function call overhead
makes this not worth it. The crossover point could be about
anywhere. Since I don't think the obvious copy loop is too
bad, I'm trying to err in its favor. */
if (to - from < 64)
{
do
*--endt = *--endf;
while (endf != from);
}
else
{
for (;;)
{
endt -= (to - from);
endf -= (to - from);
if (endt < to)
break;
bcopy (endf, endt, to - from);
}
/* If SIZE wasn't a multiple of TO - FROM, there will be a
little left over. The amount left over is (endt + (to -
from)) - to, which is endt - from. */
bcopy (from, to, endt - from);
}
}
} }
#endif
/*********************************************************************** /***********************************************************************
Glyph Matrices Glyph Matrices
@ -510,7 +463,7 @@ new_glyph_matrix (struct glyph_pool *pool)
/* Allocate and clear. */ /* Allocate and clear. */
result = (struct glyph_matrix *) xmalloc (sizeof *result); result = (struct glyph_matrix *) xmalloc (sizeof *result);
bzero (result, sizeof *result); memset (result, 0, sizeof *result);
/* Increment number of allocated matrices. This count is used /* Increment number of allocated matrices. This count is used
to detect memory leaks. */ to detect memory leaks. */
@ -655,8 +608,8 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
int size = dim.height * sizeof (struct glyph_row); int size = dim.height * sizeof (struct glyph_row);
new_rows = dim.height - matrix->rows_allocated; new_rows = dim.height - matrix->rows_allocated;
matrix->rows = (struct glyph_row *) xrealloc (matrix->rows, size); matrix->rows = (struct glyph_row *) xrealloc (matrix->rows, size);
bzero (matrix->rows + matrix->rows_allocated, memset (matrix->rows + matrix->rows_allocated, 0,
new_rows * sizeof *matrix->rows); new_rows * sizeof *matrix->rows);
matrix->rows_allocated = dim.height; matrix->rows_allocated = dim.height;
} }
else else
@ -1103,7 +1056,7 @@ clear_glyph_row (struct glyph_row *row)
returned by xmalloc. If flickering happens again, activate returned by xmalloc. If flickering happens again, activate
the code below. If the flickering is gone with that, chances the code below. If the flickering is gone with that, chances
are that the flickering has the same reason as here. */ are that the flickering has the same reason as here. */
bzero (p[0], (char *) p[LAST_AREA] - (char *) p[0]); memset (p[0], 0, (char *) p[LAST_AREA] - (char *) p[0]);
#endif #endif
} }
@ -1237,13 +1190,13 @@ copy_row_except_pointers (struct glyph_row *to, struct glyph_row *from)
struct glyph *pointers[1 + LAST_AREA]; struct glyph *pointers[1 + LAST_AREA];
/* Save glyph pointers of TO. */ /* Save glyph pointers of TO. */
bcopy (to->glyphs, pointers, sizeof to->glyphs); memcpy (pointers, to->glyphs, sizeof to->glyphs);
/* Do a structure assignment. */ /* Do a structure assignment. */
*to = *from; *to = *from;
/* Restore original pointers of TO. */ /* Restore original pointers of TO. */
bcopy (pointers, to->glyphs, sizeof to->glyphs); memcpy (to->glyphs, pointers, sizeof to->glyphs);
} }
@ -1264,8 +1217,8 @@ copy_glyph_row_contents (struct glyph_row *to, struct glyph_row *from, int delta
/* Copy glyphs from FROM to TO. */ /* Copy glyphs from FROM to TO. */
for (area = 0; area < LAST_AREA; ++area) for (area = 0; area < LAST_AREA; ++area)
if (from->used[area]) if (from->used[area])
bcopy (from->glyphs[area], to->glyphs[area], memcpy (to->glyphs[area], from->glyphs[area],
from->used[area] * sizeof (struct glyph)); from->used[area] * sizeof (struct glyph));
/* Increment buffer positions in TO by DELTA. */ /* Increment buffer positions in TO by DELTA. */
increment_row_positions (to, delta, delta_bytes); increment_row_positions (to, delta, delta_bytes);
@ -1524,7 +1477,7 @@ new_glyph_pool (void)
/* Allocate a new glyph_pool and clear it. */ /* Allocate a new glyph_pool and clear it. */
result = (struct glyph_pool *) xmalloc (sizeof *result); result = (struct glyph_pool *) xmalloc (sizeof *result);
bzero (result, sizeof *result); memset (result, 0, sizeof *result);
/* For memory leak and double deletion checking. */ /* For memory leak and double deletion checking. */
++glyph_pool_count; ++glyph_pool_count;
@ -1585,7 +1538,7 @@ realloc_glyph_pool (struct glyph_pool *pool, struct dim matrix_dim)
else else
{ {
pool->glyphs = (struct glyph *) xmalloc (size); pool->glyphs = (struct glyph *) xmalloc (size);
bzero (pool->glyphs, size); memset (pool->glyphs, 0, size);
} }
pool->nglyphs = needed; pool->nglyphs = needed;
@ -2196,11 +2149,11 @@ save_current_matrix (struct frame *f)
struct glyph_matrix *saved; struct glyph_matrix *saved;
saved = (struct glyph_matrix *) xmalloc (sizeof *saved); saved = (struct glyph_matrix *) xmalloc (sizeof *saved);
bzero (saved, sizeof *saved); memset (saved, 0, sizeof *saved);
saved->nrows = f->current_matrix->nrows; saved->nrows = f->current_matrix->nrows;
saved->rows = (struct glyph_row *) xmalloc (saved->nrows saved->rows = (struct glyph_row *) xmalloc (saved->nrows
* sizeof *saved->rows); * sizeof *saved->rows);
bzero (saved->rows, saved->nrows * sizeof *saved->rows); memset (saved->rows, 0, saved->nrows * sizeof *saved->rows);
for (i = 0; i < saved->nrows; ++i) for (i = 0; i < saved->nrows; ++i)
{ {
@ -2208,7 +2161,7 @@ save_current_matrix (struct frame *f)
struct glyph_row *to = saved->rows + i; struct glyph_row *to = saved->rows + i;
size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph); size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph);
to->glyphs[TEXT_AREA] = (struct glyph *) xmalloc (nbytes); to->glyphs[TEXT_AREA] = (struct glyph *) xmalloc (nbytes);
bcopy (from->glyphs[TEXT_AREA], to->glyphs[TEXT_AREA], nbytes); memcpy (to->glyphs[TEXT_AREA], from->glyphs[TEXT_AREA], nbytes);
to->used[TEXT_AREA] = from->used[TEXT_AREA]; to->used[TEXT_AREA] = from->used[TEXT_AREA];
} }
@ -2229,7 +2182,7 @@ restore_current_matrix (struct frame *f, struct glyph_matrix *saved)
struct glyph_row *from = saved->rows + i; struct glyph_row *from = saved->rows + i;
struct glyph_row *to = f->current_matrix->rows + i; struct glyph_row *to = f->current_matrix->rows + i;
size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph); size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph);
bcopy (from->glyphs[TEXT_AREA], to->glyphs[TEXT_AREA], nbytes); memcpy (to->glyphs[TEXT_AREA], from->glyphs[TEXT_AREA], nbytes);
to->used[TEXT_AREA] = from->used[TEXT_AREA]; to->used[TEXT_AREA] = from->used[TEXT_AREA];
xfree (from->glyphs[TEXT_AREA]); xfree (from->glyphs[TEXT_AREA]);
} }
@ -2740,9 +2693,9 @@ build_frame_matrix_from_leaf_window (struct glyph_matrix *frame_matrix, struct w
if (current_row_p) if (current_row_p)
{ {
/* Copy window row to frame row. */ /* Copy window row to frame row. */
bcopy (window_row->glyphs[0], memcpy (frame_row->glyphs[TEXT_AREA] + window_matrix->matrix_x,
frame_row->glyphs[TEXT_AREA] + window_matrix->matrix_x, window_row->glyphs[0],
window_matrix->matrix_w * sizeof (struct glyph)); window_matrix->matrix_w * sizeof (struct glyph));
} }
else else
{ {
@ -2979,7 +2932,7 @@ mirrored_line_dance (matrix, unchanged_at_top, nlines, copy_from,
/* Make a copy of the original rows. */ /* Make a copy of the original rows. */
old_rows = (struct glyph_row *) alloca (nlines * sizeof *old_rows); old_rows = (struct glyph_row *) alloca (nlines * sizeof *old_rows);
bcopy (new_rows, old_rows, nlines * sizeof *old_rows); memcpy (old_rows, new_rows, nlines * sizeof *old_rows);
/* Assign new rows, maybe clear lines. */ /* Assign new rows, maybe clear lines. */
for (i = 0; i < nlines; ++i) for (i = 0; i < nlines; ++i)
@ -3097,7 +3050,7 @@ mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy
/* Make a copy of the original rows of matrix m. */ /* Make a copy of the original rows of matrix m. */
old_rows = (struct glyph_row *) alloca (m->nrows * sizeof *old_rows); old_rows = (struct glyph_row *) alloca (m->nrows * sizeof *old_rows);
bcopy (m->rows, old_rows, m->nrows * sizeof *old_rows); memcpy (old_rows, m->rows, m->nrows * sizeof *old_rows);
for (i = 0; i < nlines; ++i) for (i = 0; i < nlines; ++i)
{ {
@ -4563,7 +4516,7 @@ scrolling_window (struct window *w, int header_line_p)
row_table_size = next_almost_prime (3 * n); row_table_size = next_almost_prime (3 * n);
nbytes = row_table_size * sizeof *row_table; nbytes = row_table_size * sizeof *row_table;
row_table = (struct row_entry **) xrealloc (row_table, nbytes); row_table = (struct row_entry **) xrealloc (row_table, nbytes);
bzero (row_table, nbytes); memset (row_table, 0, nbytes);
} }
if (n > row_entry_pool_size) if (n > row_entry_pool_size)

View file

@ -686,7 +686,7 @@ the same file name is found in the `doc-directory'. */)
} }
pos += end - buf; pos += end - buf;
filled -= end - buf; filled -= end - buf;
bcopy (end, buf, filled); memcpy (buf, end, filled);
} }
emacs_close (fd); emacs_close (fd);
return Qnil; return Qnil;
@ -765,7 +765,7 @@ a new string, without any text properties, is returned. */)
if (len == 1) if (len == 1)
*bufp = *strp; *bufp = *strp;
else else
bcopy (strp, bufp, len); memcpy (bufp, strp, len);
strp += len; strp += len;
bufp += len; bufp += len;
nchars++; nchars++;
@ -817,7 +817,7 @@ a new string, without any text properties, is returned. */)
int offset = bufp - buf; int offset = bufp - buf;
buf = (unsigned char *) xrealloc (buf, bsize += 4); buf = (unsigned char *) xrealloc (buf, bsize += 4);
bufp = buf + offset; bufp = buf + offset;
bcopy ("M-x ", bufp, 4); memcpy (bufp, "M-x ", 4);
bufp += 4; bufp += 4;
nchars += 4; nchars += 4;
if (multibyte) if (multibyte)
@ -911,7 +911,7 @@ a new string, without any text properties, is returned. */)
int offset = bufp - buf; int offset = bufp - buf;
buf = (unsigned char *) xrealloc (buf, bsize += length_byte); buf = (unsigned char *) xrealloc (buf, bsize += length_byte);
bufp = buf + offset; bufp = buf + offset;
bcopy (start, bufp, length_byte); memcpy (bufp, start, length_byte);
bufp += length_byte; bufp += length_byte;
nchars += length; nchars += length;
/* Check STRING again in case gc relocated it. */ /* Check STRING again in case gc relocated it. */
@ -928,7 +928,7 @@ a new string, without any text properties, is returned. */)
if (len == 1) if (len == 1)
*bufp = *strp; *bufp = *strp;
else else
bcopy (strp, bufp, len); memcpy (bufp, strp, len);
strp += len; strp += len;
bufp += len; bufp += len;
nchars++; nchars++;

View file

@ -229,12 +229,12 @@ doprnt (char *buffer, register int bufsize, char *format, char *format_end, int
/* Truncate the string at character boundary. */ /* Truncate the string at character boundary. */
tem = bufsize; tem = bufsize;
while (!CHAR_HEAD_P (string[tem - 1])) tem--; while (!CHAR_HEAD_P (string[tem - 1])) tem--;
bcopy (string, bufptr, tem); memcpy (bufptr, string, tem);
/* We must calculate WIDTH again. */ /* We must calculate WIDTH again. */
width = strwidth (bufptr, tem); width = strwidth (bufptr, tem);
} }
else else
bcopy (string, bufptr, tem); memcpy (bufptr, string, tem);
bufptr += tem; bufptr += tem;
bufsize -= tem; bufsize -= tem;
if (minlen < 0) if (minlen < 0)

View file

@ -1405,7 +1405,7 @@ name, or nil if there is no such user. */)
login = Fuser_login_name (make_number (pw->pw_uid)); login = Fuser_login_name (make_number (pw->pw_uid));
r = (unsigned char *) alloca (strlen (p) + SCHARS (login) + 1); r = (unsigned char *) alloca (strlen (p) + SCHARS (login) + 1);
bcopy (p, r, q - p); memcpy (r, p, q - p);
r[q - p] = 0; r[q - p] = 0;
strcat (r, SDATA (login)); strcat (r, SDATA (login));
r[q - p] = UPCASE (r[q - p]); 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
result = make_uninit_multibyte_string (end - start, end_byte - start_byte); result = make_uninit_multibyte_string (end - start, end_byte - start_byte);
else else
result = make_uninit_string (end - start); result = make_uninit_string (end - start);
bcopy (BYTE_POS_ADDR (start_byte), SDATA (result), memcpy (SDATA (result), BYTE_POS_ADDR (start_byte), end_byte - start_byte);
end_byte - start_byte);
/* If desired, update and copy the text properties. */ /* If desired, update and copy the text properties. */
if (props) if (props)
@ -3437,7 +3436,7 @@ usage: (message-box FORMAT-STRING &rest ARGS) */)
message_length = SBYTES (val); message_length = SBYTES (val);
message_text = (char *)xrealloc (message_text, message_length); message_text = (char *)xrealloc (message_text, message_length);
} }
bcopy (SDATA (val), message_text, SBYTES (val)); memcpy (message_text, SDATA (val), SBYTES (val));
message2 (message_text, SBYTES (val), message2 (message_text, SBYTES (val),
STRING_MULTIBYTE (val)); STRING_MULTIBYTE (val));
return val; return val;
@ -3654,12 +3653,12 @@ usage: (format STRING &rest OBJECTS) */)
int i; int i;
if (!info) if (!info)
info = (struct info *) alloca (nbytes); info = (struct info *) alloca (nbytes);
bzero (info, nbytes); memset (info, 0, nbytes);
for (i = 0; i <= nargs; i++) for (i = 0; i <= nargs; i++)
info[i].start = -1; info[i].start = -1;
if (!discarded) if (!discarded)
SAFE_ALLOCA (discarded, char *, SBYTES (args[0])); SAFE_ALLOCA (discarded, char *, SBYTES (args[0]));
bzero (discarded, SBYTES (args[0])); memset (discarded, 0, SBYTES (args[0]));
} }
/* Add to TOTAL enough space to hold the converted arguments. */ /* Add to TOTAL enough space to hold the converted arguments. */
@ -3973,8 +3972,8 @@ usage: (format STRING &rest OBJECTS) */)
{ {
int this_nchars; int this_nchars;
bcopy (this_format_start, this_format, memcpy (this_format, this_format_start,
format - this_format_start); format - this_format_start);
this_format[format - this_format_start] = 0; this_format[format - this_format_start] = 0;
if (format[-1] == 'e' || format[-1] == 'f' || format[-1] == 'g') if (format[-1] == 'e' || format[-1] == 'f' || format[-1] == 'g')
@ -4451,9 +4450,9 @@ Transposing beyond buffer boundaries is an error. */)
start1_addr = BYTE_POS_ADDR (start1_byte); start1_addr = BYTE_POS_ADDR (start1_byte);
start2_addr = BYTE_POS_ADDR (start2_byte); start2_addr = BYTE_POS_ADDR (start2_byte);
bcopy (start2_addr, temp, len2_byte); memcpy (temp, start2_addr, len2_byte);
bcopy (start1_addr, start1_addr + len2_byte, len1_byte); memcpy (start1_addr + len2_byte, start1_addr, len1_byte);
bcopy (temp, start1_addr, len2_byte); memcpy (start1_addr, temp, len2_byte);
SAFE_FREE (); SAFE_FREE ();
} }
else else
@ -4464,9 +4463,9 @@ Transposing beyond buffer boundaries is an error. */)
SAFE_ALLOCA (temp, unsigned char *, len1_byte); SAFE_ALLOCA (temp, unsigned char *, len1_byte);
start1_addr = BYTE_POS_ADDR (start1_byte); start1_addr = BYTE_POS_ADDR (start1_byte);
start2_addr = BYTE_POS_ADDR (start2_byte); start2_addr = BYTE_POS_ADDR (start2_byte);
bcopy (start1_addr, temp, len1_byte); memcpy (temp, start1_addr, len1_byte);
bcopy (start2_addr, start1_addr, len2_byte); memcpy (start1_addr, start2_addr, len2_byte);
bcopy (temp, start1_addr + len2_byte, len1_byte); memcpy (start1_addr + len2_byte, temp, len1_byte);
SAFE_FREE (); SAFE_FREE ();
} }
graft_intervals_into_buffer (tmp_interval1, start1 + len2, graft_intervals_into_buffer (tmp_interval1, start1 + len2,
@ -4504,9 +4503,9 @@ Transposing beyond buffer boundaries is an error. */)
SAFE_ALLOCA (temp, unsigned char *, len1_byte); SAFE_ALLOCA (temp, unsigned char *, len1_byte);
start1_addr = BYTE_POS_ADDR (start1_byte); start1_addr = BYTE_POS_ADDR (start1_byte);
start2_addr = BYTE_POS_ADDR (start2_byte); start2_addr = BYTE_POS_ADDR (start2_byte);
bcopy (start1_addr, temp, len1_byte); memcpy (temp, start1_addr, len1_byte);
bcopy (start2_addr, start1_addr, len2_byte); memcpy (start1_addr, start2_addr, len2_byte);
bcopy (temp, start2_addr, len1_byte); memcpy (start2_addr, temp, len1_byte);
SAFE_FREE (); SAFE_FREE ();
graft_intervals_into_buffer (tmp_interval1, start2, graft_intervals_into_buffer (tmp_interval1, start2,
@ -4534,10 +4533,10 @@ Transposing beyond buffer boundaries is an error. */)
SAFE_ALLOCA (temp, unsigned char *, len2_byte); SAFE_ALLOCA (temp, unsigned char *, len2_byte);
start1_addr = BYTE_POS_ADDR (start1_byte); start1_addr = BYTE_POS_ADDR (start1_byte);
start2_addr = BYTE_POS_ADDR (start2_byte); start2_addr = BYTE_POS_ADDR (start2_byte);
bcopy (start2_addr, temp, len2_byte); memcpy (temp, start2_addr, len2_byte);
bcopy (start1_addr, start1_addr + len_mid + len2_byte, len1_byte); memcpy (start1_addr + len_mid + len2_byte, start1_addr, len1_byte);
safe_bcopy (start1_addr + len1_byte, start1_addr + len2_byte, len_mid); memmove (start1_addr + len2_byte, start1_addr + len1_byte, len_mid);
bcopy (temp, start1_addr, len2_byte); memcpy (start1_addr, temp, len2_byte);
SAFE_FREE (); SAFE_FREE ();
graft_intervals_into_buffer (tmp_interval1, end2 - len1, graft_intervals_into_buffer (tmp_interval1, end2 - len1,
@ -4567,10 +4566,10 @@ Transposing beyond buffer boundaries is an error. */)
SAFE_ALLOCA (temp, unsigned char *, len1_byte); SAFE_ALLOCA (temp, unsigned char *, len1_byte);
start1_addr = BYTE_POS_ADDR (start1_byte); start1_addr = BYTE_POS_ADDR (start1_byte);
start2_addr = BYTE_POS_ADDR (start2_byte); start2_addr = BYTE_POS_ADDR (start2_byte);
bcopy (start1_addr, temp, len1_byte); memcpy (temp, start1_addr, len1_byte);
bcopy (start2_addr, start1_addr, len2_byte); memcpy (start1_addr, start2_addr, len2_byte);
bcopy (start1_addr + len1_byte, start1_addr + len2_byte, len_mid); memcpy (start1_addr + len2_byte, start1_addr + len1_byte, len_mid);
bcopy (temp, start1_addr + len2_byte + len_mid, len1_byte); memcpy (start1_addr + len2_byte + len_mid, temp, len1_byte);
SAFE_FREE (); SAFE_FREE ();
graft_intervals_into_buffer (tmp_interval1, end2 - len1, graft_intervals_into_buffer (tmp_interval1, end2 - len1,

View file

@ -1761,13 +1761,14 @@ main (int argc, char **argv)
extern char etext; extern char etext;
#endif #endif
extern void safe_bcopy (); extern void safe_bcopy ();
extern void dump_opcode_frequencies ();
atexit (_mcleanup); atexit (_mcleanup);
/* This uses safe_bcopy because that function comes first in the /* This uses safe_bcopy because that function comes first in the
Emacs executable. It might be better to use something that Emacs executable. It might be better to use something that
gives the start of the text segment, but start_of_text is not gives the start of the text segment, but start_of_text is not
defined on all systems now. */ defined on all systems now. */
/* FIXME: Does not work on architectures with function
descriptors. */
monstartup (safe_bcopy, &etext); monstartup (safe_bcopy, &etext);
} }
else else
@ -2058,7 +2059,7 @@ sort_args (int argc, char **argv)
while (to < argc) while (to < argc)
new[to++] = 0; new[to++] = 0;
bcopy (new, argv, sizeof (char *) * argc); memcpy (argv, new, sizeof (char *) * argc);
xfree (options); xfree (options);
xfree (new); xfree (new);

View file

@ -2529,7 +2529,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
gcpro1.nvars = 1 + numargs; gcpro1.nvars = 1 + numargs;
} }
bcopy (args, funcall_args, nargs * sizeof (Lisp_Object)); memcpy (funcall_args, args, nargs * sizeof (Lisp_Object));
/* Spread the last arg we got. Its first element goes in /* Spread the last arg we got. Its first element goes in
the slot that it used to occupy, hence this value of I. */ the slot that it used to occupy, hence this value of I. */
i = nargs - 1; i = nargs - 1;
@ -3018,7 +3018,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
if (XSUBR (fun)->max_args > numargs) if (XSUBR (fun)->max_args > numargs)
{ {
internal_args = (Lisp_Object *) alloca (XSUBR (fun)->max_args * sizeof (Lisp_Object)); internal_args = (Lisp_Object *) alloca (XSUBR (fun)->max_args * sizeof (Lisp_Object));
bcopy (args + 1, internal_args, numargs * sizeof (Lisp_Object)); memcpy (internal_args, args + 1, numargs * sizeof (Lisp_Object));
for (i = numargs; i < XSUBR (fun)->max_args; i++) for (i = numargs; i < XSUBR (fun)->max_args; i++)
internal_args[i] = Qnil; internal_args[i] = Qnil;
} }

View file

@ -425,7 +425,7 @@ Given a Unix syntax file name, returns a string ending in slash. */)
filename = FILE_SYSTEM_CASE (filename); filename = FILE_SYSTEM_CASE (filename);
#ifdef DOS_NT #ifdef DOS_NT
beg = (unsigned char *) alloca (SBYTES (filename) + 1); beg = (unsigned char *) alloca (SBYTES (filename) + 1);
bcopy (SDATA (filename), beg, SBYTES (filename) + 1); memcpy (beg, SDATA (filename), SBYTES (filename) + 1);
#else #else
beg = SDATA (filename); beg = SDATA (filename);
#endif #endif
@ -725,10 +725,10 @@ make_temp_name (Lisp_Object prefix, int base64_p)
if (!STRING_MULTIBYTE (prefix)) if (!STRING_MULTIBYTE (prefix))
STRING_SET_UNIBYTE (val); STRING_SET_UNIBYTE (val);
data = SDATA (val); data = SDATA (val);
bcopy(SDATA (prefix), data, len); memcpy (data, SDATA (prefix), len);
p = data + len; p = data + len;
bcopy (pidbuf, p, pidlen); memcpy (p, pidbuf, pidlen);
p += pidlen; p += pidlen;
/* Here we try to minimize useless stat'ing when this function is /* Here we try to minimize useless stat'ing when this function is
@ -939,7 +939,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
/* Make a local copy of nm[] to protect it from GC in DECODE_FILE below. */ /* Make a local copy of nm[] to protect it from GC in DECODE_FILE below. */
nm = (unsigned char *) alloca (SBYTES (name) + 1); nm = (unsigned char *) alloca (SBYTES (name) + 1);
bcopy (SDATA (name), nm, SBYTES (name) + 1); memcpy (nm, SDATA (name), SBYTES (name) + 1);
#ifdef DOS_NT #ifdef DOS_NT
/* Note if special escape prefix is present, but remove for now. */ /* Note if special escape prefix is present, but remove for now. */
@ -1093,7 +1093,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
unsigned char *o, *p; unsigned char *o, *p;
for (p = nm; *p && (!IS_DIRECTORY_SEP (*p)); p++); for (p = nm; *p && (!IS_DIRECTORY_SEP (*p)); p++);
o = alloca (p - nm + 1); o = alloca (p - nm + 1);
bcopy ((char *) nm, o, p - nm); memcpy (o, nm, p - nm);
o [p - nm] = 0; o [p - nm] = 0;
BLOCK_INPUT; BLOCK_INPUT;
@ -1244,7 +1244,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
) )
{ {
unsigned char *temp = (unsigned char *) alloca (length); unsigned char *temp = (unsigned char *) alloca (length);
bcopy (newdir, temp, length - 1); memcpy (temp, newdir, length - 1);
temp[length - 1] = 0; temp[length - 1] = 0;
newdir = temp; newdir = temp;
} }
@ -1467,7 +1467,7 @@ See also the function `substitute-in-file-name'.")
int len = ptr ? ptr - user : strlen (user); int len = ptr ? ptr - user : strlen (user);
/* Copy the user name into temp storage. */ /* Copy the user name into temp storage. */
o = (unsigned char *) alloca (len + 1); o = (unsigned char *) alloca (len + 1);
bcopy ((char *) user, o, len); memcpy (o, user, len);
o[len] = 0; o[len] = 0;
/* Look up the user name. */ /* Look up the user name. */
@ -1583,7 +1583,7 @@ search_embedded_absfilename (unsigned char *nm, unsigned char *endp)
{ {
unsigned char *o = alloca (s - p + 1); unsigned char *o = alloca (s - p + 1);
struct passwd *pw; struct passwd *pw;
bcopy (p, o, s - p); memcpy (o, p, s - p);
o [s - p] = 0; o [s - p] = 0;
/* If we have ~user and `user' exists, discard /* If we have ~user and `user' exists, discard
@ -1640,7 +1640,7 @@ those `/' is discarded. */)
decode of environment variables, causing the original Lisp_String decode of environment variables, causing the original Lisp_String
data to be relocated. */ data to be relocated. */
nm = (unsigned char *) alloca (SBYTES (filename) + 1); nm = (unsigned char *) alloca (SBYTES (filename) + 1);
bcopy (SDATA (filename), nm, SBYTES (filename) + 1); memcpy (nm, SDATA (filename), SBYTES (filename) + 1);
#ifdef DOS_NT #ifdef DOS_NT
dostounix_filename (nm); dostounix_filename (nm);
@ -2733,7 +2733,7 @@ points to a nonexistent file. */)
{ {
bufsize *= 2; bufsize *= 2;
buf = (char *) xrealloc (buf, bufsize); buf = (char *) xrealloc (buf, bufsize);
bzero (buf, bufsize); memset (buf, 0, bufsize);
errno = 0; errno = 0;
valsize = readlink (SDATA (filename), buf, bufsize); valsize = readlink (SDATA (filename), buf, bufsize);
@ -3837,7 +3837,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
conversion_buffer); conversion_buffer);
unprocessed = coding.carryover_bytes; unprocessed = coding.carryover_bytes;
if (coding.carryover_bytes > 0) if (coding.carryover_bytes > 0)
bcopy (coding.carryover, read_buf, unprocessed); memcpy (read_buf, coding.carryover, unprocessed);
} }
UNGCPRO; UNGCPRO;
emacs_close (fd); emacs_close (fd);
@ -5245,7 +5245,7 @@ auto_save_error (Lisp_Object error)
GCPRO1 (msg); GCPRO1 (msg);
nbytes = SBYTES (msg); nbytes = SBYTES (msg);
SAFE_ALLOCA (msgbuf, char *, nbytes); SAFE_ALLOCA (msgbuf, char *, nbytes);
bcopy (SDATA (msg), msgbuf, nbytes); memcpy (msgbuf, SDATA (msg), nbytes);
for (i = 0; i < 3; ++i) for (i = 0; i < 3; ++i)
{ {

View file

@ -233,7 +233,7 @@ Symbols are also allowed; their print names are used instead. */)
if (SCHARS (s1) != SCHARS (s2) if (SCHARS (s1) != SCHARS (s2)
|| SBYTES (s1) != SBYTES (s2) || SBYTES (s1) != SBYTES (s2)
|| bcmp (SDATA (s1), SDATA (s2), SBYTES (s1))) || memcmp (SDATA (s1), SDATA (s2), SBYTES (s1)))
return Qnil; return Qnil;
return Qt; return Qt;
} }
@ -469,8 +469,8 @@ with the original. */)
/ BOOL_VECTOR_BITS_PER_CHAR); / BOOL_VECTOR_BITS_PER_CHAR);
val = Fmake_bool_vector (Flength (arg), Qnil); val = Fmake_bool_vector (Flength (arg), Qnil);
bcopy (XBOOL_VECTOR (arg)->data, XBOOL_VECTOR (val)->data, memcpy (XBOOL_VECTOR (val)->data, XBOOL_VECTOR (arg)->data,
size_in_chars); size_in_chars);
return val; return val;
} }
@ -637,8 +637,7 @@ concat (int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_speci
{ {
int thislen_byte = SBYTES (this); int thislen_byte = SBYTES (this);
bcopy (SDATA (this), SDATA (val) + toindex_byte, memcpy (SDATA (val) + toindex_byte, SDATA (this), SBYTES (this));
SBYTES (this));
if (! NULL_INTERVAL_P (STRING_INTERVALS (this))) if (! NULL_INTERVAL_P (STRING_INTERVALS (this)))
{ {
textprops[num_textprops].argnum = argnum; textprops[num_textprops].argnum = argnum;
@ -953,7 +952,7 @@ string_to_multibyte (Lisp_Object string)
return make_multibyte_string (SDATA (string), nbytes, nbytes); return make_multibyte_string (SDATA (string), nbytes, nbytes);
SAFE_ALLOCA (buf, unsigned char *, nbytes); SAFE_ALLOCA (buf, unsigned char *, nbytes);
bcopy (SDATA (string), buf, SBYTES (string)); memcpy (buf, SDATA (string), SBYTES (string));
str_to_multibyte (buf, nbytes, SBYTES (string)); str_to_multibyte (buf, nbytes, SBYTES (string));
ret = make_multibyte_string (buf, SCHARS (string), nbytes); ret = make_multibyte_string (buf, SCHARS (string), nbytes);
@ -1039,7 +1038,7 @@ If STRING is multibyte and contains a character of charset
int bytes = SBYTES (string); int bytes = SBYTES (string);
unsigned char *str = (unsigned char *) xmalloc (bytes); unsigned char *str = (unsigned char *) xmalloc (bytes);
bcopy (SDATA (string), str, bytes); memcpy (str, SDATA (string), bytes);
bytes = str_as_unibyte (str, bytes); bytes = str_as_unibyte (str, bytes);
string = make_unibyte_string (str, bytes); string = make_unibyte_string (str, bytes);
xfree (str); xfree (str);
@ -1076,8 +1075,7 @@ If you're not sure, whether to use `string-as-multibyte' or
SBYTES (string), SBYTES (string),
&nchars, &nbytes); &nchars, &nbytes);
new_string = make_uninit_multibyte_string (nchars, nbytes); new_string = make_uninit_multibyte_string (nchars, nbytes);
bcopy (SDATA (string), SDATA (new_string), memcpy (SDATA (new_string), SDATA (string), SBYTES (string));
SBYTES (string));
if (nbytes != SBYTES (string)) if (nbytes != SBYTES (string))
str_as_multibyte (SDATA (new_string), nbytes, str_as_multibyte (SDATA (new_string), nbytes,
SBYTES (string), NULL); SBYTES (string), NULL);
@ -2170,8 +2168,8 @@ internal_equal (register Lisp_Object o1, register Lisp_Object o2, int depth, int
if (XBOOL_VECTOR (o1)->size != XBOOL_VECTOR (o2)->size) if (XBOOL_VECTOR (o1)->size != XBOOL_VECTOR (o2)->size)
return 0; return 0;
if (bcmp (XBOOL_VECTOR (o1)->data, XBOOL_VECTOR (o2)->data, if (memcmp (XBOOL_VECTOR (o1)->data, XBOOL_VECTOR (o2)->data,
size_in_chars)) size_in_chars))
return 0; return 0;
return 1; return 1;
} }
@ -2205,8 +2203,7 @@ internal_equal (register Lisp_Object o1, register Lisp_Object o2, int depth, int
return 0; return 0;
if (SBYTES (o1) != SBYTES (o2)) if (SBYTES (o1) != SBYTES (o2))
return 0; return 0;
if (bcmp (SDATA (o1), SDATA (o2), if (memcmp (SDATA (o1), SDATA (o2), SBYTES (o1)))
SBYTES (o1)))
return 0; return 0;
if (props && !compare_string_intervals (o1, o2)) if (props && !compare_string_intervals (o1, o2))
return 0; return 0;
@ -2304,7 +2301,7 @@ This makes STRING unibyte and may change its length. */)
int len; int len;
CHECK_STRING (string); CHECK_STRING (string);
len = SBYTES (string); len = SBYTES (string);
bzero (SDATA (string), len); memset (SDATA (string), 0, len);
STRING_SET_CHARS (string, len); STRING_SET_CHARS (string, len);
STRING_SET_UNIBYTE (string); STRING_SET_UNIBYTE (string);
return Qnil; return Qnil;
@ -3709,8 +3706,7 @@ larger_vector (Lisp_Object vec, int new_size, Lisp_Object init)
xassert (new_size >= old_size); xassert (new_size >= old_size);
v = allocate_vector (new_size); v = allocate_vector (new_size);
bcopy (XVECTOR (vec)->contents, v->contents, memcpy (v->contents, XVECTOR (vec)->contents, old_size * sizeof *v->contents);
old_size * sizeof *v->contents);
for (i = old_size; i < new_size; ++i) for (i = old_size; i < new_size; ++i)
v->contents[i] = init; v->contents[i] = init;
XSETVECTOR (vec, v); XSETVECTOR (vec, v);
@ -3947,7 +3943,7 @@ copy_hash_table (struct Lisp_Hash_Table *h1)
h2 = allocate_hash_table (); h2 = allocate_hash_table ();
next = h2->vec_next; next = h2->vec_next;
bcopy (h1, h2, sizeof *h2); memcpy (h2, h1, sizeof *h2);
h2->vec_next = next; h2->vec_next = next;
h2->key_and_value = Fcopy_sequence (h1->key_and_value); h2->key_and_value = Fcopy_sequence (h1->key_and_value);
h2->hash = Fcopy_sequence (h1->hash); h2->hash = Fcopy_sequence (h1->hash);
@ -4553,7 +4549,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */)
/* The vector `used' is used to keep track of arguments that /* The vector `used' is used to keep track of arguments that
have been consumed. */ have been consumed. */
used = (char *) alloca (nargs * sizeof *used); used = (char *) alloca (nargs * sizeof *used);
bzero (used, nargs * sizeof *used); memset (used, 0, nargs * sizeof *used);
/* See if there's a `:test TEST' among the arguments. */ /* See if there's a `:test TEST' among the arguments. */
i = get_key_arg (QCtest, nargs, args, used); i = get_key_arg (QCtest, nargs, args, used);

View file

@ -1493,7 +1493,7 @@ If BITMAP already exists, the existing definition is replaced. */)
xfb = (struct fringe_bitmap *) xmalloc (sizeof fb xfb = (struct fringe_bitmap *) xmalloc (sizeof fb
+ fb.height * BYTES_PER_BITMAP_ROW); + fb.height * BYTES_PER_BITMAP_ROW);
fb.bits = b = (unsigned short *) (xfb + 1); fb.bits = b = (unsigned short *) (xfb + 1);
bzero (b, fb.height); memset (b, 0, fb.height);
j = 0; j = 0;
while (j < fb.height) while (j < fb.height)

View file

@ -1365,7 +1365,7 @@ ftfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct
if (ftfont_info->ft_size != ft_face->size) if (ftfont_info->ft_size != ft_face->size)
FT_Activate_Size (ftfont_info->ft_size); FT_Activate_Size (ftfont_info->ft_size);
if (metrics) if (metrics)
bzero (metrics, sizeof (struct font_metrics)); memset (metrics, 0, sizeof (struct font_metrics));
for (i = 0, first = 1; i < nglyphs; i++) for (i = 0, first = 1; i < nglyphs; i++)
{ {
if (FT_Load_Glyph (ft_face, code[i], FT_LOAD_DEFAULT) == 0) if (FT_Load_Glyph (ft_face, code[i], FT_LOAD_DEFAULT) == 0)

View file

@ -713,7 +713,7 @@ getloadavg (loadavg, nelem)
for (i = 0; i < conf.config_maxclass; ++i) for (i = 0; i < conf.config_maxclass; ++i)
{ {
struct class_stats stats; struct class_stats stats;
bzero ((char *) &stats, sizeof stats); memset (&stats, 0, sizeof stats);
desc.sd_type = CPUTYPE_CLASS; desc.sd_type = CPUTYPE_CLASS;
desc.sd_objid = i; desc.sd_objid = i;

View file

@ -625,7 +625,7 @@ define_image_type (struct image_type *type, int loaded)
/* Make a copy of TYPE to avoid a bus error in a dumped Emacs. /* Make a copy of TYPE to avoid a bus error in a dumped Emacs.
The initialized data segment is read-only. */ The initialized data segment is read-only. */
struct image_type *p = (struct image_type *) xmalloc (sizeof *p); struct image_type *p = (struct image_type *) xmalloc (sizeof *p);
bcopy (type, p, sizeof *p); memcpy (p, type, sizeof *p);
p->next = image_types; p->next = image_types;
image_types = p; image_types = p;
success = Qt; success = Qt;
@ -1020,7 +1020,7 @@ make_image (Lisp_Object spec, unsigned int hash)
Lisp_Object file = image_spec_value (spec, QCfile, NULL); Lisp_Object file = image_spec_value (spec, QCfile, NULL);
xassert (valid_image_p (spec)); xassert (valid_image_p (spec));
bzero (img, sizeof *img); memset (img, 0, sizeof *img);
img->dependencies = NILP (file) ? Qnil : list1 (file); img->dependencies = NILP (file) ? Qnil : list1 (file);
img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL)); img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL));
xassert (img->type != NULL); xassert (img->type != NULL);
@ -1424,12 +1424,12 @@ make_image_cache (void)
struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c); struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c);
int size; int size;
bzero (c, sizeof *c); memset (c, 0, sizeof *c);
c->size = 50; c->size = 50;
c->images = (struct image **) xmalloc (c->size * sizeof *c->images); c->images = (struct image **) xmalloc (c->size * sizeof *c->images);
size = IMAGE_CACHE_BUCKETS_SIZE * sizeof *c->buckets; size = IMAGE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
c->buckets = (struct image **) xmalloc (size); c->buckets = (struct image **) xmalloc (size);
bzero (c->buckets, size); memset (c->buckets, 0, size);
return c; return c;
} }
@ -2048,8 +2048,8 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
return 0; return 0;
} }
header = &((*ximg)->info.bmiHeader); header = &(*ximg)->info.bmiHeader;
bzero (&((*ximg)->info), sizeof (BITMAPINFO)); memset (&(*ximg)->info, 0, sizeof (BITMAPINFO));
header->biSize = sizeof (*header); header->biSize = sizeof (*header);
header->biWidth = width; header->biWidth = width;
header->biHeight = -height; /* negative indicates a top-down bitmap. */ header->biHeight = -height; /* negative indicates a top-down bitmap. */
@ -2353,7 +2353,7 @@ xbm_image_p (Lisp_Object object)
{ {
struct image_keyword kw[XBM_LAST]; struct image_keyword kw[XBM_LAST];
bcopy (xbm_format, kw, sizeof kw); memcpy (kw, xbm_format, sizeof kw);
if (!parse_image_spec (object, kw, XBM_LAST, Qxbm)) if (!parse_image_spec (object, kw, XBM_LAST, Qxbm))
return 0; return 0;
@ -2543,7 +2543,7 @@ w32_create_pixmap_from_bitmap_data (int width, int height, char *data)
w1 = (width + 7) / 8; /* nb of 8bits elt in X bitmap */ w1 = (width + 7) / 8; /* nb of 8bits elt in X bitmap */
w2 = ((width + 15) / 16) * 2; /* nb of 16bits elt in W32 bitmap */ w2 = ((width + 15) / 16) * 2; /* nb of 16bits elt in W32 bitmap */
bits = (unsigned char *) alloca (height * w2); bits = (unsigned char *) alloca (height * w2);
bzero (bits, height * w2); memset (bits, 0, height * w2);
for (i = 0; i < height; i++) for (i = 0; i < height; i++)
{ {
p = bits + i*w2; p = bits + i*w2;
@ -2918,7 +2918,7 @@ xbm_load (struct frame *f, struct image *img)
in_memory_file_p = xbm_file_p (data); in_memory_file_p = xbm_file_p (data);
/* Parse the image specification. */ /* Parse the image specification. */
bcopy (xbm_format, fmt, sizeof fmt); memcpy (fmt, xbm_format, sizeof fmt);
parsed_p = parse_image_spec (img->spec, fmt, XBM_LAST, Qxbm); parsed_p = parse_image_spec (img->spec, fmt, XBM_LAST, Qxbm);
xassert (parsed_p); xassert (parsed_p);
@ -2964,9 +2964,9 @@ xbm_load (struct frame *f, struct image *img)
{ {
Lisp_Object line = XVECTOR (data)->contents[i]; Lisp_Object line = XVECTOR (data)->contents[i];
if (STRINGP (line)) if (STRINGP (line))
bcopy (SDATA (line), p, nbytes); memcpy (p, SDATA (line), nbytes);
else else
bcopy (XBOOL_VECTOR (line)->data, p, nbytes); memcpy (p, XBOOL_VECTOR (line)->data, nbytes);
} }
} }
else if (STRINGP (data)) else if (STRINGP (data))
@ -3248,7 +3248,7 @@ xpm_lookup_color (struct frame *f, char *color_name, XColor *color)
with transparency, and it's useful. */ with transparency, and it's useful. */
else if (strcmp ("opaque", color_name) == 0) else if (strcmp ("opaque", color_name) == 0)
{ {
bzero (color, sizeof (XColor)); /* Is this necessary/correct? */ memset (color, 0, sizeof (XColor)); /* Is this necessary/correct? */
color->pixel = FRAME_FOREGROUND_PIXEL (f); color->pixel = FRAME_FOREGROUND_PIXEL (f);
p = xpm_cache_color (f, color_name, color, h); p = xpm_cache_color (f, color_name, color, h);
} }
@ -3337,7 +3337,7 @@ static int
xpm_image_p (Lisp_Object object) xpm_image_p (Lisp_Object object)
{ {
struct image_keyword fmt[XPM_LAST]; struct image_keyword fmt[XPM_LAST];
bcopy (xpm_format, fmt, sizeof fmt); memcpy (fmt, xpm_format, sizeof fmt);
return (parse_image_spec (object, fmt, XPM_LAST, Qxpm) return (parse_image_spec (object, fmt, XPM_LAST, Qxpm)
/* Either `:file' or `:data' must be present. */ /* Either `:file' or `:data' must be present. */
&& fmt[XPM_FILE].count + fmt[XPM_DATA].count == 1 && fmt[XPM_FILE].count + fmt[XPM_DATA].count == 1
@ -3358,7 +3358,7 @@ x_create_bitmap_from_xpm_data (struct frame *f, char **bits)
XpmAttributes attrs; XpmAttributes attrs;
Pixmap bitmap, mask; Pixmap bitmap, mask;
bzero (&attrs, sizeof attrs); memset (&attrs, 0, sizeof attrs);
attrs.visual = FRAME_X_VISUAL (f); attrs.visual = FRAME_X_VISUAL (f);
attrs.colormap = FRAME_X_COLORMAP (f); attrs.colormap = FRAME_X_COLORMAP (f);
@ -3406,7 +3406,7 @@ xpm_load (struct frame *f, struct image *img)
/* Configure the XPM lib. Use the visual of frame F. Allocate /* Configure the XPM lib. Use the visual of frame F. Allocate
close colors. Return colors allocated. */ close colors. Return colors allocated. */
bzero (&attrs, sizeof attrs); memset (&attrs, 0, sizeof attrs);
#ifndef HAVE_NTGUI #ifndef HAVE_NTGUI
attrs.visual = FRAME_X_VISUAL (f); attrs.visual = FRAME_X_VISUAL (f);
@ -3453,7 +3453,7 @@ xpm_load (struct frame *f, struct image *img)
/* Allocate an XpmColorSymbol array. */ /* Allocate an XpmColorSymbol array. */
size = attrs.numsymbols * sizeof *xpm_syms; size = attrs.numsymbols * sizeof *xpm_syms;
xpm_syms = (XpmColorSymbol *) alloca (size); xpm_syms = (XpmColorSymbol *) alloca (size);
bzero (xpm_syms, size); memset (xpm_syms, 0, size);
attrs.colorsymbols = xpm_syms; attrs.colorsymbols = xpm_syms;
/* Fill the color symbol array. */ /* Fill the color symbol array. */
@ -4152,7 +4152,7 @@ init_color_table (void)
{ {
int size = CT_SIZE * sizeof (*ct_table); int size = CT_SIZE * sizeof (*ct_table);
ct_table = (struct ct_color **) xmalloc (size); ct_table = (struct ct_color **) xmalloc (size);
bzero (ct_table, size); memset (ct_table, 0, size);
ct_colors_allocated = 0; ct_colors_allocated = 0;
} }
@ -4848,7 +4848,7 @@ x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how)
/* Create the bit array serving as mask. */ /* Create the bit array serving as mask. */
row_width = (img->width + 7) / 8; row_width = (img->width + 7) / 8;
mask_img = xmalloc (row_width * img->height); mask_img = xmalloc (row_width * img->height);
bzero (mask_img, row_width * img->height); memset (mask_img, 0, row_width * img->height);
/* Create a memory device context for IMG->pixmap. */ /* Create a memory device context for IMG->pixmap. */
frame_dc = get_frame_dc (f); frame_dc = get_frame_dc (f);
@ -5000,7 +5000,7 @@ pbm_image_p (Lisp_Object object)
{ {
struct image_keyword fmt[PBM_LAST]; struct image_keyword fmt[PBM_LAST];
bcopy (pbm_format, fmt, sizeof fmt); memcpy (fmt, pbm_format, sizeof fmt);
if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm)) if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm))
return 0; return 0;
@ -5212,7 +5212,7 @@ pbm_load (struct frame *f, struct image *img)
unsigned long bg = FRAME_BACKGROUND_PIXEL (f); unsigned long bg = FRAME_BACKGROUND_PIXEL (f);
/* Parse the image specification. */ /* Parse the image specification. */
bcopy (pbm_format, fmt, sizeof fmt); memcpy (fmt, pbm_format, sizeof fmt);
parse_image_spec (img->spec, fmt, PBM_LAST, Qpbm); parse_image_spec (img->spec, fmt, PBM_LAST, Qpbm);
/* Get foreground and background colors, maybe allocate colors. */ /* Get foreground and background colors, maybe allocate colors. */
@ -5415,7 +5415,7 @@ static int
png_image_p (Lisp_Object object) png_image_p (Lisp_Object object)
{ {
struct image_keyword fmt[PNG_LAST]; struct image_keyword fmt[PNG_LAST];
bcopy (png_format, fmt, sizeof fmt); memcpy (fmt, png_format, sizeof fmt);
if (!parse_image_spec (object, fmt, PNG_LAST, Qpng)) if (!parse_image_spec (object, fmt, PNG_LAST, Qpng))
return 0; return 0;
@ -5554,7 +5554,7 @@ png_read_from_memory (png_structp png_ptr, png_bytep data, png_size_t length)
if (length > tbr->len - tbr->index) if (length > tbr->len - tbr->index)
fn_png_error (png_ptr, "Read error"); fn_png_error (png_ptr, "Read error");
bcopy (tbr->bytes + tbr->index, data, length); memcpy (data, tbr->bytes + tbr->index, length);
tbr->index = tbr->index + length; tbr->index = tbr->index + length;
} }
@ -5756,7 +5756,7 @@ png_load (struct frame *f, struct image *img)
{ {
png_color_16 user_bg; png_color_16 user_bg;
bzero (&user_bg, sizeof user_bg); memset (&user_bg, 0, sizeof user_bg);
user_bg.red = color.red >> shift; user_bg.red = color.red >> shift;
user_bg.green = color.green >> shift; user_bg.green = color.green >> shift;
user_bg.blue = color.blue >> shift; user_bg.blue = color.blue >> shift;
@ -5776,7 +5776,7 @@ png_load (struct frame *f, struct image *img)
color.pixel = FRAME_BACKGROUND_PIXEL (f); color.pixel = FRAME_BACKGROUND_PIXEL (f);
x_query_color (f, &color); x_query_color (f, &color);
bzero (&frame_background, sizeof frame_background); memset (&frame_background, 0, sizeof frame_background);
frame_background.red = color.red >> shift; frame_background.red = color.red >> shift;
frame_background.green = color.green >> shift; frame_background.green = color.green >> shift;
frame_background.blue = color.blue >> shift; frame_background.blue = color.blue >> shift;
@ -6005,7 +6005,7 @@ jpeg_image_p (Lisp_Object object)
{ {
struct image_keyword fmt[JPEG_LAST]; struct image_keyword fmt[JPEG_LAST];
bcopy (jpeg_format, fmt, sizeof fmt); memcpy (fmt, jpeg_format, sizeof fmt);
if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg)) if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg))
return 0; return 0;
@ -6561,7 +6561,7 @@ static int
tiff_image_p (Lisp_Object object) tiff_image_p (Lisp_Object object)
{ {
struct image_keyword fmt[TIFF_LAST]; struct image_keyword fmt[TIFF_LAST];
bcopy (tiff_format, fmt, sizeof fmt); memcpy (fmt, tiff_format, sizeof fmt);
if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff)) if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff))
return 0; return 0;
@ -6644,7 +6644,7 @@ tiff_read_from_memory (thandle_t data, tdata_t buf, tsize_t size)
if (size > src->len - src->index) if (size > src->len - src->index)
return (size_t) -1; return (size_t) -1;
bcopy (src->bytes + src->index, buf, size); memcpy (buf, src->bytes + src->index, size);
src->index += size; src->index += size;
return size; return size;
} }
@ -6999,7 +6999,7 @@ static int
gif_image_p (Lisp_Object object) gif_image_p (Lisp_Object object)
{ {
struct image_keyword fmt[GIF_LAST]; struct image_keyword fmt[GIF_LAST];
bcopy (gif_format, fmt, sizeof fmt); memcpy (fmt, gif_format, sizeof fmt);
if (!parse_image_spec (object, fmt, GIF_LAST, Qgif)) if (!parse_image_spec (object, fmt, GIF_LAST, Qgif))
return 0; return 0;
@ -7086,7 +7086,7 @@ gif_read_from_memory (GifFileType *file, GifByteType *buf, int len)
if (len > src->len - src->index) if (len > src->len - src->index)
return -1; return -1;
bcopy (src->bytes + src->index, buf, len); memcpy (buf, src->bytes + src->index, len);
src->index += len; src->index += len;
return len; return len;
} }
@ -7222,7 +7222,7 @@ gif_load (struct frame *f, struct image *img)
if (!gif_color_map) if (!gif_color_map)
gif_color_map = gif->SColorMap; gif_color_map = gif->SColorMap;
init_color_table (); init_color_table ();
bzero (pixel_colors, sizeof pixel_colors); memset (pixel_colors, 0, sizeof pixel_colors);
if (gif_color_map) if (gif_color_map)
for (i = 0; i < gif_color_map->ColorCount; ++i) for (i = 0; i < gif_color_map->ColorCount; ++i)
@ -7432,7 +7432,7 @@ static int
svg_image_p (Lisp_Object object) svg_image_p (Lisp_Object object)
{ {
struct image_keyword fmt[SVG_LAST]; struct image_keyword fmt[SVG_LAST];
bcopy (svg_format, fmt, sizeof fmt); memcpy (fmt, svg_format, sizeof fmt);
if (!parse_image_spec (object, fmt, SVG_LAST, Qsvg)) if (!parse_image_spec (object, fmt, SVG_LAST, Qsvg))
return 0; return 0;
@ -7839,7 +7839,7 @@ gs_image_p (Lisp_Object object)
Lisp_Object tem; Lisp_Object tem;
int i; int i;
bcopy (gs_format, fmt, sizeof fmt); memcpy (fmt, gs_format, sizeof fmt);
if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript)) if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript))
return 0; return 0;

View file

@ -546,7 +546,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
w = ! NILP (window) ? XWINDOW (window) : NULL; w = ! NILP (window) ? XWINDOW (window) : NULL;
if (tab_width <= 0 || tab_width > 1000) tab_width = 8; if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
bzero (&cmp_it, sizeof cmp_it); memset (&cmp_it, 0, sizeof cmp_it);
cmp_it.id = -1; cmp_it.id = -1;
composition_compute_stop_pos (&cmp_it, scan, scan_byte, end, Qnil); composition_compute_stop_pos (&cmp_it, scan, scan_byte, end, Qnil);
@ -1214,7 +1214,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
pos_byte = prev_pos_byte = CHAR_TO_BYTE (from); pos_byte = prev_pos_byte = CHAR_TO_BYTE (from);
contin_hpos = 0; contin_hpos = 0;
prev_tab_offset = tab_offset; prev_tab_offset = tab_offset;
bzero (&cmp_it, sizeof cmp_it); memset (&cmp_it, 0, sizeof cmp_it);
cmp_it.id = -1; cmp_it.id = -1;
composition_compute_stop_pos (&cmp_it, pos, pos_byte, to, Qnil); composition_compute_stop_pos (&cmp_it, pos, pos_byte, to, Qnil);

View file

@ -164,28 +164,9 @@ gap_left (EMACS_INT charpos, EMACS_INT bytepos, int newgap)
/* Move at most 32000 chars before checking again for a quit. */ /* Move at most 32000 chars before checking again for a quit. */
if (i > 32000) if (i > 32000)
i = 32000; i = 32000;
#ifdef GAP_USE_BCOPY new_s1 -= i;
if (i >= 128 from -= i, to -= i;
/* bcopy is safe if the two areas of memory do not overlap memmove (to, from, i);
or on systems where bcopy is always safe for moving upward. */
&& (BCOPY_UPWARD_SAFE
|| to - from >= 128))
{
/* If overlap is not safe, avoid it by not moving too many
characters at once. */
if (!BCOPY_UPWARD_SAFE && i > to - from)
i = to - from;
new_s1 -= i;
from -= i, to -= i;
bcopy (from, to, i);
}
else
#endif
{
new_s1 -= i;
while (--i >= 0)
*--to = *--from;
}
} }
/* Adjust markers, and buffer data structure, to put the gap at BYTEPOS. /* Adjust markers, and buffer data structure, to put the gap at BYTEPOS.
@ -238,28 +219,9 @@ gap_right (EMACS_INT charpos, EMACS_INT bytepos)
/* Move at most 32000 chars before checking again for a quit. */ /* Move at most 32000 chars before checking again for a quit. */
if (i > 32000) if (i > 32000)
i = 32000; i = 32000;
#ifdef GAP_USE_BCOPY new_s1 += i;
if (i >= 128 memmove (to, from, i);
/* bcopy is safe if the two areas of memory do not overlap from += i, to += i;
or on systems where bcopy is always safe for moving downward. */
&& (BCOPY_DOWNWARD_SAFE
|| from - to >= 128))
{
/* If overlap is not safe, avoid it by not moving too many
characters at once. */
if (!BCOPY_DOWNWARD_SAFE && i > from - to)
i = from - to;
new_s1 += i;
bcopy (from, to, i);
from += i, to += i;
}
else
#endif
{
new_s1 += i;
while (--i >= 0)
*to++ = *from++;
}
} }
adjust_markers_gap_motion (GPT_BYTE + GAP_SIZE, bytepos + GAP_SIZE, adjust_markers_gap_motion (GPT_BYTE + GAP_SIZE, bytepos + GAP_SIZE,
@ -585,7 +547,7 @@ make_gap_smaller (EMACS_INT nbytes_removed)
/* Pretend that the last unwanted part of the gap is the entire gap, /* Pretend that the last unwanted part of the gap is the entire gap,
and that the first desired part of the gap is part of the buffer and that the first desired part of the gap is part of the buffer
text. */ text. */
bzero (GPT_ADDR, new_gap_size); memset (GPT_ADDR, 0, new_gap_size);
GPT += new_gap_size; GPT += new_gap_size;
GPT_BYTE += new_gap_size; GPT_BYTE += new_gap_size;
Z += new_gap_size; Z += new_gap_size;
@ -636,7 +598,7 @@ copy_text (const unsigned char *from_addr, unsigned char *to_addr,
{ {
if (from_multibyte == to_multibyte) if (from_multibyte == to_multibyte)
{ {
bcopy (from_addr, to_addr, nbytes); memcpy (to_addr, from_addr, nbytes);
return nbytes; return nbytes;
} }
else if (from_multibyte) else if (from_multibyte)
@ -966,7 +928,7 @@ insert_1_both (const unsigned char *string,
MODIFF++; MODIFF++;
CHARS_MODIFF = MODIFF; CHARS_MODIFF = MODIFF;
bcopy (string, GPT_ADDR, nbytes); memcpy (GPT_ADDR, string, nbytes);
GAP_SIZE -= nbytes; GAP_SIZE -= nbytes;
GPT += nchars; GPT += nchars;
@ -1007,7 +969,7 @@ insert_1_both (const unsigned char *string,
copy them into the buffer. copy them into the buffer.
It does not work to use `insert' for this, because a GC could happen It does not work to use `insert' for this, because a GC could happen
before we bcopy the stuff into the buffer, and relocate the string before we copy the stuff into the buffer, and relocate the string
without insert noticing. */ without insert noticing. */
void void
@ -1182,7 +1144,7 @@ insert_from_gap (EMACS_INT nchars, EMACS_INT nbytes)
into the current buffer. into the current buffer.
It does not work to use `insert' for this, because a malloc could happen It does not work to use `insert' for this, because a malloc could happen
and relocate BUF's text before the bcopy happens. */ and relocate BUF's text before the copy happens. */
void void
insert_from_buffer (struct buffer *buf, insert_from_buffer (struct buffer *buf,
@ -1712,7 +1674,7 @@ replace_range_2 (EMACS_INT from, EMACS_INT from_byte,
make_gap (insbytes - GAP_SIZE); make_gap (insbytes - GAP_SIZE);
/* Copy the replacement text into the buffer. */ /* Copy the replacement text into the buffer. */
bcopy (ins, GPT_ADDR, insbytes); memcpy (GPT_ADDR, ins, insbytes);
#ifdef BYTE_COMBINING_DEBUG #ifdef BYTE_COMBINING_DEBUG
/* We have copied text into the gap, but we have not marked /* We have copied text into the gap, but we have not marked

View file

@ -1558,7 +1558,7 @@ reproduce_tree (INTERVAL source, INTERVAL parent)
{ {
register INTERVAL t = make_interval (); register INTERVAL t = make_interval ();
bcopy (source, t, INTERVAL_SIZE); memcpy (t, source, INTERVAL_SIZE);
copy_properties (source, t); copy_properties (source, t);
SET_INTERVAL_PARENT (t, parent); SET_INTERVAL_PARENT (t, parent);
if (! NULL_LEFT_CHILD (source)) if (! NULL_LEFT_CHILD (source))
@ -1574,7 +1574,7 @@ reproduce_tree_obj (INTERVAL source, Lisp_Object parent)
{ {
register INTERVAL t = make_interval (); register INTERVAL t = make_interval ();
bcopy (source, t, INTERVAL_SIZE); memcpy (t, source, INTERVAL_SIZE);
copy_properties (source, t); copy_properties (source, t);
SET_INTERVAL_OBJECT (t, parent); SET_INTERVAL_OBJECT (t, parent);
if (! NULL_LEFT_CHILD (source)) if (! NULL_LEFT_CHILD (source))

View file

@ -716,7 +716,7 @@ echo_char (Lisp_Object c)
ptr = buffer + offset; ptr = buffer + offset;
} }
bcopy (text, ptr, len); memcpy (ptr, text, len);
ptr += len; ptr += len;
} }
@ -3481,13 +3481,13 @@ print_help (Lisp_Object object)
static void static void
save_getcjmp (jmp_buf temp) save_getcjmp (jmp_buf temp)
{ {
bcopy (getcjmp, temp, sizeof getcjmp); memcpy (temp, getcjmp, sizeof getcjmp);
} }
static void static void
restore_getcjmp (jmp_buf temp) restore_getcjmp (jmp_buf temp)
{ {
bcopy (temp, getcjmp, sizeof getcjmp); memcpy (getcjmp, temp, sizeof getcjmp);
} }
/* Low level keyboard/mouse input. /* Low level keyboard/mouse input.
@ -3675,7 +3675,7 @@ kbd_buffer_store_event_hold (register struct input_event *event,
if (hold_quit) if (hold_quit)
{ {
bcopy (event, (char *) hold_quit, sizeof (*event)); memcpy (hold_quit, event, sizeof (*event));
return; return;
} }
@ -6336,8 +6336,8 @@ apply_modifiers_uncached (int modifiers, char *base, int base_len, int base_len_
new_name = make_uninit_multibyte_string (mod_len + base_len, new_name = make_uninit_multibyte_string (mod_len + base_len,
mod_len + base_len_byte); mod_len + base_len_byte);
bcopy (new_mods, SDATA (new_name), mod_len); memcpy (SDATA (new_name), new_mods, mod_len);
bcopy (base, SDATA (new_name) + mod_len, base_len_byte); memcpy (SDATA (new_name) + mod_len, base, base_len_byte);
return Fintern (new_name, Qnil); return Fintern (new_name, Qnil);
} }
@ -7448,7 +7448,7 @@ store_user_signal_events (void)
if (nstored == 0) if (nstored == 0)
{ {
bzero (&buf, sizeof buf); memset (&buf, 0, sizeof buf);
buf.kind = USER_SIGNAL_EVENT; buf.kind = USER_SIGNAL_EVENT;
buf.frame_or_window = selected_frame; buf.frame_or_window = selected_frame;
} }
@ -7552,7 +7552,7 @@ menu_bar_items (Lisp_Object old)
nmaps = 0; nmaps = 0;
if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
maps[nmaps++] = tem; maps[nmaps++] = tem;
bcopy (tmaps, (void *) (maps + nmaps), nminor * sizeof (maps[0])); memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0]));
nmaps += nminor; nmaps += nminor;
maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map); maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map);
} }
@ -7593,9 +7593,9 @@ menu_bar_items (Lisp_Object old)
tem2 = XVECTOR (menu_bar_items_vector)->contents[i + 2]; tem2 = XVECTOR (menu_bar_items_vector)->contents[i + 2];
tem3 = XVECTOR (menu_bar_items_vector)->contents[i + 3]; tem3 = XVECTOR (menu_bar_items_vector)->contents[i + 3];
if (end > i + 4) if (end > i + 4)
bcopy (&XVECTOR (menu_bar_items_vector)->contents[i + 4], memmove (&XVECTOR (menu_bar_items_vector)->contents[i],
&XVECTOR (menu_bar_items_vector)->contents[i], &XVECTOR (menu_bar_items_vector)->contents[i + 4],
(end - i - 4) * sizeof (Lisp_Object)); (end - i - 4) * sizeof (Lisp_Object));
XVECTOR (menu_bar_items_vector)->contents[end - 4] = tem0; XVECTOR (menu_bar_items_vector)->contents[end - 4] = tem0;
XVECTOR (menu_bar_items_vector)->contents[end - 3] = tem1; XVECTOR (menu_bar_items_vector)->contents[end - 3] = tem1;
XVECTOR (menu_bar_items_vector)->contents[end - 2] = tem2; 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
if (EQ (key, XVECTOR (menu_bar_items_vector)->contents[i])) if (EQ (key, XVECTOR (menu_bar_items_vector)->contents[i]))
{ {
if (menu_bar_items_index > i + 4) if (menu_bar_items_index > i + 4)
bcopy (&XVECTOR (menu_bar_items_vector)->contents[i + 4], memmove (&XVECTOR (menu_bar_items_vector)->contents[i],
&XVECTOR (menu_bar_items_vector)->contents[i], &XVECTOR (menu_bar_items_vector)->contents[i + 4],
(menu_bar_items_index - i - 4) * sizeof (Lisp_Object)); (menu_bar_items_index - i - 4) * sizeof (Lisp_Object));
menu_bar_items_index -= 4; menu_bar_items_index -= 4;
} }
} }
@ -8090,7 +8090,7 @@ tool_bar_items (Lisp_Object reuse, int *nitems)
nmaps = 0; nmaps = 0;
if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
maps[nmaps++] = tem; maps[nmaps++] = tem;
bcopy (tmaps, (void *) (maps + nmaps), nminor * sizeof (maps[0])); memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0]));
nmaps += nminor; nmaps += nminor;
maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map); maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map);
} }
@ -8140,9 +8140,9 @@ process_tool_bar_item (Lisp_Object key, Lisp_Object def, Lisp_Object data, void
if (EQ (key, v[TOOL_BAR_ITEM_KEY])) if (EQ (key, v[TOOL_BAR_ITEM_KEY]))
{ {
if (ntool_bar_items > i + TOOL_BAR_ITEM_NSLOTS) if (ntool_bar_items > i + TOOL_BAR_ITEM_NSLOTS)
bcopy (v + TOOL_BAR_ITEM_NSLOTS, v, memmove (v, v + TOOL_BAR_ITEM_NSLOTS,
((ntool_bar_items - i - TOOL_BAR_ITEM_NSLOTS) ((ntool_bar_items - i - TOOL_BAR_ITEM_NSLOTS)
* sizeof (Lisp_Object))); * sizeof (Lisp_Object)));
ntool_bar_items -= TOOL_BAR_ITEM_NSLOTS; ntool_bar_items -= TOOL_BAR_ITEM_NSLOTS;
break; break;
} }
@ -8425,7 +8425,7 @@ append_tool_bar_item (void)
tool_bar_items_vector. */ tool_bar_items_vector. */
to = XVECTOR (tool_bar_items_vector)->contents + ntool_bar_items; to = XVECTOR (tool_bar_items_vector)->contents + ntool_bar_items;
from = XVECTOR (tool_bar_item_properties)->contents; from = XVECTOR (tool_bar_item_properties)->contents;
bcopy (from, to, TOOL_BAR_ITEM_NSLOTS * sizeof *to); memcpy (to, from, TOOL_BAR_ITEM_NSLOTS * sizeof *to);
ntool_bar_items += TOOL_BAR_ITEM_NSLOTS; ntool_bar_items += TOOL_BAR_ITEM_NSLOTS;
} }
@ -8718,7 +8718,7 @@ read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps)
thiswidth = SCHARS (desc); thiswidth = SCHARS (desc);
if (thiswidth + i > width) if (thiswidth + i > width)
thiswidth = width - i; thiswidth = width - i;
bcopy (SDATA (desc), menu + i, thiswidth); memcpy (menu + i, SDATA (desc), thiswidth);
i += thiswidth; i += thiswidth;
strcpy (menu + i, " = "); strcpy (menu + i, " = ");
i += 3; i += 3;
@ -8728,7 +8728,7 @@ read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps)
thiswidth = SCHARS (s); thiswidth = SCHARS (s);
if (thiswidth + i > width) if (thiswidth + i > width)
thiswidth = width - i; thiswidth = width - i;
bcopy (SDATA (s), menu + i, thiswidth); memcpy (menu + i, SDATA (s), thiswidth);
i += thiswidth; i += thiswidth;
menu[i] = 0; menu[i] = 0;
} }
@ -9212,8 +9212,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
if (!NILP (orig_keymap)) if (!NILP (orig_keymap))
submaps[nmaps++] = orig_keymap; submaps[nmaps++] = orig_keymap;
bcopy (maps, (void *) (submaps + nmaps), memcpy (submaps + nmaps, maps, nminor * sizeof (submaps[0]));
nminor * sizeof (submaps[0]));
nmaps += nminor; nmaps += nminor;
@ -10147,7 +10146,7 @@ will read just one key sequence. */)
specbind (Qinput_method_use_echo_area, specbind (Qinput_method_use_echo_area,
(NILP (command_loop) ? Qt : Qnil)); (NILP (command_loop) ? Qt : Qnil));
bzero (keybuf, sizeof keybuf); memset (keybuf, 0, sizeof keybuf);
GCPRO1 (keybuf[0]); GCPRO1 (keybuf[0]);
gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0])); gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0]));
@ -10207,7 +10206,7 @@ DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector,
specbind (Qinput_method_use_echo_area, specbind (Qinput_method_use_echo_area,
(NILP (command_loop) ? Qt : Qnil)); (NILP (command_loop) ? Qt : Qnil));
bzero (keybuf, sizeof keybuf); memset (keybuf, 0, sizeof keybuf);
GCPRO1 (keybuf[0]); GCPRO1 (keybuf[0]);
gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0])); gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0]));
@ -10597,12 +10596,10 @@ DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0,
else else
{ {
val = Fvector (NUM_RECENT_KEYS, keys); val = Fvector (NUM_RECENT_KEYS, keys);
bcopy (keys + recent_keys_index, memcpy (XVECTOR (val)->contents, keys + recent_keys_index,
XVECTOR (val)->contents, (NUM_RECENT_KEYS - recent_keys_index) * sizeof (Lisp_Object));
(NUM_RECENT_KEYS - recent_keys_index) * sizeof (Lisp_Object)); memcpy (XVECTOR (val)->contents + NUM_RECENT_KEYS - recent_keys_index,
bcopy (keys, keys, recent_keys_index * sizeof (Lisp_Object));
XVECTOR (val)->contents + NUM_RECENT_KEYS - recent_keys_index,
recent_keys_index * sizeof (Lisp_Object));
return val; return val;
} }
} }

View file

@ -1534,7 +1534,8 @@ current_minor_maps (Lisp_Object **modeptr, Lisp_Object **mapptr)
{ {
if (cmm_modes) if (cmm_modes)
{ {
bcopy (cmm_modes, newmodes, cmm_size * sizeof cmm_modes[0]); memcpy (newmodes, cmm_modes,
cmm_size * sizeof cmm_modes[0]);
free (cmm_modes); free (cmm_modes);
} }
cmm_modes = newmodes; cmm_modes = newmodes;
@ -1545,7 +1546,8 @@ current_minor_maps (Lisp_Object **modeptr, Lisp_Object **mapptr)
{ {
if (cmm_maps) if (cmm_maps)
{ {
bcopy (cmm_maps, newmaps, cmm_size * sizeof cmm_maps[0]); memcpy (newmaps, cmm_maps,
cmm_size * sizeof cmm_maps[0]);
free (cmm_maps); free (cmm_maps);
} }
cmm_maps = newmaps; cmm_maps = newmaps;
@ -3100,12 +3102,12 @@ You type Translation\n\
*p++ = '\f'; *p++ = '\f';
*p++ = '\n'; *p++ = '\n';
*p++ = '`'; *p++ = '`';
bcopy (SDATA (SYMBOL_NAME (modes[i])), p, memcpy (p, SDATA (SYMBOL_NAME (modes[i])),
SCHARS (SYMBOL_NAME (modes[i]))); SCHARS (SYMBOL_NAME (modes[i])));
p += SCHARS (SYMBOL_NAME (modes[i])); p += SCHARS (SYMBOL_NAME (modes[i]));
*p++ = '\''; *p++ = '\'';
bcopy (" Minor Mode Bindings", p, sizeof (" Minor Mode Bindings") - 1); memcpy (p, " Minor Mode Bindings", strlen (" Minor Mode Bindings"));
p += sizeof (" Minor Mode Bindings") - 1; p += strlen (" Minor Mode Bindings");
*p = 0; *p = 0;
describe_map_tree (maps[i], 1, shadow, prefix, describe_map_tree (maps[i], 1, shadow, prefix,

View file

@ -647,7 +647,7 @@ extern size_t pure_size;
(XSTRING (string)->size = (newsize)) (XSTRING (string)->size = (newsize))
#define STRING_COPYIN(string, index, new, count) \ #define STRING_COPYIN(string, index, new, count) \
bcopy (new, SDATA (string) + index, count) memcpy (SDATA (string) + index, new, count)
/* Type checking. */ /* Type checking. */
@ -2628,7 +2628,6 @@ EXFUN (Fredisplay, 1);
extern Lisp_Object sit_for (Lisp_Object, int, int); extern Lisp_Object sit_for (Lisp_Object, int, int);
extern void init_display (void); extern void init_display (void);
extern void syms_of_display (void); extern void syms_of_display (void);
extern void safe_bcopy (const char *, char *, int);
/* Defined in xdisp.c */ /* Defined in xdisp.c */
extern Lisp_Object Qinhibit_point_motion_hooks; extern Lisp_Object Qinhibit_point_motion_hooks;
@ -3400,6 +3399,18 @@ extern int emacs_open (const char *, int, int);
extern int emacs_close (int); extern int emacs_close (int);
extern int emacs_read (int, char *, unsigned int); extern int emacs_read (int, char *, unsigned int);
extern int emacs_write (int, const char *, unsigned int); extern int emacs_write (int, const char *, unsigned int);
#ifndef HAVE_MEMSET
extern void *memset P_ ((void *, int, size_t));
#endif
#ifndef HAVE_MEMCPY
extern void *memcpy P_ ((void *, void *, size_t));
#endif
#ifndef HAVE_MEMMOVE
extern void *memmove P_ ((void *, void *, size_t));
#endif
#ifndef HAVE_MEMCMP
extern int memcmp P_ ((void *, void *, size_t));
#endif
/* Defined in filelock.c */ /* Defined in filelock.c */
EXFUN (Funlock_buffer, 0); EXFUN (Funlock_buffer, 0);

View file

@ -1125,8 +1125,7 @@ Return t if the file exists and loads successfully. */)
specbind (Qold_style_backquotes, Qnil); specbind (Qold_style_backquotes, Qnil);
record_unwind_protect (load_warn_old_style_backquotes, file); record_unwind_protect (load_warn_old_style_backquotes, file);
if (!bcmp (SDATA (found) + SBYTES (found) - 4, if (!memcmp (SDATA (found) + SBYTES (found) - 4, ".elc", 4)
".elc", 4)
|| (fd >= 0 && (version = safe_to_load_p (fd)) > 0)) || (fd >= 0 && (version = safe_to_load_p (fd)) > 0))
/* Load .elc files directly, but not when they are /* Load .elc files directly, but not when they are
remote and have no handler! */ remote and have no handler! */
@ -2430,8 +2429,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
invalid_syntax ("#&...", 5); invalid_syntax ("#&...", 5);
val = Fmake_bool_vector (length, Qnil); val = Fmake_bool_vector (length, Qnil);
bcopy (SDATA (tmp), XBOOL_VECTOR (val)->data, memcpy (XBOOL_VECTOR (val)->data, SDATA (tmp), size_in_chars);
size_in_chars);
/* Clear the extraneous bits in the last byte. */ /* Clear the extraneous bits in the last byte. */
if (XINT (length) != size_in_chars * BOOL_VECTOR_BITS_PER_CHAR) if (XINT (length) != size_in_chars * BOOL_VECTOR_BITS_PER_CHAR)
XBOOL_VECTOR (val)->data[size_in_chars - 1] 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
{ {
if (SBYTES (SYMBOL_NAME (tail)) == size_byte if (SBYTES (SYMBOL_NAME (tail)) == size_byte
&& SCHARS (SYMBOL_NAME (tail)) == size && SCHARS (SYMBOL_NAME (tail)) == size
&& !bcmp (SDATA (SYMBOL_NAME (tail)), ptr, size_byte)) && !memcmp (SDATA (SYMBOL_NAME (tail)), ptr, size_byte))
return tail; return tail;
else if (XSYMBOL (tail)->next == 0) else if (XSYMBOL (tail)->next == 0)
break; break;

View file

@ -35,7 +35,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <sys/time.h> #include <sys/time.h>
#include <dos.h> #include <dos.h>
#include <errno.h> #include <errno.h>
#include <string.h> /* for bzero and string functions */ #include <string.h> /* for memset and string functions */
#include <sys/stat.h> /* for _fixpath */ #include <sys/stat.h> /* for _fixpath */
#include <unistd.h> /* for chdir, dup, dup2, etc. */ #include <unistd.h> /* for chdir, dup, dup2, etc. */
#include <dir.h> /* for getdisk */ #include <dir.h> /* for getdisk */
@ -2929,12 +2929,10 @@ and then the scan code. */)
else else
{ {
val = Fvector (NUM_RECENT_DOSKEYS, keys); val = Fvector (NUM_RECENT_DOSKEYS, keys);
bcopy (keys + recent_doskeys_index, memcpy (XVECTOR (val)->contents, keys + recent_doskeys_index,
XVECTOR (val)->contents, (NUM_RECENT_DOSKEYS - recent_doskeys_index) * sizeof (Lisp_Object));
(NUM_RECENT_DOSKEYS - recent_doskeys_index) * sizeof (Lisp_Object)); memcpy (XVECTOR (val)->contents + NUM_RECENT_DOSKEYS - recent_doskeys_index,
bcopy (keys, keys, recent_doskeys_index * sizeof (Lisp_Object));
XVECTOR (val)->contents + NUM_RECENT_DOSKEYS - recent_doskeys_index,
recent_doskeys_index * sizeof (Lisp_Object));
return val; return val;
} }
} }

View file

@ -1159,7 +1159,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
f->output_method = output_ns; f->output_method = output_ns;
f->output_data.ns = (struct ns_output *)xmalloc (sizeof *(f->output_data.ns)); f->output_data.ns = (struct ns_output *)xmalloc (sizeof *(f->output_data.ns));
bzero (f->output_data.ns, sizeof (*(f->output_data.ns))); memset (f->output_data.ns, 0, sizeof (*(f->output_data.ns)));
FRAME_FONTSET (f) = -1; FRAME_FONTSET (f) = -1;

View file

@ -776,8 +776,8 @@ when setting family in ns_spec_to_descriptor(). */
xmalloc (0x100 * sizeof (struct font_metrics *)); xmalloc (0x100 * sizeof (struct font_metrics *));
if (!font_info->glyphs || !font_info->metrics) if (!font_info->glyphs || !font_info->metrics)
return Qnil; return Qnil;
bzero (font_info->glyphs, 0x100 * sizeof (unsigned short *)); memset (font_info->glyphs, 0, 0x100 * sizeof (unsigned short *));
bzero (font_info->metrics, 0x100 * sizeof (struct font_metrics *)); memset (font_info->metrics, 0, 0x100 * sizeof (struct font_metrics *));
BLOCK_INPUT; BLOCK_INPUT;
@ -816,8 +816,8 @@ when setting family in ns_spec_to_descriptor(). */
[font_info->nsfont retain]; [font_info->nsfont retain];
/* set up ns_font (defined in nsgui.h) */ /* set up ns_font (defined in nsgui.h) */
font_info->name = (char *)xmalloc (strlen (fontName) + 1); font_info->name = (char *)xmalloc (strlen (fontName)+1);
bcopy (fontName, font_info->name, strlen (fontName) + 1); strcpy (font_info->name, fontName);
font_info->bold = [fontMgr traitsOfFont: nsfont] & NSBoldFontMask; font_info->bold = [fontMgr traitsOfFont: nsfont] & NSBoldFontMask;
font_info->ital = font_info->ital =
synthItal || ([fontMgr traitsOfFont: nsfont] & NSItalicFontMask); synthItal || ([fontMgr traitsOfFont: nsfont] & NSItalicFontMask);
@ -972,7 +972,7 @@ that causes need for cache in nsfont_open () */
int totalWidth = 0; int totalWidth = 0;
int i; int i;
bzero (metrics, sizeof (struct font_metrics)); memset (metrics, 0, sizeof (struct font_metrics));
for (i =0; i<nglyphs; i++) for (i =0; i<nglyphs; i++)
{ {
@ -1395,7 +1395,7 @@ WITH_BACKGROUND is zero when (FROM > 0 || TO < S->nchars). */
sfont = [font_info->nsfont screenFont]; sfont = [font_info->nsfont screenFont];
font_info->metrics[block] = xmalloc (0x100 * sizeof (struct font_metrics)); font_info->metrics[block] = xmalloc (0x100 * sizeof (struct font_metrics));
bzero (font_info->metrics[block], 0x100 * sizeof (struct font_metrics)); memset (font_info->metrics[block], 0, 0x100 * sizeof (struct font_metrics));
if (!(font_info->metrics[block])) if (!(font_info->metrics[block]))
abort (); abort ();

View file

@ -315,9 +315,9 @@ - (void)dealloc
[self addRepresentation: bmRep]; [self addRepresentation: bmRep];
bzero (planes[0], w*h); memset (planes[0], 0, w*h);
bzero (planes[1], w*h); memset (planes[1], 0, w*h);
bzero (planes[2], w*h); memset (planes[2], 0, w*h);
[self setXBMColor: [NSColor blackColor]]; [self setXBMColor: [NSColor blackColor]];
return self; return self;
} }
@ -379,7 +379,7 @@ - (void)dealloc
[bmRep getBitmapDataPlanes: pixmapData]; [bmRep getBitmapDataPlanes: pixmapData];
for (i =0; i<4; i++) for (i =0; i<4; i++)
bzero (pixmapData[i], width*height); memset (pixmapData[i], 0, width*height);
[self addRepresentation: bmRep]; [self addRepresentation: bmRep];
return self; return self;
} }

View file

@ -219,8 +219,8 @@
/* Save the frame's previous menu bar contents data */ /* Save the frame's previous menu bar contents data */
if (previous_menu_items_used) if (previous_menu_items_used)
bcopy (XVECTOR (f->menu_bar_vector)->contents, previous_items, memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents,
previous_menu_items_used * sizeof (Lisp_Object)); previous_menu_items_used * sizeof (Lisp_Object));
/* parse stage 1: extract from lisp */ /* parse stage 1: extract from lisp */
save_menu_items (); save_menu_items ();

View file

@ -2163,11 +2163,11 @@ Free a pool and temporary objects it refers to (callable from C)
{ {
EmacsImage **newBimgs EmacsImage **newBimgs
= xmalloc (max_used_fringe_bitmap * sizeof (EmacsImage *)); = xmalloc (max_used_fringe_bitmap * sizeof (EmacsImage *));
bzero (newBimgs, max_used_fringe_bitmap * sizeof (EmacsImage *)); memset (newBimgs, 0, max_used_fringe_bitmap * sizeof (EmacsImage *));
if (nBimgs) if (nBimgs)
{ {
bcopy (bimgs, newBimgs, nBimgs * sizeof (EmacsImage *)); memcpy (newBimgs, bimgs, nBimgs * sizeof (EmacsImage *));
xfree (bimgs); xfree (bimgs);
} }
@ -3707,7 +3707,7 @@ Needs to be here because ns_initialize_display_info () uses AppKit classes.
name: nil object: nil]; */ name: nil object: nil]; */
dpyinfo = (struct ns_display_info *)xmalloc (sizeof (struct ns_display_info)); dpyinfo = (struct ns_display_info *)xmalloc (sizeof (struct ns_display_info));
bzero (dpyinfo, sizeof (struct ns_display_info)); memset (dpyinfo, 0, sizeof (struct ns_display_info));
ns_initialize_display_info (dpyinfo); ns_initialize_display_info (dpyinfo);
terminal = ns_create_terminal (dpyinfo); terminal = ns_create_terminal (dpyinfo);

View file

@ -289,7 +289,7 @@ int print_output_debug_flag = 1;
static Lisp_Object static Lisp_Object
print_unwind (Lisp_Object saved_text) print_unwind (Lisp_Object saved_text)
{ {
bcopy (SDATA (saved_text), print_buffer, SCHARS (saved_text)); memcpy (print_buffer, SDATA (saved_text), SCHARS (saved_text));
return Qnil; return Qnil;
} }
@ -316,7 +316,7 @@ printchar (unsigned int ch, Lisp_Object fun)
if (print_buffer_pos_byte + len >= print_buffer_size) if (print_buffer_pos_byte + len >= print_buffer_size)
print_buffer = (char *) xrealloc (print_buffer, print_buffer = (char *) xrealloc (print_buffer,
print_buffer_size *= 2); print_buffer_size *= 2);
bcopy (str, print_buffer + print_buffer_pos_byte, len); memcpy (print_buffer + print_buffer_pos_byte, str, len);
print_buffer_pos += 1; print_buffer_pos += 1;
print_buffer_pos_byte += len; print_buffer_pos_byte += len;
} }
@ -364,7 +364,7 @@ strout (const char *ptr, int size, int size_byte, Lisp_Object printcharfun,
print_buffer = (char *) xrealloc (print_buffer, print_buffer = (char *) xrealloc (print_buffer,
print_buffer_size); print_buffer_size);
} }
bcopy (ptr, print_buffer + print_buffer_pos_byte, size_byte); memcpy (print_buffer + print_buffer_pos_byte, ptr, size_byte);
print_buffer_pos += size; print_buffer_pos += size;
print_buffer_pos_byte += size_byte; print_buffer_pos_byte += size_byte;
} }
@ -461,7 +461,7 @@ print_string (Lisp_Object string, Lisp_Object printcharfun)
if (chars < bytes) if (chars < bytes)
{ {
newstr = make_uninit_multibyte_string (chars, bytes); newstr = make_uninit_multibyte_string (chars, bytes);
bcopy (SDATA (string), SDATA (newstr), chars); memcpy (SDATA (newstr), SDATA (string), chars);
str_to_multibyte (SDATA (newstr), bytes, chars); str_to_multibyte (SDATA (newstr), bytes, chars);
string = newstr; string = newstr;
} }
@ -480,7 +480,7 @@ print_string (Lisp_Object string, Lisp_Object printcharfun)
USE_SAFE_ALLOCA; USE_SAFE_ALLOCA;
SAFE_ALLOCA (buffer, char *, nbytes); SAFE_ALLOCA (buffer, char *, nbytes);
bcopy (SDATA (string), buffer, nbytes); memcpy (buffer, SDATA (string), nbytes);
strout (buffer, chars, SBYTES (string), strout (buffer, chars, SBYTES (string),
printcharfun, STRING_MULTIBYTE (string)); printcharfun, STRING_MULTIBYTE (string));
@ -1032,7 +1032,7 @@ print_error_message (Lisp_Object data, Lisp_Object stream, char *context, Lisp_O
{ {
Lisp_Object cname = SYMBOL_NAME (caller); Lisp_Object cname = SYMBOL_NAME (caller);
char *name = alloca (SBYTES (cname)); char *name = alloca (SBYTES (cname));
bcopy (SDATA (cname), name, SBYTES (cname)); memcpy (name, SDATA (cname), SBYTES (cname));
message_dolog (name, SBYTES (cname), 0, 0); message_dolog (name, SBYTES (cname), 0, 0);
message_dolog (": ", 2, 0, 0); message_dolog (": ", 2, 0, 0);
} }

View file

@ -2440,7 +2440,7 @@ conv_lisp_to_sockaddr (int family, Lisp_Object address, struct sockaddr *sa, int
register unsigned char *cp = NULL; register unsigned char *cp = NULL;
register int i; register int i;
bzero (sa, len); memset (sa, 0, len);
if (VECTORP (address)) if (VECTORP (address))
{ {
@ -2635,12 +2635,12 @@ set_socket_option (int s, Lisp_Object opt, Lisp_Object val)
/* This is broken, at least in the Linux 2.4 kernel. /* This is broken, at least in the Linux 2.4 kernel.
To unbind, the arg must be a zero integer, not the empty string. To unbind, the arg must be a zero integer, not the empty string.
This should work on all systems. KFS. 2003-09-23. */ This should work on all systems. KFS. 2003-09-23. */
bzero (devname, sizeof devname); memset (devname, 0, sizeof devname);
if (STRINGP (val)) if (STRINGP (val))
{ {
char *arg = (char *) SDATA (val); char *arg = (char *) SDATA (val);
int len = min (strlen (arg), IFNAMSIZ); int len = min (strlen (arg), IFNAMSIZ);
bcopy (arg, devname, len); memcpy (devname, arg, len);
} }
else if (!NILP (val)) else if (!NILP (val))
error ("Bad option value for %s", name); error ("Bad option value for %s", name);
@ -3349,7 +3349,7 @@ usage: (make-network-process &rest ARGS) */)
host = Qnil; host = Qnil;
} }
CHECK_STRING (service); CHECK_STRING (service);
bzero (&address_un, sizeof address_un); memset (&address_un, 0, sizeof address_un);
address_un.sun_family = AF_LOCAL; address_un.sun_family = AF_LOCAL;
strncpy (address_un.sun_path, SDATA (service), sizeof address_un.sun_path); strncpy (address_un.sun_path, SDATA (service), sizeof address_un.sun_path);
ai.ai_addr = (struct sockaddr *) &address_un; ai.ai_addr = (struct sockaddr *) &address_un;
@ -3433,7 +3433,7 @@ usage: (make-network-process &rest ARGS) */)
port = svc_info->s_port; port = svc_info->s_port;
} }
bzero (&address_in, sizeof address_in); memset (&address_in, 0, sizeof address_in);
address_in.sin_family = family; address_in.sin_family = family;
address_in.sin_addr.s_addr = INADDR_ANY; address_in.sin_addr.s_addr = INADDR_ANY;
address_in.sin_port = port; address_in.sin_port = port;
@ -3457,8 +3457,8 @@ usage: (make-network-process &rest ARGS) */)
if (host_info_ptr) if (host_info_ptr)
{ {
bcopy (host_info_ptr->h_addr, (char *) &address_in.sin_addr, memcpy (&address_in.sin_addr, host_info_ptr->h_addr,
host_info_ptr->h_length); host_info_ptr->h_length);
family = host_info_ptr->h_addrtype; family = host_info_ptr->h_addrtype;
address_in.sin_family = family; address_in.sin_family = family;
} }
@ -3470,8 +3470,8 @@ usage: (make-network-process &rest ARGS) */)
if (numeric_addr == -1) if (numeric_addr == -1)
error ("Unknown host \"%s\"", SDATA (host)); error ("Unknown host \"%s\"", SDATA (host));
bcopy ((char *)&numeric_addr, (char *) &address_in.sin_addr, memcpy (&address_in.sin_addr, &numeric_addr,
sizeof (address_in.sin_addr)); sizeof (address_in.sin_addr));
} }
} }
@ -3655,7 +3655,7 @@ usage: (make-network-process &rest ARGS) */)
if (is_server) if (is_server)
{ {
Lisp_Object remote; Lisp_Object remote;
bzero (datagram_address[s].sa, lres->ai_addrlen); memset (datagram_address[s].sa, 0, lres->ai_addrlen);
if (remote = Fplist_get (contact, QCremote), !NILP (remote)) if (remote = Fplist_get (contact, QCremote), !NILP (remote))
{ {
int rfamily, rlen; int rfamily, rlen;
@ -3666,7 +3666,7 @@ usage: (make-network-process &rest ARGS) */)
} }
} }
else else
bcopy (lres->ai_addr, datagram_address[s].sa, lres->ai_addrlen); memcpy (datagram_address[s].sa, lres->ai_addr, lres->ai_addrlen);
} }
#endif #endif
contact = Fplist_put (contact, QCaddress, contact = Fplist_put (contact, QCaddress,
@ -3933,7 +3933,7 @@ format; see the description of ADDRESS in `make-network-process'. */)
char namebuf[sizeof (ifq->ifr_name) + 1]; char namebuf[sizeof (ifq->ifr_name) + 1];
if (ifq->ifr_addr.sa_family != AF_INET) if (ifq->ifr_addr.sa_family != AF_INET)
continue; continue;
bcopy (ifq->ifr_name, namebuf, sizeof (ifq->ifr_name)); memcpy (namebuf, ifq->ifr_name, sizeof (ifq->ifr_name));
namebuf[sizeof (ifq->ifr_name)] = 0; namebuf[sizeof (ifq->ifr_name)] = 0;
res = Fcons (Fcons (build_string (namebuf), res = Fcons (Fcons (build_string (namebuf),
conv_sockaddr_to_lisp (&ifq->ifr_addr, conv_sockaddr_to_lisp (&ifq->ifr_addr,
@ -4036,7 +4036,7 @@ FLAGS is the current flags of the interface. */)
CHECK_STRING (ifname); CHECK_STRING (ifname);
bzero (rq.ifr_name, sizeof rq.ifr_name); memset (rq.ifr_name, 0, sizeof rq.ifr_name);
strncpy (rq.ifr_name, SDATA (ifname), sizeof (rq.ifr_name)); strncpy (rq.ifr_name, SDATA (ifname), sizeof (rq.ifr_name));
s = socket (AF_INET, SOCK_STREAM, 0); s = socket (AF_INET, SOCK_STREAM, 0);
@ -5277,7 +5277,7 @@ read_process_output (Lisp_Object proc, register int channel)
chars = (char *) alloca (carryover + readmax); chars = (char *) alloca (carryover + readmax);
if (carryover) if (carryover)
/* See the comment above. */ /* See the comment above. */
bcopy (SDATA (p->decoding_buf), chars, carryover); memcpy (chars, SDATA (p->decoding_buf), carryover);
#ifdef DATAGRAM_SOCKETS #ifdef DATAGRAM_SOCKETS
/* We have a working select, so proc_buffered_char is always -1. */ /* 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)
{ {
if (SCHARS (p->decoding_buf) < coding->carryover_bytes) if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
p->decoding_buf = make_uninit_string (coding->carryover_bytes); p->decoding_buf = make_uninit_string (coding->carryover_bytes);
bcopy (coding->carryover, SDATA (p->decoding_buf), memcpy (SDATA (p->decoding_buf), coding->carryover,
coding->carryover_bytes); coding->carryover_bytes);
p->decoding_carryover = coding->carryover_bytes; p->decoding_carryover = coding->carryover_bytes;
} }
if (SBYTES (text) > 0) if (SBYTES (text) > 0)
@ -5513,8 +5513,8 @@ read_process_output (Lisp_Object proc, register int channel)
{ {
if (SCHARS (p->decoding_buf) < coding->carryover_bytes) if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
p->decoding_buf = make_uninit_string (coding->carryover_bytes); p->decoding_buf = make_uninit_string (coding->carryover_bytes);
bcopy (coding->carryover, SDATA (p->decoding_buf), memcpy (SDATA (p->decoding_buf), coding->carryover,
coding->carryover_bytes); coding->carryover_bytes);
p->decoding_carryover = coding->carryover_bytes; p->decoding_carryover = coding->carryover_bytes;
} }
/* Adjust the multibyteness of TEXT to that of the buffer. */ /* Adjust the multibyteness of TEXT to that of the buffer. */
@ -6517,11 +6517,11 @@ process has been transmitted to the serial port. */)
if (!proc_encode_coding_system[new_outfd]) if (!proc_encode_coding_system[new_outfd])
proc_encode_coding_system[new_outfd] proc_encode_coding_system[new_outfd]
= (struct coding_system *) xmalloc (sizeof (struct coding_system)); = (struct coding_system *) xmalloc (sizeof (struct coding_system));
bcopy (proc_encode_coding_system[old_outfd], memcpy (proc_encode_coding_system[new_outfd],
proc_encode_coding_system[new_outfd], proc_encode_coding_system[old_outfd],
sizeof (struct coding_system)); sizeof (struct coding_system));
bzero (proc_encode_coding_system[old_outfd], memset (proc_encode_coding_system[old_outfd], 0,
sizeof (struct coding_system)); sizeof (struct coding_system));
XPROCESS (proc)->outfd = new_outfd; XPROCESS (proc)->outfd = new_outfd;
} }
@ -7234,10 +7234,10 @@ init_process (void)
chan_process[i] = Qnil; chan_process[i] = Qnil;
proc_buffered_char[i] = -1; proc_buffered_char[i] = -1;
} }
bzero (proc_decode_coding_system, sizeof proc_decode_coding_system); memset (proc_decode_coding_system, 0, sizeof proc_decode_coding_system);
bzero (proc_encode_coding_system, sizeof proc_encode_coding_system); memset (proc_encode_coding_system, 0, sizeof proc_encode_coding_system);
#ifdef DATAGRAM_SOCKETS #ifdef DATAGRAM_SOCKETS
bzero (datagram_address, sizeof datagram_address); memset (datagram_address, 0, sizeof datagram_address);
#endif #endif
#ifdef HAVE_SOCKETS #ifdef HAVE_SOCKETS

View file

@ -37,11 +37,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
typedef POINTER_TYPE *POINTER; typedef POINTER_TYPE *POINTER;
typedef size_t SIZE; typedef size_t SIZE;
/* Declared in dispnew.c, this version doesn't screw up if regions
overlap. */
extern void safe_bcopy (const char *, char *, int);
#ifdef DOUG_LEA_MALLOC #ifdef DOUG_LEA_MALLOC
#define M_TOP_PAD -2 #define M_TOP_PAD -2
extern int mallopt (int, int); extern int mallopt (int, int);
@ -61,9 +56,6 @@ typedef void *POINTER;
#include <unistd.h> #include <unistd.h>
#include <malloc.h> #include <malloc.h>
#define safe_bcopy(x, y, z) memmove (y, x, z)
#define bzero(x, len) memset (x, 0, len)
#endif /* not emacs */ #endif /* not emacs */
@ -676,7 +668,7 @@ resize_bloc (bloc_ptr bloc, SIZE size)
} }
else else
{ {
safe_bcopy (b->data, b->new_data, b->size); memmove (b->new_data, b->data, b->size);
*b->variable = b->data = b->new_data; *b->variable = b->data = b->new_data;
} }
} }
@ -687,8 +679,8 @@ resize_bloc (bloc_ptr bloc, SIZE size)
} }
else else
{ {
safe_bcopy (bloc->data, bloc->new_data, old_size); memmove (bloc->new_data, bloc->data, old_size);
bzero ((char *) bloc->new_data + old_size, size - old_size); memset (bloc->new_data + old_size, 0, size - old_size);
*bloc->variable = bloc->data = bloc->new_data; *bloc->variable = bloc->data = bloc->new_data;
} }
} }
@ -703,7 +695,7 @@ resize_bloc (bloc_ptr bloc, SIZE size)
} }
else else
{ {
safe_bcopy (b->data, b->new_data, b->size); memmove (b->new_data, b->data, b->size);
*b->variable = b->data = b->new_data; *b->variable = b->data = b->new_data;
} }
} }
@ -856,7 +848,7 @@ r_alloc_sbrk (long int size)
header. */ header. */
for (b = last_bloc; b != NIL_BLOC; b = b->prev) for (b = last_bloc; b != NIL_BLOC; b = b->prev)
{ {
safe_bcopy (b->data, b->new_data, b->size); memmove (b->new_data, b->data, b->size);
*b->variable = b->data = b->new_data; *b->variable = b->data = b->new_data;
} }
@ -883,7 +875,7 @@ r_alloc_sbrk (long int size)
last_heap = first_heap; last_heap = first_heap;
} }
bzero (address, size); memset (address, 0, size);
} }
else /* size < 0 */ else /* size < 0 */
{ {
@ -902,7 +894,7 @@ r_alloc_sbrk (long int size)
for (b = first_bloc; b != NIL_BLOC; b = b->next) for (b = first_bloc; b != NIL_BLOC; b = b->next)
{ {
safe_bcopy (b->data, b->new_data, b->size); memmove (b->new_data, b->data, b->size);
*b->variable = b->data = b->new_data; *b->variable = b->data = b->new_data;
} }
} }
@ -1082,7 +1074,7 @@ r_alloc_thaw (void)
abort (); abort ();
/* This frees all unused blocs. It is not too inefficient, as the resize /* This frees all unused blocs. It is not too inefficient, as the resize
and bcopy is done only once. Afterwards, all unreferenced blocs are and memcpy is done only once. Afterwards, all unreferenced blocs are
already shrunk to zero size. */ already shrunk to zero size. */
if (!r_alloc_freeze_level) if (!r_alloc_freeze_level)
{ {
@ -1292,8 +1284,8 @@ r_alloc_init (void)
even though it is after the sbrk value. */ even though it is after the sbrk value. */
/* Doubly true, with the additional call that explicitly adds the /* Doubly true, with the additional call that explicitly adds the
rest of that page to the address space. */ rest of that page to the address space. */
bzero (first_heap->start, memset (first_heap->start, 0,
(char *) first_heap->end - (char *) first_heap->start); (char *) first_heap->end - (char *) first_heap->start);
virtual_break_value = break_value = first_heap->bloc_start = first_heap->end; virtual_break_value = break_value = first_heap->bloc_start = first_heap->end;
#endif #endif

View file

@ -248,37 +248,16 @@ xrealloc (block, size)
# endif # endif
# define realloc xrealloc # define realloc xrealloc
/* When used in Emacs's lib-src, we need to get bzero and bcopy somehow. /* This is the normal way of making sure we have memcpy, memcmp and memset. */
If nothing else has been done, use the method below. */ # if defined HAVE_STRING_H || defined STDC_HEADERS || defined _LIBC
# ifdef INHIBIT_STRING_HEADER # include <string.h>
# if !(defined HAVE_BZERO && defined HAVE_BCOPY) # else
# if !defined bzero && !defined bcopy # include <strings.h>
# undef INHIBIT_STRING_HEADER # ifndef memcmp
# endif # define memcmp(s1, s2, n) bcmp (s1, s2, n)
# endif # endif
# endif # ifndef memcpy
# define memcpy(d, s, n) (bcopy (s, d, n), (d))
/* This is the normal way of making sure we have memcpy, memcmp and bzero.
This is used in most programs--a few other programs avoid this
by defining INHIBIT_STRING_HEADER. */
# ifndef INHIBIT_STRING_HEADER
# if defined HAVE_STRING_H || defined STDC_HEADERS || defined _LIBC
# include <string.h>
# ifndef bzero
# ifndef _LIBC
# define bzero(s, n) (memset (s, '\0', n), (s))
# else
# define bzero(s, n) __bzero (s, n)
# endif
# endif
# else
# include <strings.h>
# ifndef memcmp
# define memcmp(s1, s2, n) bcmp (s1, s2, n)
# endif
# ifndef memcpy
# define memcpy(d, s, n) (bcopy (s, d, n), (d))
# endif
# endif # endif
# endif # endif
@ -464,7 +443,7 @@ init_syntax_once ()
if (done) if (done)
return; return;
bzero (re_syntax_table, sizeof re_syntax_table); memset (re_syntax_table, 0, sizeof re_syntax_table);
for (c = 0; c < CHAR_SET_SIZE; ++c) for (c = 0; c < CHAR_SET_SIZE; ++c)
if (ISALNUM (c)) if (ISALNUM (c))
@ -2948,7 +2927,7 @@ regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct
BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH); BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH);
/* Clear the whole map. */ /* Clear the whole map. */
bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH); memset (b, 0, (1 << BYTEWIDTH) / BYTEWIDTH);
/* charset_not matches newline according to a syntax bit. */ /* charset_not matches newline according to a syntax bit. */
if ((re_opcode_t) b[-2] == charset_not if ((re_opcode_t) b[-2] == charset_not
@ -4303,7 +4282,7 @@ re_compile_fastmap (struct re_pattern_buffer *bufp)
assert (fastmap && bufp->buffer); assert (fastmap && bufp->buffer);
bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */ memset (fastmap, 0, 1 << BYTEWIDTH); /* Assume nothing's valid. */
bufp->fastmap_accurate = 1; /* It will be when we're done. */ bufp->fastmap_accurate = 1; /* It will be when we're done. */
analysis = analyse_first (bufp->buffer, bufp->buffer + bufp->used, analysis = analyse_first (bufp->buffer, bufp->buffer + bufp->used,

View file

@ -63,15 +63,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
for received packets, so datagrams are broken too. */ for received packets, so datagrams are broken too. */
#define BROKEN_DATAGRAM_SOCKETS 1 #define BROKEN_DATAGRAM_SOCKETS 1
#define bzero(b, l) memset(b, 0, l)
#define bcopy(s, d, l) memmove(d, s, l)
#define bcmp(a, b, l) memcmp(a, b, l)
/* bcopy (aka memmove aka memcpy at least on x86) under MSVC is quite safe. */
#define GAP_USE_BCOPY 1
#define BCOPY_UPWARD_SAFE 1
#define BCOPY_DOWNWARD_SAFE 1
/* If your system uses COFF (Common Object File Format) then define the /* If your system uses COFF (Common Object File Format) then define the
preprocessor symbol "COFF". */ preprocessor symbol "COFF". */
#define COFF 1 #define COFF 1
@ -153,8 +144,10 @@ struct sigaction {
#define HAVE_RANDOM 1 #define HAVE_RANDOM 1
#undef HAVE_SYSINFO #undef HAVE_SYSINFO
#undef HAVE_LRAND48 #undef HAVE_LRAND48
#define HAVE_BCOPY 1 #define HAVE_MEMCMP 1
#define HAVE_BCMP 1 #define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMSET 1
#define HAVE_LOGB 1 #define HAVE_LOGB 1
#define HAVE_FREXP 1 #define HAVE_FREXP 1
#define HAVE_FMOD 1 #define HAVE_FMOD 1

View file

@ -104,10 +104,6 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
#define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\') #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_)) #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
/* bcopy under djgpp is quite safe. */
#define GAP_USE_BCOPY
#define BCOPY_UPWARD_SAFE 1
#define BCOPY_DOWNWARD_SAFE 1
/* Mode line description of a buffer's type. */ /* Mode line description of a buffer's type. */
#define MODE_LINE_BINARY_TEXT(buf) (NILP(buf->buffer_file_type) ? "T" : "B") #define MODE_LINE_BINARY_TEXT(buf) (NILP(buf->buffer_file_type) ? "T" : "B")

View file

@ -258,7 +258,7 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, struct m
int *copy_from = (int *) alloca (window_size * sizeof (int)); int *copy_from = (int *) alloca (window_size * sizeof (int));
/* Zero means line is empty. */ /* Zero means line is empty. */
bzero (retained_p, window_size * sizeof (char)); memset (retained_p, 0, window_size * sizeof (char));
for (k = 0; k < window_size; ++k) for (k = 0; k < window_size; ++k)
copy_from[k] = -1; copy_from[k] = -1;
@ -677,7 +677,7 @@ do_direct_scrolling (frame, current_matrix, cost_matrix,
old matrix. Lines not retained are empty. */ old matrix. Lines not retained are empty. */
char *retained_p = (char *) alloca (window_size * sizeof (char)); char *retained_p = (char *) alloca (window_size * sizeof (char));
bzero (retained_p, window_size * sizeof (char)); memset (retained_p, 0, window_size * sizeof (char));
/* Perform some sanity checks when GLYPH_DEBUG is on. */ /* Perform some sanity checks when GLYPH_DEBUG is on. */
CHECK_MATRIX (current_matrix); CHECK_MATRIX (current_matrix);
@ -855,7 +855,7 @@ scrolling_max_lines_saved (int start, int end, int *oldhash, int *newhash, int *
avg_length /= end - start; avg_length /= end - start;
threshold = avg_length / 4; threshold = avg_length / 4;
bzero (lines, sizeof lines); memset (lines, 0, sizeof lines);
/* Put new lines' hash codes in hash table. Ignore lines shorter /* Put new lines' hash codes in hash table. Ignore lines shorter
than the threshold. Thus, if the lines that are in common are than the threshold. Thus, if the lines that are in common are

View file

@ -1404,7 +1404,7 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n,
} }
/* Store this character into the translated pattern. */ /* Store this character into the translated pattern. */
bcopy (str, pat, charlen); memcpy (pat, str, charlen);
pat += charlen; pat += charlen;
base_pat += in_charlen; base_pat += in_charlen;
len_byte -= in_charlen; len_byte -= in_charlen;
@ -2178,8 +2178,7 @@ wordify (Lisp_Object string, int lax)
if (SYNTAX (c) == Sword) if (SYNTAX (c) == Sword)
{ {
bcopy (SDATA (string) + i_byte_orig, o, memcpy (o, SDATA (string) + i_byte_orig, i_byte - i_byte_orig);
i_byte - i_byte_orig);
o += i_byte - i_byte_orig; o += i_byte - i_byte_orig;
} }
else if (i > 0 && SYNTAX (prev_c) == Sword && --word_count) else if (i > 0 && SYNTAX (prev_c) == Sword && --word_count)
@ -2774,7 +2773,7 @@ since only regular expressions have distinguished subexpressions. */)
/* Now add to the end of SUBSTED. */ /* Now add to the end of SUBSTED. */
if (add_stuff) if (add_stuff)
{ {
bcopy (add_stuff, substed + substed_len, add_len); memcpy (substed + substed_len, add_stuff, add_len);
substed_len += add_len; substed_len += add_len;
} }
} }

View file

@ -550,7 +550,7 @@ wav_init (struct sound *s)
struct wav_header *header = (struct wav_header *) s->header; struct wav_header *header = (struct wav_header *) s->header;
if (s->header_size < sizeof *header if (s->header_size < sizeof *header
|| bcmp (s->header, "RIFF", 4) != 0) || memcmp (s->header, "RIFF", 4) != 0)
return 0; return 0;
/* WAV files are in little-endian order. Convert the header /* WAV files are in little-endian order. Convert the header
@ -658,7 +658,7 @@ au_init (struct sound *s)
struct au_header *header = (struct au_header *) s->header; struct au_header *header = (struct au_header *) s->header;
if (s->header_size < sizeof *header if (s->header_size < sizeof *header
|| bcmp (s->header, ".snd", 4) != 0) || memcmp (s->header, ".snd", 4) != 0)
return 0; return 0;
header->magic_number = be2hl (header->magic_number); header->magic_number = be2hl (header->magic_number);
@ -1380,9 +1380,9 @@ Internal use only, use `play-sound' instead. */)
file = Qnil; file = Qnil;
GCPRO2 (sound, file); GCPRO2 (sound, file);
current_sound_device = (struct sound_device *) xmalloc (sizeof (struct sound_device)); current_sound_device = (struct sound_device *) xmalloc (sizeof (struct sound_device));
bzero (current_sound_device, sizeof (struct sound_device)); memset (current_sound_device, 0, sizeof (struct sound_device));
current_sound = (struct sound *) xmalloc (sizeof (struct sound)); current_sound = (struct sound *) xmalloc (sizeof (struct sound));
bzero (current_sound, sizeof (struct sound)); memset (current_sound, 0, sizeof (struct sound));
record_unwind_protect (sound_cleanup, Qnil); record_unwind_protect (sound_cleanup, Qnil);
current_sound->header = (char *) alloca (MAX_SOUND_HEADER_BYTES); current_sound->header = (char *) alloca (MAX_SOUND_HEADER_BYTES);
@ -1405,7 +1405,8 @@ Internal use only, use `play-sound' instead. */)
{ {
current_sound->data = attrs[SOUND_DATA]; current_sound->data = attrs[SOUND_DATA];
current_sound->header_size = min (MAX_SOUND_HEADER_BYTES, SBYTES (current_sound->data)); current_sound->header_size = min (MAX_SOUND_HEADER_BYTES, SBYTES (current_sound->data));
bcopy (SDATA (current_sound->data), current_sound->header, current_sound->header_size); memcpy (current_sound->header, SDATA (current_sound->data),
current_sound->header_size);
} }
/* Find out the type of sound. Give up if we can't tell. */ /* Find out the type of sound. Give up if we can't tell. */

View file

@ -1422,7 +1422,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
&& (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE)); && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE));
string_multibyte = SBYTES (string) > SCHARS (string); string_multibyte = SBYTES (string) > SCHARS (string);
bzero (fastmap, sizeof fastmap); memset (fastmap, 0, sizeof fastmap);
str = SDATA (string); str = SDATA (string);
size_byte = SBYTES (string); size_byte = SBYTES (string);
@ -1471,7 +1471,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
|| *class_end != ':' || class_end[1] != ']') || *class_end != ':' || class_end[1] != ']')
goto not_a_class_name; goto not_a_class_name;
bcopy (class_beg, class_name, class_end - class_beg); memcpy (class_name, class_beg, class_end - class_beg);
class_name[class_end - class_beg] = 0; class_name[class_end - class_beg] = 0;
cc = re_wctype (class_name); cc = re_wctype (class_name);
@ -1532,8 +1532,8 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
unsigned char fastmap2[0400]; unsigned char fastmap2[0400];
int range_start_byte, range_start_char; int range_start_byte, range_start_char;
bcopy (fastmap2 + 0200, fastmap + 0200, 0200); memcpy (fastmap + 0200, fastmap2 + 0200, 0200);
bzero (fastmap + 0200, 0200); memset (fastmap + 0200, 0, 0200);
/* We are sure that this loop stops. */ /* We are sure that this loop stops. */
for (i = 0200; ! fastmap2[i]; i++); for (i = 0200; ! fastmap2[i]; i++);
c = BYTE8_TO_CHAR (i); c = BYTE8_TO_CHAR (i);
@ -1593,7 +1593,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
|| *class_end != ':' || class_end[1] != ']') || *class_end != ':' || class_end[1] != ']')
goto not_a_class_name_multibyte; goto not_a_class_name_multibyte;
bcopy (class_beg, class_name, class_end - class_beg); memcpy (class_name, class_beg, class_end - class_beg);
class_name[class_end - class_beg] = 0; class_name[class_end - class_beg] = 0;
cc = re_wctype (class_name); cc = re_wctype (class_name);
@ -1678,7 +1678,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
if (! multibyte && n_char_ranges > 0) if (! multibyte && n_char_ranges > 0)
{ {
bzero (fastmap + 0200, 0200); memset (fastmap + 0200, 0, 0200);
for (i = 0; i < n_char_ranges; i += 2) for (i = 0; i < n_char_ranges; i += 2)
{ {
int c1 = char_ranges[i]; int c1 = char_ranges[i];
@ -1907,7 +1907,7 @@ skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim)
multibyte = (!NILP (current_buffer->enable_multibyte_characters) multibyte = (!NILP (current_buffer->enable_multibyte_characters)
&& (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE)); && (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE));
bzero (fastmap, sizeof fastmap); memset (fastmap, 0, sizeof fastmap);
if (SBYTES (string) > SCHARS (string)) if (SBYTES (string) > SCHARS (string))
/* As this is very rare case (syntax spec is ASCII only), don't /* As this is very rare case (syntax spec is ASCII only), don't

View file

@ -623,7 +623,7 @@ sys_subshell (void)
dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil); dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil);
str = (unsigned char *) alloca (SCHARS (dir) + 2); str = (unsigned char *) alloca (SCHARS (dir) + 2);
len = SCHARS (dir); len = SCHARS (dir);
bcopy (SDATA (dir), str, len); memcpy (str, SDATA (dir), len);
if (str[len - 1] != '/') str[len++] = '/'; if (str[len - 1] != '/') str[len++] = '/';
str[len] = 0; str[len] = 0;
xyzzy: xyzzy:
@ -855,7 +855,7 @@ emacs_get_tty (int fd, struct emacs_tty *settings)
/* Retrieve the primary parameters - baud rate, character size, etcetera. */ /* Retrieve the primary parameters - baud rate, character size, etcetera. */
#ifdef HAVE_TCATTR #ifdef HAVE_TCATTR
/* We have those nifty POSIX tcmumbleattr functions. */ /* We have those nifty POSIX tcmumbleattr functions. */
bzero (&settings->main, sizeof (settings->main)); memset (&settings->main, 0, sizeof (settings->main));
if (tcgetattr (fd, &settings->main) < 0) if (tcgetattr (fd, &settings->main) < 0)
return -1; return -1;
@ -922,7 +922,7 @@ emacs_set_tty (int fd, struct emacs_tty *settings, int flushp)
{ {
struct termios new; struct termios new;
bzero (&new, sizeof (new)); memset (&new, 0, sizeof (new));
/* Get the current settings, and see if they're what we asked for. */ /* Get the current settings, and see if they're what we asked for. */
tcgetattr (fd, &new); tcgetattr (fd, &new);
/* We cannot use memcmp on the whole structure here because under /* We cannot use memcmp on the whole structure here because under
@ -2714,6 +2714,59 @@ rmdir (char *dpath)
} }
#endif /* !HAVE_RMDIR */ #endif /* !HAVE_RMDIR */
#ifndef HAVE_MEMSET
void *
memset (void *b, int n, size_t length)
{
unsigned char *p = b;
while (length-- > 0)
*p++ = n;
return b;
}
#endif /* !HAVE_MEMSET */
#ifndef HAVE_MEMCPY
void *
memcpy (void *b1, void *b2, size_t length)
{
unsigned char *p1 = b1, *p2 = b2;
while (length-- > 0)
*p1++ = *p2++;
return b1;
}
#endif /* !HAVE_MEMCPY */
#ifndef HAVE_MEMMOVE
void *
memmove (void *b1, void *b2, size_t length)
{
unsigned char *p1 = b1, *p2 = b2;
if (p1 < p2 || p1 >= p2 + length)
while (length-- > 0)
*p1++ = *p2++;
else
{
p1 += length;
p2 += length;
while (length-- > 0)
*--p1 = *--p2;
}
return b1;
}
#endif /* !HAVE_MEMCPY */
#ifndef HAVE_MEMCMP
int
memcmp (void *b1, void *b2, size_t length)
{
unsigned char *p1 = b1, *p2 = b2;
while (length-- > 0)
if (*p1++ != *p2++)
return p1[-1] < p2[-1] ? -1 : 1;
return 0;
}
#endif /* !HAVE_MEMCMP */
#ifndef HAVE_STRSIGNAL #ifndef HAVE_STRSIGNAL
char * char *

View file

@ -720,7 +720,7 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi
encode_terminal_src_size); encode_terminal_src_size);
buf = encode_terminal_src + nbytes; buf = encode_terminal_src + nbytes;
} }
bcopy (SDATA (string), buf, SBYTES (string)); memcpy (buf, SDATA (string), SBYTES (string));
buf += SBYTES (string); buf += SBYTES (string);
nchars += SCHARS (string); nchars += SCHARS (string);
} }
@ -1225,8 +1225,8 @@ calculate_costs (struct frame *frame)
= (int *) xmalloc (sizeof (int) = (int *) xmalloc (sizeof (int)
+ 2 * max_frame_cols * sizeof (int)); + 2 * max_frame_cols * sizeof (int));
bzero (char_ins_del_vector, (sizeof (int) memset (char_ins_del_vector, 0,
+ 2 * max_frame_cols * sizeof (int))); (sizeof (int) + 2 * max_frame_cols * sizeof (int)));
if (f && (!tty->TS_ins_line && !tty->TS_del_line)) 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)
temp_it.what = IT_CHARACTER; temp_it.what = IT_CHARACTER;
temp_it.len = 1; temp_it.len = 1;
temp_it.object = make_number (0); temp_it.object = make_number (0);
bzero (&temp_it.current, sizeof temp_it.current); memset (&temp_it.current, 0, sizeof temp_it.current);
if (what == IT_CONTINUATION) if (what == IT_CONTINUATION)
{ {
@ -3229,7 +3229,7 @@ create_tty_output (struct frame *f)
abort (); abort ();
t = xmalloc (sizeof (struct tty_output)); t = xmalloc (sizeof (struct tty_output));
bzero (t, sizeof (struct tty_output)); memset (t, 0, sizeof (struct tty_output));
t->display_info = FRAME_TERMINAL (f)->display_info.tty; t->display_info = FRAME_TERMINAL (f)->display_info.tty;
@ -3436,7 +3436,7 @@ init_tty (char *name, char *terminal_type, int must_succeed)
#else #else
tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info)); tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info));
#endif #endif
bzero (tty, sizeof (struct tty_display_info)); memset (tty, 0, sizeof (struct tty_display_info));
tty->next = tty_list; tty->next = tty_list;
tty_list = tty; tty_list = tty;
@ -4028,7 +4028,7 @@ delete_tty (struct terminal *terminal)
xfree (tty->termcap_strings_buffer); xfree (tty->termcap_strings_buffer);
xfree (tty->termcap_term_buffer); xfree (tty->termcap_term_buffer);
bzero (tty, sizeof (struct tty_display_info)); memset (tty, 0, sizeof (struct tty_display_info));
xfree (tty); xfree (tty);
} }

View file

@ -46,11 +46,6 @@ char *malloc ();
char *realloc (); char *realloc ();
#endif #endif
/* Do this after the include, in case string.h prototypes bcopy. */
#if (defined(HAVE_STRING_H) || defined(STDC_HEADERS)) && !defined(bcopy)
#define bcopy(s, d, n) memcpy ((d), (s), (n))
#endif
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
@ -315,7 +310,7 @@ tgetst1 (char *ptr, char **area)
cut[last_p_param].len = r - cut[last_p_param].beg; cut[last_p_param].len = r - cut[last_p_param].beg;
for (i = 0, wp = ret; i <= last_p_param; wp += cut[i++].len) for (i = 0, wp = ret; i <= last_p_param; wp += cut[i++].len)
bcopy (cut[i].beg, wp, cut[i].len); memcpy (wp, cut[i].beg, cut[i].len);
r = wp; r = wp;
} }
} }
@ -739,7 +734,7 @@ gobble_line (int fd, register struct termcap_buffer *bufp, char *append_end)
else else
{ {
append_end -= bufp->ptr - buf; append_end -= bufp->ptr - buf;
bcopy (bufp->ptr, buf, bufp->full -= bufp->ptr - buf); memcpy (buf, bufp->ptr, bufp->full -= bufp->ptr - buf);
bufp->ptr = buf; bufp->ptr = buf;
} }
if (!(nread = read (fd, buf + bufp->full, bufp->size - bufp->full))) if (!(nread = read (fd, buf + bufp->full, bufp->size - bufp->full)))

View file

@ -255,7 +255,7 @@ struct input_event
Lisp_Object arg; Lisp_Object arg;
}; };
#define EVENT_INIT(event) bzero (&(event), sizeof (struct input_event)) #define EVENT_INIT(event) memset (&(event), 0, sizeof (struct input_event))
/* Bits in the modifiers member of the input_event structure. /* Bits in the modifiers member of the input_event structure.
Note that reorder_modifiers assumes that the bits are in canonical Note that reorder_modifiers assumes that the bits are in canonical

View file

@ -35,11 +35,6 @@ char *malloc ();
char *realloc (); char *realloc ();
#endif #endif
/* Do this after the include, in case string.h prototypes bcopy. */
#if (defined(HAVE_STRING_H) || defined(STDC_HEADERS)) && !defined(bcopy)
#define bcopy(s, d, n) memcpy ((d), (s), (n))
#endif
#endif /* not emacs */ #endif /* not emacs */
#ifndef NULL #ifndef NULL
@ -151,7 +146,7 @@ tparam1 (char *string, char *outstring, int len, char *up, char *left, register
{ {
outlen = len + 40; outlen = len + 40;
new = (char *) xmalloc (outlen); new = (char *) xmalloc (outlen);
bcopy (outstring, new, offset); memcpy (new, outstring, offset);
} }
else else
{ {

View file

@ -260,7 +260,7 @@ unexec (new_name, a_name, data_start, bss_start, entry_address)
Brk = brk; Brk = brk;
bcopy (data_section, &old_data_scnhdr, sizeof (old_data_scnhdr)); memcpy (&old_data_scnhdr, data_section, sizeof (old_data_scnhdr));
nhdr.aout.dsize = brk - DATA_START; nhdr.aout.dsize = brk - DATA_START;
nhdr.aout.bsize = 0; nhdr.aout.bsize = 0;
@ -328,7 +328,7 @@ unexec (new_name, a_name, data_start, bss_start, entry_address)
#ifdef _GOT #ifdef _GOT
if (got_section != NULL) if (got_section != NULL)
{ {
bcopy (got_section, buffer, sizeof (struct scnhdr)); memcpy (buffer, got_section, sizeof (struct scnhdr));
got_section->s_vaddr = vaddr; got_section->s_vaddr = vaddr;
got_section->s_paddr = vaddr; got_section->s_paddr = vaddr;
@ -376,7 +376,7 @@ unexec (new_name, a_name, data_start, bss_start, entry_address)
* Construct new symbol table header * Construct new symbol table header
*/ */
bcopy (oldptr + nhdr.fhdr.f_symptr, buffer, cbHDRR); memcpy (buffer, oldptr + nhdr.fhdr.f_symptr, cbHDRR);
#define symhdr ((pHDRR)buffer) #define symhdr ((pHDRR)buffer)
newsyms = nhdr.aout.tsize + nhdr.aout.dsize; newsyms = nhdr.aout.tsize + nhdr.aout.dsize;

View file

@ -472,7 +472,7 @@ write_segment (new, ptr, end)
int pagesize = getpagesize (); int pagesize = getpagesize ();
char zeros[1 << 13]; char zeros[1 << 13];
bzero (zeros, sizeof (zeros)); memset (zeros, 0, sizeof (zeros));
for (i = 0; ptr < end;) for (i = 0; ptr < end;)
{ {

View file

@ -218,7 +218,7 @@ unexec_write_zero (off_t dest, size_t count)
char buf[UNEXEC_COPY_BUFSZ]; char buf[UNEXEC_COPY_BUFSZ];
ssize_t bytes; ssize_t bytes;
bzero (buf, UNEXEC_COPY_BUFSZ); memset (buf, 0, UNEXEC_COPY_BUFSZ);
if (lseek (outfd, dest, SEEK_SET) != dest) if (lseek (outfd, dest, SEEK_SET) != dest)
return 0; return 0;

View file

@ -2746,7 +2746,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
PAINTSTRUCT paintStruct; PAINTSTRUCT paintStruct;
RECT update_rect; RECT update_rect;
bzero (&update_rect, sizeof (update_rect)); memset (&update_rect, 0, sizeof (update_rect));
f = x_window_to_frame (dpyinfo, hwnd); f = x_window_to_frame (dpyinfo, hwnd);
if (f == 0) if (f == 0)
@ -4275,7 +4275,7 @@ This function is an internal primitive--use `make-frame' instead. */)
f->output_method = output_w32; f->output_method = output_w32;
f->output_data.w32 = f->output_data.w32 =
(struct w32_output *) xmalloc (sizeof (struct w32_output)); (struct w32_output *) xmalloc (sizeof (struct w32_output));
bzero (f->output_data.w32, sizeof (struct w32_output)); memset (f->output_data.w32, 0, sizeof (struct w32_output));
FRAME_FONTSET (f) = -1; FRAME_FONTSET (f) = -1;
f->icon_name f->icon_name
@ -5388,7 +5388,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
f->output_method = output_w32; f->output_method = output_w32;
f->output_data.w32 = f->output_data.w32 =
(struct w32_output *) xmalloc (sizeof (struct w32_output)); (struct w32_output *) xmalloc (sizeof (struct w32_output));
bzero (f->output_data.w32, sizeof (struct w32_output)); memset (f->output_data.w32, 0, sizeof (struct w32_output));
FRAME_FONTSET (f) = -1; FRAME_FONTSET (f) = -1;
f->icon_name = Qnil; f->icon_name = Qnil;
@ -6046,7 +6046,7 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */)
specbind (Qinhibit_redisplay, Qt); specbind (Qinhibit_redisplay, Qt);
BLOCK_INPUT; BLOCK_INPUT;
bzero (&new_file_details, sizeof (new_file_details)); memset (&new_file_details, 0, sizeof (new_file_details));
/* Apparently NT4 crashes if you give it an unexpected size. /* Apparently NT4 crashes if you give it an unexpected size.
I'm not sure about Windows 9x, so play it safe. */ I'm not sure about Windows 9x, so play it safe. */
if (w32_major_version > 4 && w32_major_version < 95) if (w32_major_version > 4 && w32_major_version < 95)
@ -6157,10 +6157,10 @@ DEFUN ("system-move-file-to-trash", Fsystem_move_file_to_trash,
/* On Windows, write permission is required to delete/move files. */ /* On Windows, write permission is required to delete/move files. */
_chmod (path, 0666); _chmod (path, 0666);
bzero (tmp_path, sizeof (tmp_path)); memset (tmp_path, 0, sizeof (tmp_path));
strcpy (tmp_path, path); strcpy (tmp_path, path);
bzero (&file_op, sizeof (file_op)); memset (&file_op, 0, sizeof (file_op));
file_op.hwnd = HWND_DESKTOP; file_op.hwnd = HWND_DESKTOP;
file_op.wFunc = FO_DELETE; file_op.wFunc = FO_DELETE;
file_op.pFrom = tmp_path; file_op.pFrom = tmp_path;

View file

@ -225,7 +225,7 @@ w32font_list_family (Lisp_Object frame)
HDC dc; HDC dc;
FRAME_PTR f = XFRAME (frame); FRAME_PTR f = XFRAME (frame);
bzero (&font_match_pattern, sizeof (font_match_pattern)); memset (&font_match_pattern, 0, sizeof (font_match_pattern));
font_match_pattern.lfCharSet = DEFAULT_CHARSET; font_match_pattern.lfCharSet = DEFAULT_CHARSET;
dc = get_frame_dc (f); dc = get_frame_dc (f);
@ -373,7 +373,7 @@ w32font_text_extents (struct font *font, unsigned *code,
if (metrics) if (metrics)
{ {
bzero (metrics, sizeof (struct font_metrics)); memset (metrics, 0, sizeof (struct font_metrics));
metrics->ascent = font->ascent; metrics->ascent = font->ascent;
metrics->descent = font->descent; metrics->descent = font->descent;
@ -394,9 +394,9 @@ w32font_text_extents (struct font *font, unsigned *code,
= xrealloc (w32_font->cached_metrics, = xrealloc (w32_font->cached_metrics,
(block + 1) (block + 1)
* sizeof (struct w32_metric_cache *)); * sizeof (struct w32_metric_cache *));
bzero (w32_font->cached_metrics + w32_font->n_cache_blocks, memset (w32_font->cached_metrics + w32_font->n_cache_blocks, 0,
((block + 1 - w32_font->n_cache_blocks) ((block + 1 - w32_font->n_cache_blocks)
* sizeof (struct w32_metric_cache *))); * sizeof (struct w32_metric_cache *)));
w32_font->n_cache_blocks = block + 1; w32_font->n_cache_blocks = block + 1;
} }
@ -404,8 +404,8 @@ w32font_text_extents (struct font *font, unsigned *code,
{ {
w32_font->cached_metrics[block] w32_font->cached_metrics[block]
= xmalloc (CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache)); = xmalloc (CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache));
bzero (w32_font->cached_metrics[block], memset (w32_font->cached_metrics[block], 0,
CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache)); CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache));
} }
char_metric = w32_font->cached_metrics[block] + pos_in_block; 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
match_data.list = Qnil; match_data.list = Qnil;
match_data.frame = frame; match_data.frame = frame;
bzero (&match_data.pattern, sizeof (LOGFONT)); memset (&match_data.pattern, 0, sizeof (LOGFONT));
fill_in_logfont (f, &match_data.pattern, font_spec); fill_in_logfont (f, &match_data.pattern, font_spec);
/* If the charset is unrecognized, then we won't find a font, so don't /* 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
match_data.frame = frame; match_data.frame = frame;
match_data.list = Qnil; match_data.list = Qnil;
bzero (&match_data.pattern, sizeof (LOGFONT)); memset (&match_data.pattern, 0, sizeof (LOGFONT));
fill_in_logfont (f, &match_data.pattern, font_spec); fill_in_logfont (f, &match_data.pattern, font_spec);
match_data.opentype_only = opentype_only; match_data.opentype_only = opentype_only;
@ -795,7 +795,7 @@ w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity,
if (!font) if (!font)
return 0; return 0;
bzero (&logfont, sizeof (logfont)); memset (&logfont, 0, sizeof (logfont));
fill_in_logfont (f, &logfont, font_entity); fill_in_logfont (f, &logfont, font_entity);
/* Prefer truetype fonts, to avoid known problems with type1 fonts, and /* 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,
{ {
metrics = (OUTLINETEXTMETRICW *) alloca (len); metrics = (OUTLINETEXTMETRICW *) alloca (len);
if (GetOutlineTextMetricsW (dc, len, metrics)) if (GetOutlineTextMetricsW (dc, len, metrics))
bcopy (&metrics->otmTextMetrics, &w32_font->metrics, memcpy (&w32_font->metrics, &metrics->otmTextMetrics,
sizeof (TEXTMETRICW)); sizeof (TEXTMETRICW));
else else
metrics = NULL; metrics = NULL;
} }
@ -2306,7 +2306,7 @@ compute_metrics (HDC dc, struct w32font_info *w32_font, unsigned int code,
if (w32_font->glyph_idx) if (w32_font->glyph_idx)
options |= GGO_GLYPH_INDEX; options |= GGO_GLYPH_INDEX;
bzero (&transform, sizeof (transform)); memset (&transform, 0, sizeof (transform));
transform.eM11.value = 1; transform.eM11.value = 1;
transform.eM22.value = 1; transform.eM22.value = 1;
@ -2340,8 +2340,8 @@ in the font selection dialog. */)
HANDLE oldobj; HANDLE oldobj;
char buf[100]; char buf[100];
bzero (&cf, sizeof (cf)); memset (&cf, 0, sizeof (cf));
bzero (&lf, sizeof (lf)); memset (&lf, 0, sizeof (lf));
cf.lStructSize = sizeof (cf); cf.lStructSize = sizeof (cf);
cf.hwndOwner = FRAME_W32_WINDOW (f); cf.hwndOwner = FRAME_W32_WINDOW (f);

View file

@ -450,8 +450,8 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
/* Save the frame's previous menu bar contents data. */ /* Save the frame's previous menu bar contents data. */
if (previous_menu_items_used) if (previous_menu_items_used)
bcopy (XVECTOR (f->menu_bar_vector)->contents, previous_items, memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents,
previous_menu_items_used * sizeof (Lisp_Object)); previous_menu_items_used * sizeof (Lisp_Object));
/* Fill in menu_items with the current menu bar contents. /* Fill in menu_items with the current menu bar contents.
This can evaluate Lisp code. */ This can evaluate Lisp code. */
@ -1522,7 +1522,7 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
if (set_menu_item_info) if (set_menu_item_info)
{ {
MENUITEMINFO info; MENUITEMINFO info;
bzero (&info, sizeof (info)); memset (&info, 0, sizeof (info));
info.cbSize = sizeof (info); info.cbSize = sizeof (info);
info.fMask = MIIM_DATA; info.fMask = MIIM_DATA;
@ -1605,7 +1605,7 @@ w32_menu_display_help (HWND owner, HMENU menu, UINT item, UINT flags)
{ {
MENUITEMINFO info; MENUITEMINFO info;
bzero (&info, sizeof (info)); memset (&info, 0, sizeof (info));
info.cbSize = sizeof (info); info.cbSize = sizeof (info);
info.fMask = MIIM_DATA; info.fMask = MIIM_DATA;
get_menu_item_info (menu, item, FALSE, &info); get_menu_item_info (menu, item, FALSE, &info);
@ -1642,7 +1642,7 @@ w32_free_submenu_strings (HMENU menu)
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
{ {
MENUITEMINFO info; MENUITEMINFO info;
bzero (&info, sizeof (info)); memset (&info, 0, sizeof (info));
info.cbSize = sizeof (info); info.cbSize = sizeof (info);
info.fMask = MIIM_DATA | MIIM_TYPE | MIIM_SUBMENU; info.fMask = MIIM_DATA | MIIM_TYPE | MIIM_SUBMENU;

View file

@ -323,7 +323,7 @@ XGCValues *
XCreateGC (void *ignore, Window window, unsigned long mask, XGCValues *xgcv) XCreateGC (void *ignore, Window window, unsigned long mask, XGCValues *xgcv)
{ {
XGCValues *gc = (XGCValues *) xmalloc (sizeof (XGCValues)); XGCValues *gc = (XGCValues *) xmalloc (sizeof (XGCValues));
bzero (gc, sizeof (XGCValues)); memset (gc, 0, sizeof (XGCValues));
XChangeGC (ignore, gc, mask, xgcv); XChangeGC (ignore, gc, mask, xgcv);
@ -5826,7 +5826,7 @@ w32_initialize_display_info (Lisp_Object display_name)
{ {
struct w32_display_info *dpyinfo = &one_w32_display_info; struct w32_display_info *dpyinfo = &one_w32_display_info;
bzero (dpyinfo, sizeof (*dpyinfo)); memset (dpyinfo, 0, sizeof (*dpyinfo));
/* Put it on w32_display_name_list. */ /* Put it on w32_display_name_list. */
w32_display_name_list = Fcons (Fcons (display_name, Qnil), w32_display_name_list = Fcons (Fcons (display_name, Qnil),

View file

@ -97,7 +97,7 @@ uniscribe_list_family (Lisp_Object frame)
HDC dc; HDC dc;
FRAME_PTR f = XFRAME (frame); FRAME_PTR f = XFRAME (frame);
bzero (&font_match_pattern, sizeof (font_match_pattern)); memset (&font_match_pattern, 0, sizeof (font_match_pattern));
/* Limit enumerated fonts to outline fonts to save time. */ /* Limit enumerated fonts to outline fonts to save time. */
font_match_pattern.lfOutPrecision = OUT_OUTLINE_PRECIS; font_match_pattern.lfOutPrecision = OUT_OUTLINE_PRECIS;

View file

@ -178,7 +178,7 @@ get_next_msg (W32Msg * lpmsg, BOOL bWait)
if (nQueue) if (nQueue)
{ {
bcopy (&(lpHead->w32msg), lpmsg, sizeof (W32Msg)); memcpy (lpmsg, &lpHead->w32msg, sizeof (W32Msg));
{ {
int_msg * lpCur = lpHead; int_msg * lpCur = lpHead;
@ -250,7 +250,7 @@ post_msg (W32Msg * lpmsg)
if (!lpNew) if (!lpNew)
return (FALSE); return (FALSE);
bcopy (lpmsg, &(lpNew->w32msg), sizeof (W32Msg)); memcpy (&lpNew->w32msg, lpmsg, sizeof (W32Msg));
lpNew->lpNext = NULL; lpNew->lpNext = NULL;
enter_crit (); enter_crit ();
@ -280,7 +280,7 @@ prepend_msg (W32Msg *lpmsg)
if (!lpNew) if (!lpNew)
return (FALSE); return (FALSE);
bcopy (lpmsg, &(lpNew->w32msg), sizeof (W32Msg)); memcpy (&lpNew->w32msg, lpmsg, sizeof (W32Msg));
enter_crit (); enter_crit ();

View file

@ -243,9 +243,9 @@ make_window (void)
p->dedicated = Qnil; p->dedicated = Qnil;
p->window_parameters = Qnil; p->window_parameters = Qnil;
p->pseudo_window_p = 0; p->pseudo_window_p = 0;
bzero (&p->cursor, sizeof (p->cursor)); memset (&p->cursor, 0, sizeof (p->cursor));
bzero (&p->last_cursor, sizeof (p->last_cursor)); memset (&p->last_cursor, 0, sizeof (p->last_cursor));
bzero (&p->phys_cursor, sizeof (p->phys_cursor)); memset (&p->phys_cursor, 0, sizeof (p->phys_cursor));
p->desired_matrix = p->current_matrix = 0; p->desired_matrix = p->current_matrix = 0;
p->nrows_scale_factor = p->ncols_scale_factor = 1; p->nrows_scale_factor = p->ncols_scale_factor = 1;
p->phys_cursor_type = -1; p->phys_cursor_type = -1;
@ -1557,9 +1557,9 @@ replace_window (Lisp_Object old, Lisp_Object replacement)
p->total_lines = o->total_lines; p->total_lines = o->total_lines;
p->desired_matrix = p->current_matrix = 0; p->desired_matrix = p->current_matrix = 0;
p->vscroll = 0; p->vscroll = 0;
bzero (&p->cursor, sizeof (p->cursor)); memset (&p->cursor, 0, sizeof (p->cursor));
bzero (&p->last_cursor, sizeof (p->last_cursor)); memset (&p->last_cursor, 0, sizeof (p->last_cursor));
bzero (&p->phys_cursor, sizeof (p->phys_cursor)); memset (&p->phys_cursor, 0, sizeof (p->phys_cursor));
p->phys_cursor_type = -1; p->phys_cursor_type = -1;
p->phys_cursor_width = -1; p->phys_cursor_width = -1;
p->must_be_updated_p = 0; p->must_be_updated_p = 0;
@ -3481,7 +3481,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
XSETFASTINT (w->window_end_pos, 0); XSETFASTINT (w->window_end_pos, 0);
XSETFASTINT (w->window_end_vpos, 0); XSETFASTINT (w->window_end_vpos, 0);
bzero (&w->last_cursor, sizeof w->last_cursor); memset (&w->last_cursor, 0, sizeof w->last_cursor);
w->window_end_valid = Qnil; w->window_end_valid = Qnil;
if (!(keep_margins_p && samebuf)) if (!(keep_margins_p && samebuf))
{ /* If we're not actually changing the buffer, don't reset hscroll and { /* 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. */)
p->parent = o->parent; p->parent = o->parent;
p->buffer = Qt; p->buffer = Qt;
p->window_end_valid = Qnil; p->window_end_valid = Qnil;
bzero (&p->last_cursor, sizeof p->last_cursor); memset (&p->last_cursor, 0, sizeof p->last_cursor);
/* Duplicate special geometry settings. */ /* Duplicate special geometry settings. */

View file

@ -2576,7 +2576,7 @@ init_iterator (struct it *it, struct window *w,
} }
/* Clear IT. */ /* Clear IT. */
bzero (it, sizeof *it); memset (it, 0, sizeof *it);
it->current.overlay_string_index = -1; it->current.overlay_string_index = -1;
it->current.dpvec_index = -1; it->current.dpvec_index = -1;
it->base_face_id = remapped_base_face_id; it->base_face_id = remapped_base_face_id;
@ -4912,7 +4912,7 @@ load_overlay_strings (struct it *it, int charpos)
entries = \ entries = \
(struct overlay_entry *) alloca (new_size \ (struct overlay_entry *) alloca (new_size \
* sizeof *entries); \ * sizeof *entries); \
bcopy (old, entries, size * sizeof *entries); \ memcpy (entries, old, size * sizeof *entries); \
size = new_size; \ size = new_size; \
} \ } \
\ \
@ -5630,7 +5630,7 @@ reseat_to_string (struct it *it, unsigned char *s, Lisp_Object string,
it->stop_charpos = -1; it->stop_charpos = -1;
/* Set iterator position and end position. */ /* Set iterator position and end position. */
bzero (&it->current, sizeof it->current); memset (&it->current, 0, sizeof it->current);
it->current.overlay_string_index = -1; it->current.overlay_string_index = -1;
it->current.dpvec_index = -1; it->current.dpvec_index = -1;
xassert (charpos >= 0); xassert (charpos >= 0);
@ -7999,7 +7999,7 @@ add_to_log (char *format, Lisp_Object arg1, Lisp_Object arg2)
len = SBYTES (msg) + 1; len = SBYTES (msg) + 1;
SAFE_ALLOCA (buffer, char *, len); SAFE_ALLOCA (buffer, char *, len);
bcopy (SDATA (msg), buffer, len); memcpy (buffer, SDATA (msg), len);
message_dolog (buffer, len - 1, 1, 0); message_dolog (buffer, len - 1, 1, 0);
SAFE_FREE (); SAFE_FREE ();
@ -8328,7 +8328,7 @@ message3 (Lisp_Object m, int nbytes, int multibyte)
USE_SAFE_ALLOCA; USE_SAFE_ALLOCA;
SAFE_ALLOCA (buffer, char *, nbytes); SAFE_ALLOCA (buffer, char *, nbytes);
bcopy (SDATA (m), buffer, nbytes); memcpy (buffer, SDATA (m), nbytes);
message_dolog (buffer, nbytes, 1, multibyte); message_dolog (buffer, nbytes, 1, multibyte);
SAFE_FREE (); SAFE_FREE ();
} }
@ -9754,7 +9754,7 @@ x_consider_frame_title (Lisp_Object frame)
higher level than this.) */ higher level than this.) */
if (! STRINGP (f->name) if (! STRINGP (f->name)
|| SBYTES (f->name) != len || SBYTES (f->name) != len
|| bcmp (title, SDATA (f->name), len) != 0) || memcmp (title, SDATA (f->name), len) != 0)
x_implicitly_set_name (f, make_string (title, len), Qnil); x_implicitly_set_name (f, make_string (title, len), Qnil);
} }
} }
@ -16763,7 +16763,7 @@ append_space_for_newline (struct it *it, int default_face_p)
saved_pos = it->position; saved_pos = it->position;
it->what = IT_CHARACTER; it->what = IT_CHARACTER;
bzero (&it->position, sizeof it->position); memset (&it->position, 0, sizeof it->position);
it->object = make_number (0); it->object = make_number (0);
it->c = ' '; it->c = ' ';
it->len = 1; it->len = 1;
@ -16883,7 +16883,7 @@ extend_face_to_end_of_line (struct it *it)
(((it->ascent + it->descent) (((it->ascent + it->descent)
* FONT_BASE (font)) / FONT_HEIGHT (font)); * FONT_BASE (font)) / FONT_HEIGHT (font));
saved_pos = it->position; saved_pos = it->position;
bzero (&it->position, sizeof it->position); memset (&it->position, 0, sizeof it->position);
saved_avoid_cursor = it->avoid_cursor_p; saved_avoid_cursor = it->avoid_cursor_p;
it->avoid_cursor_p = 1; it->avoid_cursor_p = 1;
saved_face_id = it->face_id; saved_face_id = it->face_id;
@ -16916,7 +16916,7 @@ extend_face_to_end_of_line (struct it *it)
saved_pos = it->position; saved_pos = it->position;
it->what = IT_CHARACTER; it->what = IT_CHARACTER;
bzero (&it->position, sizeof it->position); memset (&it->position, 0, sizeof it->position);
it->object = make_number (0); it->object = make_number (0);
it->c = ' '; it->c = ' ';
it->len = 1; it->len = 1;
@ -19259,7 +19259,7 @@ decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_
eol_str = invalid_eol_type; eol_str = invalid_eol_type;
eol_str_len = sizeof (invalid_eol_type) - 1; eol_str_len = sizeof (invalid_eol_type) - 1;
} }
bcopy (eol_str, buf, eol_str_len); memcpy (buf, eol_str, eol_str_len);
buf += eol_str_len; buf += eol_str_len;
} }
@ -20397,7 +20397,7 @@ init_glyph_string (struct glyph_string *s,
XChar2b *char2b, struct window *w, struct glyph_row *row, XChar2b *char2b, struct window *w, struct glyph_row *row,
enum glyph_row_area area, int start, enum draw_glyphs_face hl) enum glyph_row_area area, int start, enum draw_glyphs_face hl)
{ {
bzero (s, sizeof *s); memset (s, 0, sizeof *s);
s->w = w; s->w = w;
s->f = XFRAME (w->frame); s->f = XFRAME (w->frame);
#ifdef HAVE_NTGUI #ifdef HAVE_NTGUI

View file

@ -764,7 +764,7 @@ x_create_gc (f, mask, xgcv)
{ {
GC gc = xmalloc (sizeof (*gc)); GC gc = xmalloc (sizeof (*gc));
if (gc) if (gc)
bcopy (xgcv, gc, sizeof (XGCValues)); memcpy (gc, xgcv, sizeof (XGCValues));
return gc; return gc;
} }
@ -2190,8 +2190,8 @@ get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name, Lisp_Obje
lface = lface_from_face_name_no_resolve (f, face_name, signal_p); lface = lface_from_face_name_no_resolve (f, face_name, signal_p);
if (! NILP (lface)) if (! NILP (lface))
bcopy (XVECTOR (lface)->contents, attrs, memcpy (attrs, XVECTOR (lface)->contents,
LFACE_VECTOR_SIZE * sizeof *attrs); LFACE_VECTOR_SIZE * sizeof *attrs);
return !NILP (lface); return !NILP (lface);
} }
@ -2861,8 +2861,8 @@ The value is TO. */)
copy = Finternal_make_lisp_face (to, new_frame); copy = Finternal_make_lisp_face (to, new_frame);
} }
bcopy (XVECTOR (lface)->contents, XVECTOR (copy)->contents, memcpy (XVECTOR (copy)->contents, XVECTOR (lface)->contents,
LFACE_VECTOR_SIZE * sizeof (Lisp_Object)); LFACE_VECTOR_SIZE * sizeof (Lisp_Object));
/* Changing a named face means that all realized faces depending on /* Changing a named face means that all realized faces depending on
that face are invalid. Since we cannot tell which realized faces that face are invalid. Since we cannot tell which realized faces
@ -3890,9 +3890,9 @@ Default face attributes override any local face attributes. */)
{ {
/* Ensure that the face vector is fully specified by merging /* Ensure that the face vector is fully specified by merging
the previously-cached vector. */ the previously-cached vector. */
bcopy (oldface->lface, attrs, sizeof attrs); memcpy (attrs, oldface->lface, sizeof attrs);
merge_face_vectors (f, lvec, attrs, 0); merge_face_vectors (f, lvec, attrs, 0);
bcopy (attrs, lvec, sizeof attrs); memcpy (lvec, attrs, sizeof attrs);
newface = realize_face (c, lvec, DEFAULT_FACE_ID); newface = realize_face (c, lvec, DEFAULT_FACE_ID);
if ((! UNSPECIFIEDP (gvec[LFACE_FAMILY_INDEX]) if ((! UNSPECIFIEDP (gvec[LFACE_FAMILY_INDEX])
@ -3997,7 +3997,7 @@ face_attr_equal_p (Lisp_Object v1, Lisp_Object v2)
if (SBYTES (v1) != SBYTES (v2)) if (SBYTES (v1) != SBYTES (v2))
return 0; return 0;
return bcmp (SDATA (v1), SDATA (v2), SBYTES (v1)) == 0; return memcmp (SDATA (v1), SDATA (v2), SBYTES (v1)) == 0;
case_Lisp_Int: case_Lisp_Int:
case Lisp_Symbol: case Lisp_Symbol:
@ -4169,9 +4169,9 @@ static struct face *
make_realized_face (Lisp_Object *attr) make_realized_face (Lisp_Object *attr)
{ {
struct face *face = (struct face *) xmalloc (sizeof *face); struct face *face = (struct face *) xmalloc (sizeof *face);
bzero (face, sizeof *face); memset (face, 0, sizeof *face);
face->ascii_face = face; face->ascii_face = face;
bcopy (attr, face->lface, sizeof face->lface); memcpy (face->lface, attr, sizeof face->lface);
return face; return face;
} }
@ -4316,10 +4316,10 @@ make_face_cache (struct frame *f)
int size; int size;
c = (struct face_cache *) xmalloc (sizeof *c); c = (struct face_cache *) xmalloc (sizeof *c);
bzero (c, sizeof *c); memset (c, 0, sizeof *c);
size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets; size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
c->buckets = (struct face **) xmalloc (size); c->buckets = (struct face **) xmalloc (size);
bzero (c->buckets, size); memset (c->buckets, 0, size);
c->size = 50; c->size = 50;
c->faces_by_id = (struct face **) xmalloc (c->size * sizeof *c->faces_by_id); c->faces_by_id = (struct face **) xmalloc (c->size * sizeof *c->faces_by_id);
c->f = f; c->f = f;
@ -4383,7 +4383,7 @@ free_realized_faces (struct face_cache *c)
c->used = 0; c->used = 0;
size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets; size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
bzero (c->buckets, size); memset (c->buckets, 0, size);
/* Must do a thorough redisplay the next time. Mark current /* Must do a thorough redisplay the next time. Mark current
matrices as invalid because they will reference faces freed 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)
if (! get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0)) if (! get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
return -1; return -1;
bcopy (default_face->lface, attrs, sizeof attrs); memcpy (attrs, default_face->lface, sizeof attrs);
merge_face_vectors (f, symbol_attrs, attrs, 0); merge_face_vectors (f, symbol_attrs, attrs, 0);
return lookup_face (f, attrs); return lookup_face (f, attrs);
@ -4781,7 +4781,7 @@ smaller_face (struct frame *f, int face_id, int steps)
steps = eabs (steps); steps = eabs (steps);
face = FACE_FROM_ID (f, face_id); face = FACE_FROM_ID (f, face_id);
bcopy (face->lface, attrs, sizeof attrs); memcpy (attrs, face->lface, sizeof attrs);
pt = last_pt = XFASTINT (attrs[LFACE_HEIGHT_INDEX]); pt = last_pt = XFASTINT (attrs[LFACE_HEIGHT_INDEX]);
new_face_id = face_id; new_face_id = face_id;
last_height = FONT_HEIGHT (face->font); last_height = FONT_HEIGHT (face->font);
@ -4832,7 +4832,7 @@ face_with_height (struct frame *f, int face_id, int height)
return face_id; return face_id;
face = FACE_FROM_ID (f, face_id); face = FACE_FROM_ID (f, face_id);
bcopy (face->lface, attrs, sizeof attrs); memcpy (attrs, face->lface, sizeof attrs);
attrs[LFACE_HEIGHT_INDEX] = make_number (height); attrs[LFACE_HEIGHT_INDEX] = make_number (height);
font_clear_prop (attrs, FONT_SIZE_INDEX); font_clear_prop (attrs, FONT_SIZE_INDEX);
face_id = lookup_face (f, attrs); face_id = lookup_face (f, attrs);
@ -4862,7 +4862,7 @@ lookup_derived_face (struct frame *f, Lisp_Object symbol, int face_id, int signa
if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0)) if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
return -1; return -1;
bcopy (default_face->lface, attrs, sizeof attrs); memcpy (attrs, default_face->lface, sizeof attrs);
merge_face_vectors (f, symbol_attrs, attrs, 0); merge_face_vectors (f, symbol_attrs, attrs, 0);
return lookup_face (f, attrs); return lookup_face (f, attrs);
} }
@ -4953,7 +4953,7 @@ x_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, struct face *
Lisp_Object merged_attrs[LFACE_VECTOR_SIZE]; Lisp_Object merged_attrs[LFACE_VECTOR_SIZE];
int i; int i;
bcopy (def_attrs, merged_attrs, sizeof merged_attrs); memcpy (merged_attrs, def_attrs, sizeof merged_attrs);
merge_face_vectors (f, attrs, merged_attrs, 0); merge_face_vectors (f, attrs, merged_attrs, 0);
@ -5274,7 +5274,7 @@ Value is ORDER. */)
int indices[DIM (font_sort_order)]; int indices[DIM (font_sort_order)];
CHECK_LIST (order); CHECK_LIST (order);
bzero (indices, sizeof indices); memset (indices, 0, sizeof indices);
i = 0; i = 0;
for (list = order; for (list = order;
@ -5306,9 +5306,9 @@ Value is ORDER. */)
if (indices[i] == 0) if (indices[i] == 0)
signal_error ("Invalid font sort order", order); signal_error ("Invalid font sort order", order);
if (bcmp (indices, font_sort_order, sizeof indices) != 0) if (memcmp (indices, font_sort_order, sizeof indices) != 0)
{ {
bcopy (indices, font_sort_order, sizeof font_sort_order); memcpy (font_sort_order, indices, sizeof font_sort_order);
free_all_realized_faces (Qnil); free_all_realized_faces (Qnil);
} }
@ -5553,7 +5553,7 @@ realize_default_face (struct frame *f)
/* Realize the face; it must be fully-specified now. */ /* Realize the face; it must be fully-specified now. */
xassert (lface_fully_specified_p (XVECTOR (lface)->contents)); xassert (lface_fully_specified_p (XVECTOR (lface)->contents));
check_lface (lface); check_lface (lface);
bcopy (XVECTOR (lface)->contents, attrs, sizeof attrs); memcpy (attrs, XVECTOR (lface)->contents, sizeof attrs);
face = realize_face (c, attrs, DEFAULT_FACE_ID); face = realize_face (c, attrs, DEFAULT_FACE_ID);
#ifdef HAVE_WINDOW_SYSTEM #ifdef HAVE_WINDOW_SYSTEM
@ -6074,7 +6074,7 @@ compute_char_face (struct frame *f, int ch, Lisp_Object prop)
{ {
Lisp_Object attrs[LFACE_VECTOR_SIZE]; Lisp_Object attrs[LFACE_VECTOR_SIZE];
struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); struct face *default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
bcopy (default_face->lface, attrs, sizeof attrs); memcpy (attrs, default_face->lface, sizeof attrs);
merge_face_ref (f, prop, attrs, 1, 0); merge_face_ref (f, prop, attrs, 1, 0);
face_id = lookup_face (f, attrs); face_id = lookup_face (f, attrs);
} }
@ -6163,7 +6163,7 @@ face_at_buffer_position (w, pos, region_beg, region_end,
return default_face->id; return default_face->id;
/* Begin with attributes from the default face. */ /* Begin with attributes from the default face. */
bcopy (default_face->lface, attrs, sizeof attrs); memcpy (attrs, default_face->lface, sizeof attrs);
/* Merge in attributes specified via text properties. */ /* Merge in attributes specified via text properties. */
if (!NILP (prop)) if (!NILP (prop))
@ -6257,7 +6257,7 @@ face_for_overlay_string (w, pos, region_beg, region_end,
return DEFAULT_FACE_ID; return DEFAULT_FACE_ID;
/* Begin with attributes from the default face. */ /* Begin with attributes from the default face. */
bcopy (default_face->lface, attrs, sizeof attrs); memcpy (attrs, default_face->lface, sizeof attrs);
/* Merge in attributes specified via text properties. */ /* Merge in attributes specified via text properties. */
if (!NILP (prop)) if (!NILP (prop))
@ -6358,7 +6358,7 @@ face_at_string_position (w, string, pos, bufpos, region_beg,
return base_face->id; return base_face->id;
/* Begin with attributes from the base face. */ /* Begin with attributes from the base face. */
bcopy (base_face->lface, attrs, sizeof attrs); memcpy (attrs, base_face->lface, sizeof attrs);
/* Merge in attributes specified via text properties. */ /* Merge in attributes specified via text properties. */
if (!NILP (prop)) if (!NILP (prop))
@ -6413,7 +6413,7 @@ merge_faces (struct frame *f, Lisp_Object face_name, int face_id, int base_face_
} }
/* Begin with attributes from the base face. */ /* Begin with attributes from the base face. */
bcopy (base_face->lface, attrs, sizeof attrs); memcpy (attrs, base_face->lface, sizeof attrs);
if (!NILP (face_name)) if (!NILP (face_name))
{ {

View file

@ -1925,7 +1925,7 @@ xic_create_fontsetname (char *base_fontname, int motif)
{ /* There is no base font name, use the default. */ { /* There is no base font name, use the default. */
int len = strlen (base_fontname) + 2; int len = strlen (base_fontname) + 2;
fontsetname = xmalloc (len); fontsetname = xmalloc (len);
bzero (fontsetname, len); memset (fontsetname, 0, len);
strcpy (fontsetname, base_fontname); strcpy (fontsetname, base_fontname);
} }
else else
@ -1946,7 +1946,7 @@ xic_create_fontsetname (char *base_fontname, int motif)
Use the specified font plus the default. */ Use the specified font plus the default. */
int len = strlen (base_fontname) + strlen (xic_defaut_fontset) + 3; int len = strlen (base_fontname) + strlen (xic_defaut_fontset) + 3;
fontsetname = xmalloc (len); fontsetname = xmalloc (len);
bzero (fontsetname, len); memset (fontsetname, 0, len);
strcpy (fontsetname, base_fontname); strcpy (fontsetname, base_fontname);
strcat (fontsetname, sep); strcat (fontsetname, sep);
strcat (fontsetname, xic_defaut_fontset); strcat (fontsetname, xic_defaut_fontset);
@ -1983,7 +1983,7 @@ xic_create_fontsetname (char *base_fontname, int motif)
int diff = (p2 - p3) - 2; int diff = (p2 - p3) - 2;
base = alloca (strlen (base_fontname) + 1); base = alloca (strlen (base_fontname) + 1);
bcopy (base_fontname, base, p3 - base_fontname); memcpy (base, base_fontname, p3 - base_fontname);
base[p3 - base_fontname] = '*'; base[p3 - base_fontname] = '*';
base[(p3 - base_fontname) + 1] = '-'; base[(p3 - base_fontname) + 1] = '-';
strcpy (base + (p3 - base_fontname) + 2, p2); strcpy (base + (p3 - base_fontname) + 2, p2);
@ -1996,33 +1996,33 @@ xic_create_fontsetname (char *base_fontname, int motif)
/* Build the font spec that matches all charsets. */ /* Build the font spec that matches all charsets. */
len = p - base_fontname + strlen (allcs) + 1; len = p - base_fontname + strlen (allcs) + 1;
font_allcs = (char *) alloca (len); font_allcs = (char *) alloca (len);
bzero (font_allcs, len); memset (font_allcs, 0, len);
bcopy (base_fontname, font_allcs, p - base_fontname); memcpy (font_allcs, base_fontname, p - base_fontname);
strcat (font_allcs, allcs); strcat (font_allcs, allcs);
/* Build the font spec that matches all families and /* Build the font spec that matches all families and
add-styles. */ add-styles. */
len = p - p1 + strlen (allcs) + strlen (allfamilies) + 1; len = p - p1 + strlen (allcs) + strlen (allfamilies) + 1;
font_allfamilies = (char *) alloca (len); font_allfamilies = (char *) alloca (len);
bzero (font_allfamilies, len); memset (font_allfamilies, 0, len);
strcpy (font_allfamilies, allfamilies); strcpy (font_allfamilies, allfamilies);
bcopy (p1, font_allfamilies + strlen (allfamilies), p - p1); memcpy (font_allfamilies + strlen (allfamilies), p1, p - p1);
strcat (font_allfamilies, allcs); strcat (font_allfamilies, allcs);
/* Build the font spec that matches all. */ /* Build the font spec that matches all. */
len = p - p2 + strlen (allcs) + strlen (all) + strlen (allfamilies) + 1; len = p - p2 + strlen (allcs) + strlen (all) + strlen (allfamilies) + 1;
font_all = (char *) alloca (len); font_all = (char *) alloca (len);
bzero (font_all, len); memset (font_all, 0, len);
strcpy (font_all, allfamilies); strcpy (font_all, allfamilies);
strcat (font_all, all); strcat (font_all, all);
bcopy (p2, font_all + strlen (all) + strlen (allfamilies), p - p2); memcpy (font_all + strlen (all) + strlen (allfamilies), p2, p - p2);
strcat (font_all, allcs); strcat (font_all, allcs);
/* Build the actual font set name. */ /* Build the actual font set name. */
len = strlen (base_fontname) + strlen (font_allcs) len = strlen (base_fontname) + strlen (font_allcs)
+ strlen (font_allfamilies) + strlen (font_all) + 5; + strlen (font_allfamilies) + strlen (font_all) + 5;
fontsetname = xmalloc (len); fontsetname = xmalloc (len);
bzero (fontsetname, len); memset (fontsetname, 0, len);
strcpy (fontsetname, base_fontname); strcpy (fontsetname, base_fontname);
strcat (fontsetname, sep); strcat (fontsetname, sep);
strcat (fontsetname, font_allcs); strcat (fontsetname, font_allcs);
@ -3194,7 +3194,7 @@ This function is an internal primitive--use `make-frame' instead. */)
f->output_method = output_x_window; f->output_method = output_x_window;
f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output)); f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output));
bzero (f->output_data.x, sizeof (struct x_output)); memset (f->output_data.x, 0, sizeof (struct x_output));
f->output_data.x->icon_bitmap = -1; f->output_data.x->icon_bitmap = -1;
FRAME_FONTSET (f) = -1; FRAME_FONTSET (f) = -1;
f->output_data.x->scroll_bar_foreground_pixel = -1; f->output_data.x->scroll_bar_foreground_pixel = -1;
@ -4431,7 +4431,7 @@ no value of TYPE. */)
elements." elements."
This applies even if long is more than 32 bits, the X library This applies even if long is more than 32 bits, the X library
converts from 32 bit elements received from the X server to long converts from 32 bit elements received from the X server to long
and passes the long array to us. Thus, for that case bcopy can not and passes the long array to us. Thus, for that case memcpy can not
be used. We convert to a 32 bit type here, because so much code be used. We convert to a 32 bit type here, because so much code
assume on that. assume on that.
@ -4687,7 +4687,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object parms, Lisp_Obje
counts etc. */ counts etc. */
f->output_method = output_x_window; f->output_method = output_x_window;
f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output)); f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output));
bzero (f->output_data.x, sizeof (struct x_output)); memset (f->output_data.x, 0, sizeof (struct x_output));
f->output_data.x->icon_bitmap = -1; f->output_data.x->icon_bitmap = -1;
FRAME_FONTSET (f) = -1; FRAME_FONTSET (f) = -1;
f->output_data.x->scroll_bar_foreground_pixel = -1; f->output_data.x->scroll_bar_foreground_pixel = -1;
@ -5729,9 +5729,9 @@ present and mapped to the usual X keysyms. */)
/* The XKB symbolic key names can be seen most easily in /* The XKB symbolic key names can be seen most easily in
the PS file generated by `xkbprint -label name the PS file generated by `xkbprint -label name
$DISPLAY'. */ $DISPLAY'. */
if (bcmp ("DELE", kb->names->keys[i].name, 4) == 0) if (memcmp ("DELE", kb->names->keys[i].name, 4) == 0)
delete_keycode = i; delete_keycode = i;
else if (bcmp ("BKSP", kb->names->keys[i].name, 4) == 0) else if (memcmp ("BKSP", kb->names->keys[i].name, 4) == 0)
backspace_keycode = i; backspace_keycode = i;
} }

View file

@ -562,7 +562,7 @@ xfont_list (Lisp_Object frame, Lisp_Object spec)
val = assq_no_quit (QCname, AREF (spec, FONT_EXTRA_INDEX)); val = assq_no_quit (QCname, AREF (spec, FONT_EXTRA_INDEX));
if (CONSP (val) && STRINGP (XCDR (val)) && SBYTES (XCDR (val)) < 512) if (CONSP (val) && STRINGP (XCDR (val)) && SBYTES (XCDR (val)) < 512)
{ {
bcopy (SDATA (XCDR (val)), name, SBYTES (XCDR (val)) + 1); memcpy (name, SDATA (XCDR (val)), SBYTES (XCDR (val)) + 1);
if (xfont_encode_coding_xlfd (name) < 0) if (xfont_encode_coding_xlfd (name) < 0)
return Qnil; return Qnil;
list = xfont_list_pattern (display, name, registry, script); list = xfont_list_pattern (display, name, registry, script);
@ -590,7 +590,7 @@ xfont_match (Lisp_Object frame, Lisp_Object spec)
return Qnil; return Qnil;
} }
else if (SBYTES (XCDR (val)) < 512) else if (SBYTES (XCDR (val)) < 512)
bcopy (SDATA (XCDR (val)), name, SBYTES (XCDR (val)) + 1); memcpy (name, SDATA (XCDR (val)), SBYTES (XCDR (val)) + 1);
else else
return Qnil; return Qnil;
if (xfont_encode_coding_xlfd (name) < 0) if (xfont_encode_coding_xlfd (name) < 0)
@ -669,7 +669,7 @@ xfont_list_family (Lisp_Object frame)
if (! *p1 || p1 == p0) if (! *p1 || p1 == p0)
continue; continue;
if (last_len == p1 - p0 if (last_len == p1 - p0
&& bcmp (last_family, p0, last_len) == 0) && memcmp (last_family, p0, last_len) == 0)
continue; continue;
last_len = p1 - p0; last_len = p1 - p0;
last_family = p0; last_family = p0;
@ -980,7 +980,7 @@ xfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct f
int i, first, x; int i, first, x;
if (metrics) if (metrics)
bzero (metrics, sizeof (struct font_metrics)); memset (metrics, 0, sizeof (struct font_metrics));
for (i = 0, x = 0, first = 1; i < nglyphs; i++) for (i = 0, x = 0, first = 1; i < nglyphs; i++)
{ {
XChar2b char2b; XChar2b char2b;

View file

@ -1067,8 +1067,8 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
/* Save the frame's previous menu bar contents data. */ /* Save the frame's previous menu bar contents data. */
if (previous_menu_items_used) if (previous_menu_items_used)
bcopy (XVECTOR (f->menu_bar_vector)->contents, previous_items, memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents,
previous_menu_items_used * sizeof (Lisp_Object)); previous_menu_items_used * sizeof (Lisp_Object));
/* Fill in menu_items with the current menu bar contents. /* Fill in menu_items with the current menu bar contents.
This can evaluate Lisp code. */ This can evaluate Lisp code. */
@ -2452,12 +2452,10 @@ xmenu_show (f, x, y, for_click, keymaps, title, error, timestamp)
item_data item_data
= (unsigned char *) alloca (maxwidth = (unsigned char *) alloca (maxwidth
+ SBYTES (descrip) + 1); + SBYTES (descrip) + 1);
bcopy (SDATA (item_name), item_data, memcpy (item_data, SDATA (item_name), SBYTES (item_name));
SBYTES (item_name));
for (j = SCHARS (item_name); j < maxwidth; j++) for (j = SCHARS (item_name); j < maxwidth; j++)
item_data[j] = ' '; item_data[j] = ' ';
bcopy (SDATA (descrip), item_data + j, memcpy (item_data + j, SDATA (descrip), SBYTES (descrip));
SBYTES (descrip));
item_data[j + SBYTES (descrip)] = 0; item_data[j + SBYTES (descrip)] = 0;
} }
else else

View file

@ -233,7 +233,7 @@ magic_file_p (char *string, int string_len, char *class, char *escaped_suffix, c
path = (char *) realloc (path, path_size); path = (char *) realloc (path, path_size);
} }
bcopy (next, path + path_len, next_len); memcpy (path + path_len, next, next_len);
path_len += next_len; path_len += next_len;
p++; p++;
@ -259,7 +259,7 @@ magic_file_p (char *string, int string_len, char *class, char *escaped_suffix, c
path = (char *) realloc (path, path_size); path = (char *) realloc (path, path_size);
} }
bcopy (suffix, path + path_len, suffix_len); memcpy (path + path_len, suffix, suffix_len);
path_len += suffix_len; path_len += suffix_len;
} }
@ -644,7 +644,7 @@ x_get_resource (XrmDatabase rdb, char *name, char *class, XrmRepresentation expe
if (type == x_rm_string) if (type == x_rm_string)
ret_value->addr = (char *) value.addr; ret_value->addr = (char *) value.addr;
else else
bcopy (value.addr, ret_value->addr, ret_value->size); memcpy (ret_value->addr, value.addr, ret_value->size);
return value.size; return value.size;
} }

View file

@ -191,7 +191,7 @@ x_queue_event (struct input_event *event)
This only happens for large requests which uses the incremental protocol. */ This only happens for large requests which uses the incremental protocol. */
for (queue_tmp = selection_queue; queue_tmp; queue_tmp = queue_tmp->next) for (queue_tmp = selection_queue; queue_tmp; queue_tmp = queue_tmp->next)
{ {
if (!bcmp (&queue_tmp->event, event, sizeof (*event))) if (!memcmp (&queue_tmp->event, event, sizeof (*event)))
{ {
TRACE1 ("DECLINE DUP SELECTION EVENT %08lx", (unsigned long)queue_tmp); TRACE1 ("DECLINE DUP SELECTION EVENT %08lx", (unsigned long)queue_tmp);
x_decline_selection_request (event); x_decline_selection_request (event);
@ -1534,7 +1534,7 @@ x_get_window_property (display, window, property, data_ret, bytes_ret,
elements." elements."
This applies even if long is more than 32 bits, the X library This applies even if long is more than 32 bits, the X library
converts from 32 bit elements received from the X server to long converts from 32 bit elements received from the X server to long
and passes the long array to us. Thus, for that case bcopy can not and passes the long array to us. Thus, for that case memcpy can not
be used. We convert to a 32 bit type here, because so much code be used. We convert to a 32 bit type here, because so much code
assume on that. assume on that.
@ -1556,7 +1556,7 @@ x_get_window_property (display, window, property, data_ret, bytes_ret,
else else
{ {
*actual_size_ret *= *actual_format_ret / 8; *actual_size_ret *= *actual_format_ret / 8;
bcopy (tmp_data, (*data_ret) + offset, *actual_size_ret); memcpy ((*data_ret) + offset, tmp_data, *actual_size_ret);
offset += *actual_size_ret; offset += *actual_size_ret;
} }
@ -1658,7 +1658,7 @@ receive_incremental_selection (display, window, property, target_type,
*data_ret = (unsigned char *) xrealloc (*data_ret, *size_bytes_ret); *data_ret = (unsigned char *) xrealloc (*data_ret, *size_bytes_ret);
} }
bcopy (tmp_data, (*data_ret) + offset, tmp_size_bytes); memcpy ((*data_ret) + offset, tmp_data, tmp_size_bytes);
offset += tmp_size_bytes; offset += tmp_size_bytes;
/* Use xfree, not XFree, because x_get_window_property /* Use xfree, not XFree, because x_get_window_property

View file

@ -154,7 +154,7 @@ x_session_check_input (struct input_event *bufp)
/* Check if smc_interact_CB was called and we shall generate a /* Check if smc_interact_CB was called and we shall generate a
SAVE_SESSION_EVENT. */ SAVE_SESSION_EVENT. */
if (emacs_event.kind != NO_EVENT) if (emacs_event.kind != NO_EVENT)
bcopy (&emacs_event, bufp, sizeof (struct input_event)); memcpy (bufp, &emacs_event, sizeof (struct input_event));
return emacs_event.kind != NO_EVENT ? 1 : 0; return emacs_event.kind != NO_EVENT ? 1 : 0;
} }

View file

@ -4131,7 +4131,7 @@ x_send_scroll_bar_event (Lisp_Object window, int part, int portion, int whole)
scroll_bar_windows = (struct window **) xrealloc (scroll_bar_windows, scroll_bar_windows = (struct window **) xrealloc (scroll_bar_windows,
nbytes); nbytes);
bzero (&scroll_bar_windows[i], nbytes - old_nbytes); memset (&scroll_bar_windows[i], 0, nbytes - old_nbytes);
scroll_bar_windows_size = new_size; scroll_bar_windows_size = new_size;
} }
@ -5608,7 +5608,7 @@ static struct x_display_info *next_noop_dpyinfo;
if (f->output_data.x->saved_menu_event == 0) \ if (f->output_data.x->saved_menu_event == 0) \
f->output_data.x->saved_menu_event \ f->output_data.x->saved_menu_event \
= (XEvent *) xmalloc (sizeof (XEvent)); \ = (XEvent *) xmalloc (sizeof (XEvent)); \
bcopy (&event, f->output_data.x->saved_menu_event, size); \ memcpy (f->output_data.x->saved_menu_event, &event, size); \
inev.ie.kind = MENU_BAR_ACTIVATE_EVENT; \ inev.ie.kind = MENU_BAR_ACTIVATE_EVENT; \
XSETFRAME (inev.ie.frame_or_window, f); \ XSETFRAME (inev.ie.frame_or_window, f); \
} \ } \
@ -6245,7 +6245,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
this enables ComposeCharacter to work whether or this enables ComposeCharacter to work whether or
not it is combined with Meta. */ not it is combined with Meta. */
if (modifiers & dpyinfo->meta_mod_mask) if (modifiers & dpyinfo->meta_mod_mask)
bzero (&compose_status, sizeof (compose_status)); memset (&compose_status, 0, sizeof (compose_status));
#ifdef HAVE_X_I18N #ifdef HAVE_X_I18N
if (FRAME_XIC (f)) if (FRAME_XIC (f))
@ -6293,7 +6293,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
if (compose_status.chars_matched > 0 && nbytes == 0) if (compose_status.chars_matched > 0 && nbytes == 0)
break; break;
bzero (&compose_status, sizeof (compose_status)); memset (&compose_status, 0, sizeof (compose_status));
orig_keysym = keysym; orig_keysym = keysym;
/* Common for all keysym input events. */ /* Common for all keysym input events. */
@ -6707,7 +6707,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
by the rest of Emacs, we put it here. */ by the rest of Emacs, we put it here. */
int tool_bar_p = 0; int tool_bar_p = 0;
bzero (&compose_status, sizeof (compose_status)); memset (&compose_status, 0, sizeof (compose_status));
last_mouse_glyph_frame = 0; last_mouse_glyph_frame = 0;
last_user_time = event.xbutton.time; last_user_time = event.xbutton.time;
@ -7553,7 +7553,7 @@ x_check_errors (Display *dpy, char *format)
if (x_error_message->string[0]) if (x_error_message->string[0])
{ {
char string[X_ERROR_MESSAGE_SIZE]; char string[X_ERROR_MESSAGE_SIZE];
bcopy (x_error_message->string, string, X_ERROR_MESSAGE_SIZE); memcpy (string, x_error_message->string, X_ERROR_MESSAGE_SIZE);
x_uncatch_errors (); x_uncatch_errors ();
error (format, string); error (format, string);
} }
@ -8077,7 +8077,7 @@ xim_initialize (struct x_display_info *dpyinfo, char *resource_name)
xim_inst->dpyinfo = dpyinfo; xim_inst->dpyinfo = dpyinfo;
len = strlen (resource_name); len = strlen (resource_name);
xim_inst->resource_name = (char *) xmalloc (len + 1); xim_inst->resource_name = (char *) xmalloc (len + 1);
bcopy (resource_name, xim_inst->resource_name, len + 1); memcpy (xim_inst->resource_name, resource_name, len + 1);
XRegisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, XRegisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb,
resource_name, EMACS_CLASS, resource_name, EMACS_CLASS,
xim_instantiate_callback, xim_instantiate_callback,
@ -9929,7 +9929,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
/* We have definitely succeeded. Record the new connection. */ /* We have definitely succeeded. Record the new connection. */
dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info)); dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info));
bzero (dpyinfo, sizeof *dpyinfo); memset (dpyinfo, 0, sizeof *dpyinfo);
terminal = x_create_terminal (dpyinfo); terminal = x_create_terminal (dpyinfo);