+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>
* configure.in (getenv): Remove K&R declaration.
AIX
AMPERSAND_FULL_NAME
-BCOPY_DOWNWARD_SAFE
-BCOPY_UPWARD_SAFE
BITS_PER_EMACS_INT
BITS_PER_LONG
BITS_PER_CHAR
FILE_SYSTEM_CASE
FLOAT_CHECK_DOMAIN
FSCALE
-GAP_USE_BCOPY
GC_LISP_OBJECT_ALIGNMENT
GC_MARK_SECONDARY_STACK
GC_MARK_STACK
GNU_LINUX
GNU_MALLOC
HAVE_AIX_SMT_EXP
-HAVE_BCMP
-HAVE_BCOPY
HAVE_CBRT
HAVE_CLOSEDIR
HAVE_DUP2
abort
access
alloca
-bcmp
-bcopy
brk
-bzero
calloc
chdir
chmod
+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>
* unidata/bidimirror.awk: New file.
for ac_func in gethostname getdomainname dup2 \
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 \
utimes getrlimit setrlimit setpgid getcwd getwd shutdown getaddrinfo \
__fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \
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 \
cfmakeraw cfsetspeed isnan copysign
do :
AC_CHECK_FUNCS(gethostname getdomainname dup2 \
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 \
utimes getrlimit setrlimit setpgid getcwd getwd shutdown getaddrinfo \
__fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \
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 \
cfmakeraw cfsetspeed isnan copysign)
#include <string.h>
#endif
-#ifdef HAVE_STRINGS_H
-#include <strings.h> /* May be needed for bcopy & al. */
-#endif
-
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#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 */
/*
+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>
* movemail.c: Add MAIL_USE_POP around prototypes.
}
sym = (struct sym *) xmalloc (sizeof *sym + strlen (name));
- bzero (sym, sizeof *sym);
+ memset (sym, 0, sizeof *sym);
strcpy (sym->name, name);
sym->namesp = scope;
sym->next = class_table[h];
make_namespace (char *name, struct sym *context)
{
struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name));
- bzero (s, sizeof *s);
+ memset (s, 0, sizeof *s);
strcpy (s->name, name);
s->next = all_namespaces;
s->namesp = context;
}
ptr[cp++] = '>';
}
- bcopy (fromserver, &ptr[cp], ret);
+ memcpy (&ptr[cp], fromserver, ret);
cp += ret;
ptr[cp++] = '\n';
}
}
#endif
- bzero ((char *) &addr, sizeof (addr));
+ memset (&addr, 0, sizeof (addr));
addr.sin_family = AF_INET;
/** "kpop" service is never used: look for 20060515 to see why **/
if (it->ai_addrlen == sizeof (addr))
{
struct sockaddr_in *in_a = (struct sockaddr_in *) it->ai_addr;
- bcopy (&in_a->sin_addr, (char *) &addr.sin_addr,
- sizeof (addr.sin_addr));
+ memcpy (&addr.sin_addr, &in_a->sin_addr, sizeof (addr.sin_addr));
if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr)))
break;
}
while (*hostent->h_addr_list)
{
- bcopy (*hostent->h_addr_list, (char *) &addr.sin_addr,
- hostent->h_length);
+ memcpy (&addr.sin_addr, *hostent->h_addr_list, hostent->h_length);
if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr)))
break;
hostent->h_addr_list++;
}
else
{
- bcopy (server->buffer + server->buffer_index,
- server->buffer, server->data);
+ memmove (server->buffer, server->buffer + server->buffer_index,
+ server->data);
/* Record the fact that we've searched the data already in
the buffer for a CRLF, so that when we search below, we
don't have to search the same data twice. There's a "-
+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>
* xlwmenu.c (XlwMenuSetValues, XlwMenuInitialize): Correct prototype.
int nkids = cw->composite.num_children;
Widget *kids = (Widget *) malloc (sizeof (Widget) * nkids);
int i;
- lwlib_bcopy ((char *) cw->composite.children, (char *) kids,
- sizeof (Widget) * nkids);
+ memcpy ((char *) kids, (char *) cw->composite.children,
+ sizeof (Widget) * nkids);
for (i = 0; i < nkids; i++)
/* This prevent us from using gadgets, why is it here? */
/* if (XtIsWidget (kids [i])) */
static void lw_pop_all_widgets (LWLIB_ID, Boolean);
static Boolean get_one_value (widget_instance *, widget_value *);
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];
-}
\f/* utility functions for widget_instance and widget_info */
char *
safe_strdup (const char *s)
wv = (widget_value *) malloc (sizeof (widget_value));
malloc_cpt++;
}
- lwlib_memset ((void*) wv, 0, sizeof (widget_value));
+ memset ((void*) wv, 0, sizeof (widget_value));
return wv;
}
safe_free_str (info->type);
safe_free_str (info->name);
free_widget_value_tree (info->val);
- lwlib_memset ((void*)info, 0xDEADBEEF, sizeof (widget_info));
+ memset ((void*)info, 0xDEADBEEF, sizeof (widget_info));
free (info);
}
{
widget_instance* instance =
(widget_instance*)malloc (sizeof (widget_instance));
- bzero (instance, sizeof *instance);
+ memset (instance, 0, sizeof *instance);
instance->parent = parent;
instance->pop_up_p = pop_up_p;
instance->info = info;
static void
free_widget_instance (widget_instance *instance)
{
- lwlib_memset ((void*)instance, 0xDEADBEEF, sizeof (widget_instance));
+ memset ((void*)instance, 0xDEADBEEF, sizeof (widget_instance));
free (instance);
}
int separator_p = 0;
if (strlen (label) >= 3
- && bcmp (label, "--:", 3) == 0)
+ && memcmp (label, "--:", 3) == 0)
{
static struct separator_table
{
}
}
else if (strlen (label) > 3
- && bcmp (label, "--", 2) == 0
+ && memcmp (label, "--", 2) == 0
&& label[2] != '-')
{
/* Alternative, more Emacs-style names. */
int lw_separator_p (char *label, enum menu_separator *type,
int motif_p);
-void lwlib_bcopy (char*, char*, int);
-
#endif /* LWLIB_H */
/* arch-tag: 44d818d5-7eb2-4d87-acd7-b992bb0d5d20
/* _XtCreate is freeing the object that was passed to us,
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;
#endif
+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>
* sed1v2.inp (LIB_GCC): Edit to empty.
/^#undef HAVE_CBRT *$/s/^.*$/#define HAVE_CBRT 1/
/^#undef HAVE_DIFFTIME *$/s/^.*$/#define HAVE_DIFFTIME 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_MEMMOVE *$/s/^.*$/#define HAVE_MEMMOVE 1/
/^#undef HAVE_SETRLIMIT *$/s/^.*$/#define HAVE_SETRLIMIT 1/
#else\
#undef HAVE_STDINT_H\
#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
# might be defined in sys/config.h we include at the top of config.h.
+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>
* config.nt (__P): Remove.
#undef HAVE_SYSINFO
#undef HAVE_RANDOM
#undef HAVE_LRAND48
-#undef HAVE_BCOPY
-#undef HAVE_BCMP
+#undef HAVE_MEMCPY
+#undef HAVE_MEMMOVE
+#undef HAVE_MEMSET
+#undef HAVE_MEMCMP
#undef HAVE_LOGB
#undef HAVE_FREXP
#undef HAVE_FMOD
+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>
* process.c (kbd_is_on_hold): New variable.
val = (unsigned char *) malloc (size + overhead);
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;
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;
return (POINTER_TYPE *)val;
if (val
&& check_depth == 1
- && bcmp (xmalloc_overrun_check_header,
- val - XMALLOC_OVERRUN_CHECK_SIZE,
- XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0)
+ && memcmp (xmalloc_overrun_check_header,
+ val - XMALLOC_OVERRUN_CHECK_SIZE,
+ XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0)
{
size_t osize = XMALLOC_GET_SIZE (val);
- if (bcmp (xmalloc_overrun_check_trailer,
- val + osize,
- XMALLOC_OVERRUN_CHECK_SIZE))
+ if (memcmp (xmalloc_overrun_check_trailer, val + osize,
+ XMALLOC_OVERRUN_CHECK_SIZE))
abort ();
- bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE);
+ memset (val + osize, 0, 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);
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;
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;
return (POINTER_TYPE *)val;
++check_depth;
if (val
&& check_depth == 1
- && bcmp (xmalloc_overrun_check_header,
- val - XMALLOC_OVERRUN_CHECK_SIZE,
- XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0)
+ && memcmp (xmalloc_overrun_check_header,
+ val - XMALLOC_OVERRUN_CHECK_SIZE,
+ XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0)
{
size_t osize = XMALLOC_GET_SIZE (val);
- if (bcmp (xmalloc_overrun_check_trailer,
- val + osize,
- XMALLOC_OVERRUN_CHECK_SIZE))
+ if (memcmp (xmalloc_overrun_check_trailer, val + osize,
+ XMALLOC_OVERRUN_CHECK_SIZE))
abort ();
#ifdef XMALLOC_CLEAR_FREE_MEMORY
val -= XMALLOC_OVERRUN_CHECK_SIZE;
memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_SIZE*2);
#else
- bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE);
+ memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE);
val -= XMALLOC_OVERRUN_CHECK_SIZE;
- bzero (val, XMALLOC_OVERRUN_CHECK_SIZE);
+ memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE);
#endif
}
{
size_t len = strlen (s) + 1;
char *p = (char *) xmalloc (len);
- bcopy (s, p, len);
+ memcpy (p, s, len);
return p;
}
int i;
b = (struct string_block *) lisp_malloc (sizeof *b, MEM_TYPE_STRING);
- bzero (b, sizeof *b);
+ memset (b, 0, sizeof *b);
b->next = string_blocks;
string_blocks = b;
++n_string_blocks;
MALLOC_UNBLOCK_INPUT;
/* Probably not strictly necessary, but play it safe. */
- bzero (s, sizeof *s);
+ memset (s, 0, sizeof *s);
--total_free_strings;
++total_strings;
s->size_byte = nbytes;
s->data[nbytes] = '\0';
#ifdef GC_CHECK_STRING_OVERRUN
- bcopy (string_overrun_cookie, (char *) data + needed,
- GC_STRING_OVERRUN_COOKIE_SIZE);
+ memcpy (data + needed, string_overrun_cookie, GC_STRING_OVERRUN_COOKIE_SIZE);
#endif
/* If S had already data assigned, mark that as free by setting its
from_end = (struct sdata *) ((char *) from + nbytes + GC_STRING_EXTRA);
#ifdef GC_CHECK_STRING_OVERRUN
- if (bcmp (string_overrun_cookie,
- ((char *) from_end) - GC_STRING_OVERRUN_COOKIE_SIZE,
- GC_STRING_OVERRUN_COOKIE_SIZE))
+ if (memcmp (string_overrun_cookie,
+ (char *) from_end - GC_STRING_OVERRUN_COOKIE_SIZE,
+ GC_STRING_OVERRUN_COOKIE_SIZE))
abort ();
#endif
if (from != to)
{
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);
}
end = p + nbytes;
while (p != end)
{
- bcopy (str, p, len);
+ memcpy (p, str, len);
p += len;
}
}
{
register Lisp_Object val;
val = make_uninit_string (length);
- bcopy (contents, SDATA (val), length);
+ memcpy (SDATA (val), contents, length);
STRING_SET_UNIBYTE (val);
return val;
}
{
register Lisp_Object val;
val = make_uninit_multibyte_string (nchars, nbytes);
- bcopy (contents, SDATA (val), nbytes);
+ memcpy (SDATA (val), contents, nbytes);
return val;
}
{
register Lisp_Object val;
val = make_uninit_multibyte_string (nchars, nbytes);
- bcopy (contents, SDATA (val), nbytes);
+ memcpy (SDATA (val), contents, nbytes);
if (SBYTES (val) == SCHARS (val))
STRING_SET_UNIBYTE (val);
return val;
nchars = nbytes;
}
val = make_uninit_multibyte_string (nchars, nbytes);
- bcopy (contents, SDATA (val), nbytes);
+ memcpy (SDATA (val), contents, nbytes);
if (!multibyte)
STRING_SET_UNIBYTE (val);
return val;
new = (struct float_block *) lisp_align_malloc (sizeof *new,
MEM_TYPE_FLOAT);
new->next = float_block;
- bzero ((char *) new->gcmarkbits, sizeof new->gcmarkbits);
+ memset (new->gcmarkbits, 0, sizeof new->gcmarkbits);
float_block = new;
float_block_index = 0;
n_float_blocks++;
register struct cons_block *new;
new = (struct cons_block *) lisp_align_malloc (sizeof *new,
MEM_TYPE_CONS);
- bzero ((char *) new->gcmarkbits, sizeof new->gcmarkbits);
+ memset (new->gcmarkbits, 0, sizeof new->gcmarkbits);
new->next = cons_block;
cons_block = new;
cons_block_index = 0;
struct terminal *t = ALLOCATE_PSEUDOVECTOR (struct terminal,
next_terminal, PVEC_TERMINAL);
/* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */
- bzero (&(t->next_terminal),
- ((char*)(t+1)) - ((char*)&(t->next_terminal)));
+ memset (&t->next_terminal, 0,
+ (char*) (t + 1) - (char*) &t->next_terminal);
return t;
}
struct frame *f = ALLOCATE_PSEUDOVECTOR (struct frame,
face_cache, PVEC_FRAME);
/* Zero out the non-GC'd fields. FIXME: This should be made unnecessary. */
- bzero (&(f->face_cache),
- ((char*)(f+1)) - ((char*)&(f->face_cache)));
+ memset (&f->face_cache, 0,
+ (char *) (f + 1) - (char *) &f->face_cache);
return f;
}
if (s->data == NULL)
{
s->data = (unsigned char *) pure_alloc (nbytes + 1, -1);
- bcopy (data, s->data, nbytes);
+ memcpy (s->data, data, nbytes);
s->data[nbytes] = '\0';
}
s->size = nchars;
if (stack_copy)
{
if ((EMACS_INT) (&stack_top_variable - stack_bottom) > 0)
- bcopy (stack_bottom, stack_copy, i);
+ memcpy (stack_copy, stack_bottom, i);
else
- bcopy (&stack_top_variable, stack_copy, i);
+ memcpy (stack_copy, &stack_top_variable, i);
}
}
}
t = (struct atimer *) xmalloc (sizeof *t);
/* Fill the atimer structure. */
- bzero (t, sizeof *t);
+ memset (t, 0, sizeof *t);
t->type = type;
t->fn = fn;
t->client_data = client_data;
EMACS_SET_USECS (time, 1000);
}
- bzero (&it, sizeof it);
+ memset (&it, 0, sizeof it);
it.it_value = time;
setitimer (ITIMER_REAL, &it, 0);
#else /* not HAVE_SETITIMER */
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_after = copy_overlays (to, from->overlays_after);
Lisp_Object *copy = (Lisp_Object *) alloca (size * sizeof (Lisp_Object));
int i;
- bcopy (XVECTOR (last_overlay_modification_hooks)->contents,
- copy, size * sizeof (Lisp_Object));
+ memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents,
+ size * sizeof (Lisp_Object));
gcpro1.var = copy;
gcpro1.nvars = size;
}
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));
result = *var;
r = MMAP_REGION (result);
{
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
are initialized reasonably, so mark_buffer won't choke. */
if (sizeof (EMACS_INT) != sizeof (Lisp_Object)) abort ();
/* 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.directory, -1);
XSETINT (buffer_local_flags.backed_up, -1);
/* Make a copy of string so that if a GC relocates specs,
`string' will still be valid. */
string = (unsigned char *) alloca (SBYTES (specs) + 1);
- bcopy (SDATA (specs), string,
- SBYTES (specs) + 1);
+ memcpy (string, SDATA (specs), SBYTES (specs) + 1);
}
else
{
PT_BYTE + process_coding.produced);
carryover = process_coding.carryover_bytes;
if (carryover > 0)
- /* As CARRYOVER should not be that large, we had
- better avoid overhead of bcopy. */
- BCOPY_SHORT (process_coding.carryover, buf,
- process_coding.carryover_bytes);
+ memcpy (buf, process_coding.carryover,
+ process_coding.carryover_bytes);
}
}
pattern = Fexpand_file_name (Vtemp_file_name_pattern, tmpdir);
tempfile = (char *) alloca (SBYTES (pattern) + 1);
- bcopy (SDATA (pattern), tempfile, SBYTES (pattern) + 1);
+ memcpy (tempfile, SDATA (pattern), SBYTES (pattern) + 1);
coding_systems = Qt;
#ifdef HAVE_MKSTEMP
pwd_var = (char *) alloca (i + 6);
#endif
temp = pwd_var + 4;
- bcopy ("PWD=", pwd_var, 4);
- bcopy (SDATA (current_dir), temp, i);
+ memcpy (pwd_var, "PWD=", 4);
+ memcpy (temp, SDATA (current_dir), i);
if (!IS_DIRECTORY_SEP (temp[i - 1])) temp[i++] = DIRECTORY_SEP;
temp[i] = 0;
/* NT environment variables are case insensitive. */
&& ! strnicmp (SDATA (entry), var, varlen)
#else /* not WINDOWSNT */
- && ! bcmp (SDATA (entry), var, varlen)
+ && ! memcmp (SDATA (entry), var, varlen)
#endif /* not WINDOWSNT */
)
{
unsigned char *old_dst = dst;
o_size += o_size; /* Probably overkill, but extremely rare. */
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);
}
c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i_byte, len);
msglen = strlen (msg);
if (dst + msglen <= (dst_bytes ? dst_end : src))
{
- bcopy (msg, dst, msglen);
+ memcpy (dst, msg, msglen);
dst += msglen;
}
msglen = strlen (msg);
if (dst + msglen > (dst_bytes ? dst_end : src))
break;
- bcopy (msg, dst, msglen);
+ memcpy (dst, msg, msglen);
dst += msglen;
}
goto ccl_finish;
int i = src_end - src;
if (dst_bytes && (dst_end - dst) < i)
i = dst_end - dst;
- bcopy (src, dst, i);
+ memcpy (dst, src, i);
src += i;
dst += i;
#else
to = p;
nbytes = endp - p;
endp = str + len;
- safe_bcopy ((char *) p, (char *) (endp - nbytes), nbytes);
+ memmove (endp - nbytes, p, nbytes);
p = endp - nbytes;
if (nbytes >= MAX_MULTIBYTE_LENGTH)
to = p;
bytes = endp - p;
endp = str + len;
- safe_bcopy ((char *) p, (char *) (endp - bytes), bytes);
+ memmove (endp - bytes, p, bytes);
p = endp - bytes;
while (p < endp)
{
extern Lisp_Object Vchar_script_table;
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) \
do { (sym) = intern_c_string ((name)); staticpro (&(sym)); } while (0)
SAFE_ALLOCA (head, struct charset_map_entries *,
sizeof (struct charset_map_entries));
entries = head;
- bzero (entries, sizeof (struct charset_map_entries));
+ memset (entries, 0, sizeof (struct charset_map_entries));
n_entries = 0;
eof = 0;
SAFE_ALLOCA (entries->next, struct charset_map_entries *,
sizeof (struct charset_map_entries));
entries = entries->next;
- bzero (entries, sizeof (struct charset_map_entries));
+ memset (entries, 0, sizeof (struct charset_map_entries));
}
idx = n_entries % 0x10000;
entries->entry[idx].from = from;
SAFE_ALLOCA (head, struct charset_map_entries *,
sizeof (struct charset_map_entries));
entries = head;
- bzero (entries, sizeof (struct charset_map_entries));
+ memset (entries, 0, sizeof (struct charset_map_entries));
n_entries = 0;
for (i = 0; i < len; i += 2)
SAFE_ALLOCA (entries->next, struct charset_map_entries *,
sizeof (struct charset_map_entries));
entries = entries->next;
- bzero (entries, sizeof (struct charset_map_entries));
+ memset (entries, 0, sizeof (struct charset_map_entries));
}
idx = n_entries % 0x10000;
entries->entry[idx].from = from;
if (! charset.code_linear_p)
{
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 (j = charset.code_space[i * 4]; j <= charset.code_space[i * 4 + 1];
j++)
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]))
{
struct charset *new_table
= (struct charset *) xmalloc (sizeof (struct charset)
* (charset_table_size + 16));
- bcopy (charset_table, new_table,
- sizeof (struct charset) * charset_table_size);
+ memcpy (new_table, charset_table,
+ sizeof (struct charset) * charset_table_size);
charset_table_size += 16;
charset_table = new_table;
}
void
Wcm_clear (struct tty_display_info *tty)
{
- bzero (tty->Wcm, sizeof (struct cm));
+ memset (tty->Wcm, 0, sizeof (struct cm));
UP = 0;
BC = 0;
}
for (p = pend - 2; p >= pbeg; p--)
if (*p == '\r')
{
- safe_bcopy ((char *) (p + 1), (char *) p, pend-- - p - 1);
+ memmove (p, p + 1, pend-- - p - 1);
n++;
}
}
}
if (BEGV < GPT && GPT < BEGV + coding->produced_char)
move_gap_both (BEGV, BEGV_BYTE);
- bcopy (BEGV_ADDR, destination, coding->produced);
+ memcpy (destination, BEGV_ADDR, coding->produced);
coding->destination = destination;
}
}
int changed[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++)
{
priorities[i] = coding_priorities[j];
}
- bcopy (priorities, coding_priorities, sizeof priorities);
+ memcpy (coding_priorities, priorities, sizeof priorities);
/* Update `coding-category-list'. */
Vcoding_category_list = Qnil;
char *buf = (char *) alloca (base_name_len + 6);
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);
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));
}
return subsidiaries;
/* Define to 1 if ALSA is available. */
#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. */
#undef HAVE_CBRT
#include <string.h>
#endif
-#ifdef HAVE_STRINGS_H
-#include <strings.h> /* May be needed for bcopy & al. */
-#endif
-
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#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 */
/*
USE_SAFE_ALLOCA;
SAFE_ALLOCA (str, unsigned char *, nbytes);
- bcopy (SDATA (array), str, nbytes);
+ memcpy (str, SDATA (array), nbytes);
allocate_string_data (XSTRING (array), nchars,
nbytes + new_bytes - prev_bytes);
- bcopy (str, SDATA (array), idxval_byte);
+ memcpy (SDATA (array), str, idxval_byte);
p1 = SDATA (array) + idxval_byte;
- bcopy (str + idxval_byte + prev_bytes, p1 + new_bytes,
- nbytes - (idxval_byte + prev_bytes));
+ memcpy (p1 + new_bytes, str + idxval_byte + prev_bytes,
+ nbytes - (idxval_byte + prev_bytes));
SAFE_FREE ();
clear_string_char_byte_cache ();
}
int nchars;
fullname = make_uninit_multibyte_string (nbytes, nbytes);
- bcopy (SDATA (directory), SDATA (fullname),
- directory_nbytes);
+ memcpy (SDATA (fullname), SDATA (directory),
+ directory_nbytes);
if (needsep)
SSET (fullname, directory_nbytes, DIRECTORY_SEP);
- bcopy (SDATA (name),
- SDATA (fullname) + directory_nbytes + needsep,
- len);
+ memcpy (SDATA (fullname) + directory_nbytes + needsep,
+ SDATA (name), len);
nchars = chars_in_text (SDATA (fullname), nbytes);
_djstat_flags = _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE;
#endif /* MSDOS */
- bcopy (SDATA (dirname), fullname, pos);
+ memcpy (fullname, SDATA (dirname), pos);
if (!IS_DIRECTORY_SEP (fullname[pos - 1]))
fullname[pos++] = DIRECTORY_SEP;
- bcopy (dp->d_name, fullname + pos, len);
+ memcpy (fullname + pos, dp->d_name, len);
fullname[pos + len] = 0;
#ifdef S_IFLNK
#endif /* GLYPH_DEBUG == 0 */
-/* Like bcopy except never gets confused by overlap. Let this be the
- first function defined in this file, or change emacs.c where the
- address of this function is used. */
+#ifdef PROFILING
+/* FIXME: only used to find text start for profiling. */
void
safe_bcopy (const char *from, char *to, int size)
{
- if (size <= 0 || from == to)
- 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);
- }
- }
+ abort ();
}
-
-
+#endif
\f
/***********************************************************************
Glyph Matrices
/* Allocate and clear. */
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
to detect memory leaks. */
int size = dim.height * sizeof (struct glyph_row);
new_rows = dim.height - matrix->rows_allocated;
matrix->rows = (struct glyph_row *) xrealloc (matrix->rows, size);
- bzero (matrix->rows + matrix->rows_allocated,
- new_rows * sizeof *matrix->rows);
+ memset (matrix->rows + matrix->rows_allocated, 0,
+ new_rows * sizeof *matrix->rows);
matrix->rows_allocated = dim.height;
}
else
returned by xmalloc. If flickering happens again, activate
the code below. If the flickering is gone with that, chances
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
}
struct glyph *pointers[1 + LAST_AREA];
/* Save glyph pointers of TO. */
- bcopy (to->glyphs, pointers, sizeof to->glyphs);
+ memcpy (pointers, to->glyphs, sizeof to->glyphs);
/* Do a structure assignment. */
*to = *from;
/* Restore original pointers of TO. */
- bcopy (pointers, to->glyphs, sizeof to->glyphs);
+ memcpy (to->glyphs, pointers, sizeof to->glyphs);
}
/* Copy glyphs from FROM to TO. */
for (area = 0; area < LAST_AREA; ++area)
if (from->used[area])
- bcopy (from->glyphs[area], to->glyphs[area],
- from->used[area] * sizeof (struct glyph));
+ memcpy (to->glyphs[area], from->glyphs[area],
+ from->used[area] * sizeof (struct glyph));
/* Increment buffer positions in TO by DELTA. */
increment_row_positions (to, delta, delta_bytes);
/* Allocate a new glyph_pool and clear it. */
result = (struct glyph_pool *) xmalloc (sizeof *result);
- bzero (result, sizeof *result);
+ memset (result, 0, sizeof *result);
/* For memory leak and double deletion checking. */
++glyph_pool_count;
else
{
pool->glyphs = (struct glyph *) xmalloc (size);
- bzero (pool->glyphs, size);
+ memset (pool->glyphs, 0, size);
}
pool->nglyphs = needed;
struct glyph_matrix *saved;
saved = (struct glyph_matrix *) xmalloc (sizeof *saved);
- bzero (saved, sizeof *saved);
+ memset (saved, 0, sizeof *saved);
saved->nrows = f->current_matrix->nrows;
saved->rows = (struct glyph_row *) xmalloc (saved->nrows
* 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)
{
struct glyph_row *to = saved->rows + i;
size_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph);
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];
}
struct glyph_row *from = saved->rows + i;
struct glyph_row *to = f->current_matrix->rows + i;
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];
xfree (from->glyphs[TEXT_AREA]);
}
if (current_row_p)
{
/* Copy window row to frame row. */
- bcopy (window_row->glyphs[0],
- frame_row->glyphs[TEXT_AREA] + window_matrix->matrix_x,
- window_matrix->matrix_w * sizeof (struct glyph));
+ memcpy (frame_row->glyphs[TEXT_AREA] + window_matrix->matrix_x,
+ window_row->glyphs[0],
+ window_matrix->matrix_w * sizeof (struct glyph));
}
else
{
/* Make a copy of the original 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. */
for (i = 0; i < nlines; ++i)
/* Make a copy of the original rows of matrix m. */
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)
{
row_table_size = next_almost_prime (3 * n);
nbytes = row_table_size * sizeof *row_table;
row_table = (struct row_entry **) xrealloc (row_table, nbytes);
- bzero (row_table, nbytes);
+ memset (row_table, 0, nbytes);
}
if (n > row_entry_pool_size)
}
pos += end - buf;
filled -= end - buf;
- bcopy (end, buf, filled);
+ memcpy (buf, end, filled);
}
emacs_close (fd);
return Qnil;
if (len == 1)
*bufp = *strp;
else
- bcopy (strp, bufp, len);
+ memcpy (bufp, strp, len);
strp += len;
bufp += len;
nchars++;
int offset = bufp - buf;
buf = (unsigned char *) xrealloc (buf, bsize += 4);
bufp = buf + offset;
- bcopy ("M-x ", bufp, 4);
+ memcpy (bufp, "M-x ", 4);
bufp += 4;
nchars += 4;
if (multibyte)
int offset = bufp - buf;
buf = (unsigned char *) xrealloc (buf, bsize += length_byte);
bufp = buf + offset;
- bcopy (start, bufp, length_byte);
+ memcpy (bufp, start, length_byte);
bufp += length_byte;
nchars += length;
/* Check STRING again in case gc relocated it. */
if (len == 1)
*bufp = *strp;
else
- bcopy (strp, bufp, len);
+ memcpy (bufp, strp, len);
strp += len;
bufp += len;
nchars++;
/* Truncate the string at character boundary. */
tem = bufsize;
while (!CHAR_HEAD_P (string[tem - 1])) tem--;
- bcopy (string, bufptr, tem);
+ memcpy (bufptr, string, tem);
/* We must calculate WIDTH again. */
width = strwidth (bufptr, tem);
}
else
- bcopy (string, bufptr, tem);
+ memcpy (bufptr, string, tem);
bufptr += tem;
bufsize -= tem;
if (minlen < 0)
login = Fuser_login_name (make_number (pw->pw_uid));
r = (unsigned char *) alloca (strlen (p) + SCHARS (login) + 1);
- bcopy (p, r, q - p);
+ memcpy (r, p, q - p);
r[q - p] = 0;
strcat (r, SDATA (login));
r[q - p] = UPCASE (r[q - p]);
result = make_uninit_multibyte_string (end - start, end_byte - start_byte);
else
result = make_uninit_string (end - start);
- bcopy (BYTE_POS_ADDR (start_byte), SDATA (result),
- end_byte - start_byte);
+ memcpy (SDATA (result), BYTE_POS_ADDR (start_byte), end_byte - start_byte);
/* If desired, update and copy the text properties. */
if (props)
message_length = SBYTES (val);
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),
STRING_MULTIBYTE (val));
return val;
int i;
if (!info)
info = (struct info *) alloca (nbytes);
- bzero (info, nbytes);
+ memset (info, 0, nbytes);
for (i = 0; i <= nargs; i++)
info[i].start = -1;
if (!discarded)
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. */
{
int this_nchars;
- bcopy (this_format_start, this_format,
- format - this_format_start);
+ memcpy (this_format, this_format_start,
+ format - this_format_start);
this_format[format - this_format_start] = 0;
if (format[-1] == 'e' || format[-1] == 'f' || format[-1] == 'g')
start1_addr = BYTE_POS_ADDR (start1_byte);
start2_addr = BYTE_POS_ADDR (start2_byte);
- bcopy (start2_addr, temp, len2_byte);
- bcopy (start1_addr, start1_addr + len2_byte, len1_byte);
- bcopy (temp, start1_addr, len2_byte);
+ memcpy (temp, start2_addr, len2_byte);
+ memcpy (start1_addr + len2_byte, start1_addr, len1_byte);
+ memcpy (start1_addr, temp, len2_byte);
SAFE_FREE ();
}
else
SAFE_ALLOCA (temp, unsigned char *, len1_byte);
start1_addr = BYTE_POS_ADDR (start1_byte);
start2_addr = BYTE_POS_ADDR (start2_byte);
- bcopy (start1_addr, temp, len1_byte);
- bcopy (start2_addr, start1_addr, len2_byte);
- bcopy (temp, start1_addr + len2_byte, len1_byte);
+ memcpy (temp, start1_addr, len1_byte);
+ memcpy (start1_addr, start2_addr, len2_byte);
+ memcpy (start1_addr + len2_byte, temp, len1_byte);
SAFE_FREE ();
}
graft_intervals_into_buffer (tmp_interval1, start1 + len2,
SAFE_ALLOCA (temp, unsigned char *, len1_byte);
start1_addr = BYTE_POS_ADDR (start1_byte);
start2_addr = BYTE_POS_ADDR (start2_byte);
- bcopy (start1_addr, temp, len1_byte);
- bcopy (start2_addr, start1_addr, len2_byte);
- bcopy (temp, start2_addr, len1_byte);
+ memcpy (temp, start1_addr, len1_byte);
+ memcpy (start1_addr, start2_addr, len2_byte);
+ memcpy (start2_addr, temp, len1_byte);
SAFE_FREE ();
graft_intervals_into_buffer (tmp_interval1, start2,
SAFE_ALLOCA (temp, unsigned char *, len2_byte);
start1_addr = BYTE_POS_ADDR (start1_byte);
start2_addr = BYTE_POS_ADDR (start2_byte);
- bcopy (start2_addr, temp, len2_byte);
- bcopy (start1_addr, start1_addr + len_mid + len2_byte, len1_byte);
- safe_bcopy (start1_addr + len1_byte, start1_addr + len2_byte, len_mid);
- bcopy (temp, start1_addr, len2_byte);
+ memcpy (temp, start2_addr, len2_byte);
+ memcpy (start1_addr + len_mid + len2_byte, start1_addr, len1_byte);
+ memmove (start1_addr + len2_byte, start1_addr + len1_byte, len_mid);
+ memcpy (start1_addr, temp, len2_byte);
SAFE_FREE ();
graft_intervals_into_buffer (tmp_interval1, end2 - len1,
SAFE_ALLOCA (temp, unsigned char *, len1_byte);
start1_addr = BYTE_POS_ADDR (start1_byte);
start2_addr = BYTE_POS_ADDR (start2_byte);
- bcopy (start1_addr, temp, len1_byte);
- bcopy (start2_addr, start1_addr, len2_byte);
- bcopy (start1_addr + len1_byte, start1_addr + len2_byte, len_mid);
- bcopy (temp, start1_addr + len2_byte + len_mid, len1_byte);
+ memcpy (temp, start1_addr, len1_byte);
+ memcpy (start1_addr, start2_addr, len2_byte);
+ memcpy (start1_addr + len2_byte, start1_addr + len1_byte, len_mid);
+ memcpy (start1_addr + len2_byte + len_mid, temp, len1_byte);
SAFE_FREE ();
graft_intervals_into_buffer (tmp_interval1, end2 - len1,
extern char etext;
#endif
extern void safe_bcopy ();
- extern void dump_opcode_frequencies ();
atexit (_mcleanup);
/* This uses safe_bcopy because that function comes first in the
Emacs executable. It might be better to use something that
gives the start of the text segment, but start_of_text is not
defined on all systems now. */
+ /* FIXME: Does not work on architectures with function
+ descriptors. */
monstartup (safe_bcopy, &etext);
}
else
while (to < argc)
new[to++] = 0;
- bcopy (new, argv, sizeof (char *) * argc);
+ memcpy (argv, new, sizeof (char *) * argc);
xfree (options);
xfree (new);
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
the slot that it used to occupy, hence this value of I. */
i = nargs - 1;
if (XSUBR (fun)->max_args > numargs)
{
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++)
internal_args[i] = Qnil;
}
filename = FILE_SYSTEM_CASE (filename);
#ifdef DOS_NT
beg = (unsigned char *) alloca (SBYTES (filename) + 1);
- bcopy (SDATA (filename), beg, SBYTES (filename) + 1);
+ memcpy (beg, SDATA (filename), SBYTES (filename) + 1);
#else
beg = SDATA (filename);
#endif
if (!STRING_MULTIBYTE (prefix))
STRING_SET_UNIBYTE (val);
data = SDATA (val);
- bcopy(SDATA (prefix), data, len);
+ memcpy (data, SDATA (prefix), len);
p = data + len;
- bcopy (pidbuf, p, pidlen);
+ memcpy (p, pidbuf, pidlen);
p += pidlen;
/* Here we try to minimize useless stat'ing when this function is
/* Make a local copy of nm[] to protect it from GC in DECODE_FILE below. */
nm = (unsigned char *) alloca (SBYTES (name) + 1);
- bcopy (SDATA (name), nm, SBYTES (name) + 1);
+ memcpy (nm, SDATA (name), SBYTES (name) + 1);
#ifdef DOS_NT
/* Note if special escape prefix is present, but remove for now. */
unsigned char *o, *p;
for (p = nm; *p && (!IS_DIRECTORY_SEP (*p)); p++);
o = alloca (p - nm + 1);
- bcopy ((char *) nm, o, p - nm);
+ memcpy (o, nm, p - nm);
o [p - nm] = 0;
BLOCK_INPUT;
)
{
unsigned char *temp = (unsigned char *) alloca (length);
- bcopy (newdir, temp, length - 1);
+ memcpy (temp, newdir, length - 1);
temp[length - 1] = 0;
newdir = temp;
}
int len = ptr ? ptr - user : strlen (user);
/* Copy the user name into temp storage. */
o = (unsigned char *) alloca (len + 1);
- bcopy ((char *) user, o, len);
+ memcpy (o, user, len);
o[len] = 0;
/* Look up the user name. */
{
unsigned char *o = alloca (s - p + 1);
struct passwd *pw;
- bcopy (p, o, s - p);
+ memcpy (o, p, s - p);
o [s - p] = 0;
/* If we have ~user and `user' exists, discard
decode of environment variables, causing the original Lisp_String
data to be relocated. */
nm = (unsigned char *) alloca (SBYTES (filename) + 1);
- bcopy (SDATA (filename), nm, SBYTES (filename) + 1);
+ memcpy (nm, SDATA (filename), SBYTES (filename) + 1);
#ifdef DOS_NT
dostounix_filename (nm);
{
bufsize *= 2;
buf = (char *) xrealloc (buf, bufsize);
- bzero (buf, bufsize);
+ memset (buf, 0, bufsize);
errno = 0;
valsize = readlink (SDATA (filename), buf, bufsize);
conversion_buffer);
unprocessed = coding.carryover_bytes;
if (coding.carryover_bytes > 0)
- bcopy (coding.carryover, read_buf, unprocessed);
+ memcpy (read_buf, coding.carryover, unprocessed);
}
UNGCPRO;
emacs_close (fd);
GCPRO1 (msg);
nbytes = SBYTES (msg);
SAFE_ALLOCA (msgbuf, char *, nbytes);
- bcopy (SDATA (msg), msgbuf, nbytes);
+ memcpy (msgbuf, SDATA (msg), nbytes);
for (i = 0; i < 3; ++i)
{
if (SCHARS (s1) != SCHARS (s2)
|| SBYTES (s1) != SBYTES (s2)
- || bcmp (SDATA (s1), SDATA (s2), SBYTES (s1)))
+ || memcmp (SDATA (s1), SDATA (s2), SBYTES (s1)))
return Qnil;
return Qt;
}
/ BOOL_VECTOR_BITS_PER_CHAR);
val = Fmake_bool_vector (Flength (arg), Qnil);
- bcopy (XBOOL_VECTOR (arg)->data, XBOOL_VECTOR (val)->data,
- size_in_chars);
+ memcpy (XBOOL_VECTOR (val)->data, XBOOL_VECTOR (arg)->data,
+ size_in_chars);
return val;
}
{
int thislen_byte = SBYTES (this);
- bcopy (SDATA (this), SDATA (val) + toindex_byte,
- SBYTES (this));
+ memcpy (SDATA (val) + toindex_byte, SDATA (this), SBYTES (this));
if (! NULL_INTERVAL_P (STRING_INTERVALS (this)))
{
textprops[num_textprops].argnum = argnum;
return make_multibyte_string (SDATA (string), nbytes, 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));
ret = make_multibyte_string (buf, SCHARS (string), nbytes);
int bytes = SBYTES (string);
unsigned char *str = (unsigned char *) xmalloc (bytes);
- bcopy (SDATA (string), str, bytes);
+ memcpy (str, SDATA (string), bytes);
bytes = str_as_unibyte (str, bytes);
string = make_unibyte_string (str, bytes);
xfree (str);
SBYTES (string),
&nchars, &nbytes);
new_string = make_uninit_multibyte_string (nchars, nbytes);
- bcopy (SDATA (string), SDATA (new_string),
- SBYTES (string));
+ memcpy (SDATA (new_string), SDATA (string), SBYTES (string));
if (nbytes != SBYTES (string))
str_as_multibyte (SDATA (new_string), nbytes,
SBYTES (string), NULL);
if (XBOOL_VECTOR (o1)->size != XBOOL_VECTOR (o2)->size)
return 0;
- if (bcmp (XBOOL_VECTOR (o1)->data, XBOOL_VECTOR (o2)->data,
- size_in_chars))
+ if (memcmp (XBOOL_VECTOR (o1)->data, XBOOL_VECTOR (o2)->data,
+ size_in_chars))
return 0;
return 1;
}
return 0;
if (SBYTES (o1) != SBYTES (o2))
return 0;
- if (bcmp (SDATA (o1), SDATA (o2),
- SBYTES (o1)))
+ if (memcmp (SDATA (o1), SDATA (o2), SBYTES (o1)))
return 0;
if (props && !compare_string_intervals (o1, o2))
return 0;
int len;
CHECK_STRING (string);
len = SBYTES (string);
- bzero (SDATA (string), len);
+ memset (SDATA (string), 0, len);
STRING_SET_CHARS (string, len);
STRING_SET_UNIBYTE (string);
return Qnil;
xassert (new_size >= old_size);
v = allocate_vector (new_size);
- bcopy (XVECTOR (vec)->contents, v->contents,
- old_size * sizeof *v->contents);
+ memcpy (v->contents, XVECTOR (vec)->contents, old_size * sizeof *v->contents);
for (i = old_size; i < new_size; ++i)
v->contents[i] = init;
XSETVECTOR (vec, v);
h2 = allocate_hash_table ();
next = h2->vec_next;
- bcopy (h1, h2, sizeof *h2);
+ memcpy (h2, h1, sizeof *h2);
h2->vec_next = next;
h2->key_and_value = Fcopy_sequence (h1->key_and_value);
h2->hash = Fcopy_sequence (h1->hash);
/* The vector `used' is used to keep track of arguments that
have been consumed. */
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. */
i = get_key_arg (QCtest, nargs, args, used);
xfb = (struct fringe_bitmap *) xmalloc (sizeof fb
+ fb.height * BYTES_PER_BITMAP_ROW);
fb.bits = b = (unsigned short *) (xfb + 1);
- bzero (b, fb.height);
+ memset (b, 0, fb.height);
j = 0;
while (j < fb.height)
if (ftfont_info->ft_size != ft_face->size)
FT_Activate_Size (ftfont_info->ft_size);
if (metrics)
- bzero (metrics, sizeof (struct font_metrics));
+ memset (metrics, 0, sizeof (struct font_metrics));
for (i = 0, first = 1; i < nglyphs; i++)
{
if (FT_Load_Glyph (ft_face, code[i], FT_LOAD_DEFAULT) == 0)
for (i = 0; i < conf.config_maxclass; ++i)
{
struct class_stats stats;
- bzero ((char *) &stats, sizeof stats);
+ memset (&stats, 0, sizeof stats);
desc.sd_type = CPUTYPE_CLASS;
desc.sd_objid = i;
/* Make a copy of TYPE to avoid a bus error in a dumped Emacs.
The initialized data segment is read-only. */
struct image_type *p = (struct image_type *) xmalloc (sizeof *p);
- bcopy (type, p, sizeof *p);
+ memcpy (p, type, sizeof *p);
p->next = image_types;
image_types = p;
success = Qt;
Lisp_Object file = image_spec_value (spec, QCfile, NULL);
xassert (valid_image_p (spec));
- bzero (img, sizeof *img);
+ memset (img, 0, sizeof *img);
img->dependencies = NILP (file) ? Qnil : list1 (file);
img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL));
xassert (img->type != NULL);
struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c);
int size;
- bzero (c, sizeof *c);
+ memset (c, 0, sizeof *c);
c->size = 50;
c->images = (struct image **) xmalloc (c->size * sizeof *c->images);
size = IMAGE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
c->buckets = (struct image **) xmalloc (size);
- bzero (c->buckets, size);
+ memset (c->buckets, 0, size);
return c;
}
return 0;
}
- header = &((*ximg)->info.bmiHeader);
- bzero (&((*ximg)->info), sizeof (BITMAPINFO));
+ header = &(*ximg)->info.bmiHeader;
+ memset (&(*ximg)->info, 0, sizeof (BITMAPINFO));
header->biSize = sizeof (*header);
header->biWidth = width;
header->biHeight = -height; /* negative indicates a top-down bitmap. */
{
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))
return 0;
w1 = (width + 7) / 8; /* nb of 8bits elt in X bitmap */
w2 = ((width + 15) / 16) * 2; /* nb of 16bits elt in W32 bitmap */
bits = (unsigned char *) alloca (height * w2);
- bzero (bits, height * w2);
+ memset (bits, 0, height * w2);
for (i = 0; i < height; i++)
{
p = bits + i*w2;
in_memory_file_p = xbm_file_p (data);
/* 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);
xassert (parsed_p);
{
Lisp_Object line = XVECTOR (data)->contents[i];
if (STRINGP (line))
- bcopy (SDATA (line), p, nbytes);
+ memcpy (p, SDATA (line), nbytes);
else
- bcopy (XBOOL_VECTOR (line)->data, p, nbytes);
+ memcpy (p, XBOOL_VECTOR (line)->data, nbytes);
}
}
else if (STRINGP (data))
with transparency, and it's useful. */
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);
p = xpm_cache_color (f, color_name, color, h);
}
xpm_image_p (Lisp_Object object)
{
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)
/* Either `:file' or `:data' must be present. */
&& fmt[XPM_FILE].count + fmt[XPM_DATA].count == 1
XpmAttributes attrs;
Pixmap bitmap, mask;
- bzero (&attrs, sizeof attrs);
+ memset (&attrs, 0, sizeof attrs);
attrs.visual = FRAME_X_VISUAL (f);
attrs.colormap = FRAME_X_COLORMAP (f);
/* Configure the XPM lib. Use the visual of frame F. Allocate
close colors. Return colors allocated. */
- bzero (&attrs, sizeof attrs);
+ memset (&attrs, 0, sizeof attrs);
#ifndef HAVE_NTGUI
attrs.visual = FRAME_X_VISUAL (f);
/* Allocate an XpmColorSymbol array. */
size = attrs.numsymbols * sizeof *xpm_syms;
xpm_syms = (XpmColorSymbol *) alloca (size);
- bzero (xpm_syms, size);
+ memset (xpm_syms, 0, size);
attrs.colorsymbols = xpm_syms;
/* Fill the color symbol array. */
{
int size = CT_SIZE * sizeof (*ct_table);
ct_table = (struct ct_color **) xmalloc (size);
- bzero (ct_table, size);
+ memset (ct_table, 0, size);
ct_colors_allocated = 0;
}
/* Create the bit array serving as mask. */
row_width = (img->width + 7) / 8;
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. */
frame_dc = get_frame_dc (f);
{
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))
return 0;
unsigned long bg = FRAME_BACKGROUND_PIXEL (f);
/* 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);
/* Get foreground and background colors, maybe allocate colors. */
png_image_p (Lisp_Object object)
{
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))
return 0;
if (length > tbr->len - tbr->index)
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;
}
{
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.green = color.green >> shift;
user_bg.blue = color.blue >> shift;
color.pixel = FRAME_BACKGROUND_PIXEL (f);
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.green = color.green >> shift;
frame_background.blue = color.blue >> shift;
{
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))
return 0;
tiff_image_p (Lisp_Object object)
{
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))
return 0;
if (size > src->len - src->index)
return (size_t) -1;
- bcopy (src->bytes + src->index, buf, size);
+ memcpy (buf, src->bytes + src->index, size);
src->index += size;
return size;
}
gif_image_p (Lisp_Object object)
{
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))
return 0;
if (len > src->len - src->index)
return -1;
- bcopy (src->bytes + src->index, buf, len);
+ memcpy (buf, src->bytes + src->index, len);
src->index += len;
return len;
}
if (!gif_color_map)
gif_color_map = gif->SColorMap;
init_color_table ();
- bzero (pixel_colors, sizeof pixel_colors);
+ memset (pixel_colors, 0, sizeof pixel_colors);
if (gif_color_map)
for (i = 0; i < gif_color_map->ColorCount; ++i)
svg_image_p (Lisp_Object object)
{
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))
return 0;
Lisp_Object tem;
int i;
- bcopy (gs_format, fmt, sizeof fmt);
+ memcpy (fmt, gs_format, sizeof fmt);
if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript))
return 0;
w = ! NILP (window) ? XWINDOW (window) : NULL;
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;
composition_compute_stop_pos (&cmp_it, scan, scan_byte, end, Qnil);
pos_byte = prev_pos_byte = CHAR_TO_BYTE (from);
contin_hpos = 0;
prev_tab_offset = tab_offset;
- bzero (&cmp_it, sizeof cmp_it);
+ memset (&cmp_it, 0, sizeof cmp_it);
cmp_it.id = -1;
composition_compute_stop_pos (&cmp_it, pos, pos_byte, to, Qnil);
/* Move at most 32000 chars before checking again for a quit. */
if (i > 32000)
i = 32000;
-#ifdef GAP_USE_BCOPY
- if (i >= 128
- /* bcopy is safe if the two areas of memory do not overlap
- 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;
- }
+ new_s1 -= i;
+ from -= i, to -= i;
+ memmove (to, from, i);
}
/* Adjust markers, and buffer data structure, to put the gap at BYTEPOS.
/* Move at most 32000 chars before checking again for a quit. */
if (i > 32000)
i = 32000;
-#ifdef GAP_USE_BCOPY
- if (i >= 128
- /* bcopy is safe if the two areas of memory do not overlap
- 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++;
- }
+ new_s1 += i;
+ memmove (to, from, i);
+ from += i, to += i;
}
adjust_markers_gap_motion (GPT_BYTE + GAP_SIZE, bytepos + GAP_SIZE,
/* 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
text. */
- bzero (GPT_ADDR, new_gap_size);
+ memset (GPT_ADDR, 0, new_gap_size);
GPT += new_gap_size;
GPT_BYTE += new_gap_size;
Z += new_gap_size;
{
if (from_multibyte == to_multibyte)
{
- bcopy (from_addr, to_addr, nbytes);
+ memcpy (to_addr, from_addr, nbytes);
return nbytes;
}
else if (from_multibyte)
MODIFF++;
CHARS_MODIFF = MODIFF;
- bcopy (string, GPT_ADDR, nbytes);
+ memcpy (GPT_ADDR, string, nbytes);
GAP_SIZE -= nbytes;
GPT += nchars;
copy them into the buffer.
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. */
void
into the current buffer.
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
insert_from_buffer (struct buffer *buf,
make_gap (insbytes - GAP_SIZE);
/* Copy the replacement text into the buffer. */
- bcopy (ins, GPT_ADDR, insbytes);
+ memcpy (GPT_ADDR, ins, insbytes);
#ifdef BYTE_COMBINING_DEBUG
/* We have copied text into the gap, but we have not marked
{
register INTERVAL t = make_interval ();
- bcopy (source, t, INTERVAL_SIZE);
+ memcpy (t, source, INTERVAL_SIZE);
copy_properties (source, t);
SET_INTERVAL_PARENT (t, parent);
if (! NULL_LEFT_CHILD (source))
{
register INTERVAL t = make_interval ();
- bcopy (source, t, INTERVAL_SIZE);
+ memcpy (t, source, INTERVAL_SIZE);
copy_properties (source, t);
SET_INTERVAL_OBJECT (t, parent);
if (! NULL_LEFT_CHILD (source))
ptr = buffer + offset;
}
- bcopy (text, ptr, len);
+ memcpy (ptr, text, len);
ptr += len;
}
static void
save_getcjmp (jmp_buf temp)
{
- bcopy (getcjmp, temp, sizeof getcjmp);
+ memcpy (temp, getcjmp, sizeof getcjmp);
}
static void
restore_getcjmp (jmp_buf temp)
{
- bcopy (temp, getcjmp, sizeof getcjmp);
+ memcpy (getcjmp, temp, sizeof getcjmp);
}
\f
/* Low level keyboard/mouse input.
if (hold_quit)
{
- bcopy (event, (char *) hold_quit, sizeof (*event));
+ memcpy (hold_quit, event, sizeof (*event));
return;
}
new_name = make_uninit_multibyte_string (mod_len + base_len,
mod_len + base_len_byte);
- bcopy (new_mods, SDATA (new_name), mod_len);
- bcopy (base, SDATA (new_name) + mod_len, base_len_byte);
+ memcpy (SDATA (new_name), new_mods, mod_len);
+ memcpy (SDATA (new_name) + mod_len, base, base_len_byte);
return Fintern (new_name, Qnil);
}
if (nstored == 0)
{
- bzero (&buf, sizeof buf);
+ memset (&buf, 0, sizeof buf);
buf.kind = USER_SIGNAL_EVENT;
buf.frame_or_window = selected_frame;
}
nmaps = 0;
if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
maps[nmaps++] = tem;
- bcopy (tmaps, (void *) (maps + nmaps), nminor * sizeof (maps[0]));
+ memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0]));
nmaps += nminor;
maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map);
}
tem2 = XVECTOR (menu_bar_items_vector)->contents[i + 2];
tem3 = XVECTOR (menu_bar_items_vector)->contents[i + 3];
if (end > i + 4)
- bcopy (&XVECTOR (menu_bar_items_vector)->contents[i + 4],
- &XVECTOR (menu_bar_items_vector)->contents[i],
- (end - i - 4) * sizeof (Lisp_Object));
+ memmove (&XVECTOR (menu_bar_items_vector)->contents[i],
+ &XVECTOR (menu_bar_items_vector)->contents[i + 4],
+ (end - i - 4) * sizeof (Lisp_Object));
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 - 2] = tem2;
if (EQ (key, XVECTOR (menu_bar_items_vector)->contents[i]))
{
if (menu_bar_items_index > i + 4)
- bcopy (&XVECTOR (menu_bar_items_vector)->contents[i + 4],
- &XVECTOR (menu_bar_items_vector)->contents[i],
- (menu_bar_items_index - i - 4) * sizeof (Lisp_Object));
+ memmove (&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 -= 4;
}
}
nmaps = 0;
if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
maps[nmaps++] = tem;
- bcopy (tmaps, (void *) (maps + nmaps), nminor * sizeof (maps[0]));
+ memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0]));
nmaps += nminor;
maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map);
}
if (EQ (key, v[TOOL_BAR_ITEM_KEY]))
{
if (ntool_bar_items > i + TOOL_BAR_ITEM_NSLOTS)
- bcopy (v + TOOL_BAR_ITEM_NSLOTS, v,
- ((ntool_bar_items - i - TOOL_BAR_ITEM_NSLOTS)
- * sizeof (Lisp_Object)));
+ memmove (v, v + TOOL_BAR_ITEM_NSLOTS,
+ ((ntool_bar_items - i - TOOL_BAR_ITEM_NSLOTS)
+ * sizeof (Lisp_Object)));
ntool_bar_items -= TOOL_BAR_ITEM_NSLOTS;
break;
}
tool_bar_items_vector. */
to = XVECTOR (tool_bar_items_vector)->contents + ntool_bar_items;
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;
}
thiswidth = SCHARS (desc);
if (thiswidth + i > width)
thiswidth = width - i;
- bcopy (SDATA (desc), menu + i, thiswidth);
+ memcpy (menu + i, SDATA (desc), thiswidth);
i += thiswidth;
strcpy (menu + i, " = ");
i += 3;
thiswidth = SCHARS (s);
if (thiswidth + i > width)
thiswidth = width - i;
- bcopy (SDATA (s), menu + i, thiswidth);
+ memcpy (menu + i, SDATA (s), thiswidth);
i += thiswidth;
menu[i] = 0;
}
if (!NILP (orig_keymap))
submaps[nmaps++] = orig_keymap;
- bcopy (maps, (void *) (submaps + nmaps),
- nminor * sizeof (submaps[0]));
+ memcpy (submaps + nmaps, maps, nminor * sizeof (submaps[0]));
nmaps += nminor;
specbind (Qinput_method_use_echo_area,
(NILP (command_loop) ? Qt : Qnil));
- bzero (keybuf, sizeof keybuf);
+ memset (keybuf, 0, sizeof keybuf);
GCPRO1 (keybuf[0]);
gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0]));
specbind (Qinput_method_use_echo_area,
(NILP (command_loop) ? Qt : Qnil));
- bzero (keybuf, sizeof keybuf);
+ memset (keybuf, 0, sizeof keybuf);
GCPRO1 (keybuf[0]);
gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0]));
else
{
val = Fvector (NUM_RECENT_KEYS, keys);
- bcopy (keys + recent_keys_index,
- XVECTOR (val)->contents,
- (NUM_RECENT_KEYS - recent_keys_index) * sizeof (Lisp_Object));
- bcopy (keys,
- XVECTOR (val)->contents + NUM_RECENT_KEYS - recent_keys_index,
- recent_keys_index * sizeof (Lisp_Object));
+ memcpy (XVECTOR (val)->contents, keys + recent_keys_index,
+ (NUM_RECENT_KEYS - recent_keys_index) * sizeof (Lisp_Object));
+ memcpy (XVECTOR (val)->contents + NUM_RECENT_KEYS - recent_keys_index,
+ keys, recent_keys_index * sizeof (Lisp_Object));
return val;
}
}
{
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);
}
cmm_modes = newmodes;
{
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);
}
cmm_maps = newmaps;
*p++ = '\f';
*p++ = '\n';
*p++ = '`';
- bcopy (SDATA (SYMBOL_NAME (modes[i])), p,
- SCHARS (SYMBOL_NAME (modes[i])));
+ memcpy (p, SDATA (SYMBOL_NAME (modes[i])),
+ SCHARS (SYMBOL_NAME (modes[i])));
p += SCHARS (SYMBOL_NAME (modes[i]));
*p++ = '\'';
- bcopy (" Minor Mode Bindings", p, sizeof (" Minor Mode Bindings") - 1);
- p += sizeof (" Minor Mode Bindings") - 1;
+ memcpy (p, " Minor Mode Bindings", strlen (" Minor Mode Bindings"));
+ p += strlen (" Minor Mode Bindings");
*p = 0;
describe_map_tree (maps[i], 1, shadow, prefix,
(XSTRING (string)->size = (newsize))
#define STRING_COPYIN(string, index, new, count) \
- bcopy (new, SDATA (string) + index, count)
+ memcpy (SDATA (string) + index, new, count)
/* Type checking. */
extern Lisp_Object sit_for (Lisp_Object, int, int);
extern void init_display (void);
extern void syms_of_display (void);
-extern void safe_bcopy (const char *, char *, int);
/* Defined in xdisp.c */
extern Lisp_Object Qinhibit_point_motion_hooks;
extern int emacs_close (int);
extern int emacs_read (int, 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 */
EXFUN (Funlock_buffer, 0);
specbind (Qold_style_backquotes, Qnil);
record_unwind_protect (load_warn_old_style_backquotes, file);
- if (!bcmp (SDATA (found) + SBYTES (found) - 4,
- ".elc", 4)
+ if (!memcmp (SDATA (found) + SBYTES (found) - 4, ".elc", 4)
|| (fd >= 0 && (version = safe_to_load_p (fd)) > 0))
/* Load .elc files directly, but not when they are
remote and have no handler! */
invalid_syntax ("#&...", 5);
val = Fmake_bool_vector (length, Qnil);
- bcopy (SDATA (tmp), XBOOL_VECTOR (val)->data,
- size_in_chars);
+ memcpy (XBOOL_VECTOR (val)->data, SDATA (tmp), size_in_chars);
/* Clear the extraneous bits in the last byte. */
if (XINT (length) != size_in_chars * BOOL_VECTOR_BITS_PER_CHAR)
XBOOL_VECTOR (val)->data[size_in_chars - 1]
{
if (SBYTES (SYMBOL_NAME (tail)) == size_byte
&& SCHARS (SYMBOL_NAME (tail)) == size
- && !bcmp (SDATA (SYMBOL_NAME (tail)), ptr, size_byte))
+ && !memcmp (SDATA (SYMBOL_NAME (tail)), ptr, size_byte))
return tail;
else if (XSYMBOL (tail)->next == 0)
break;
#include <sys/time.h>
#include <dos.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 <unistd.h> /* for chdir, dup, dup2, etc. */
#include <dir.h> /* for getdisk */
else
{
val = Fvector (NUM_RECENT_DOSKEYS, keys);
- bcopy (keys + recent_doskeys_index,
- XVECTOR (val)->contents,
- (NUM_RECENT_DOSKEYS - recent_doskeys_index) * sizeof (Lisp_Object));
- bcopy (keys,
- XVECTOR (val)->contents + NUM_RECENT_DOSKEYS - recent_doskeys_index,
- recent_doskeys_index * sizeof (Lisp_Object));
+ memcpy (XVECTOR (val)->contents, keys + recent_doskeys_index,
+ (NUM_RECENT_DOSKEYS - recent_doskeys_index) * sizeof (Lisp_Object));
+ memcpy (XVECTOR (val)->contents + NUM_RECENT_DOSKEYS - recent_doskeys_index,
+ keys, recent_doskeys_index * sizeof (Lisp_Object));
return val;
}
}
f->output_method = output_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;
xmalloc (0x100 * sizeof (struct font_metrics *));
if (!font_info->glyphs || !font_info->metrics)
return Qnil;
- bzero (font_info->glyphs, 0x100 * sizeof (unsigned short *));
- bzero (font_info->metrics, 0x100 * sizeof (struct font_metrics *));
+ memset (font_info->glyphs, 0, 0x100 * sizeof (unsigned short *));
+ memset (font_info->metrics, 0, 0x100 * sizeof (struct font_metrics *));
BLOCK_INPUT;
[font_info->nsfont retain];
/* set up ns_font (defined in nsgui.h) */
- font_info->name = (char *)xmalloc (strlen (fontName) + 1);
- bcopy (fontName, font_info->name, strlen (fontName) + 1);
+ font_info->name = (char *)xmalloc (strlen (fontName)+1);
+ strcpy (font_info->name, fontName);
font_info->bold = [fontMgr traitsOfFont: nsfont] & NSBoldFontMask;
font_info->ital =
synthItal || ([fontMgr traitsOfFont: nsfont] & NSItalicFontMask);
int totalWidth = 0;
int i;
- bzero (metrics, sizeof (struct font_metrics));
+ memset (metrics, 0, sizeof (struct font_metrics));
for (i =0; i<nglyphs; i++)
{
sfont = [font_info->nsfont screenFont];
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]))
abort ();
[self addRepresentation: bmRep];
- bzero (planes[0], w*h);
- bzero (planes[1], w*h);
- bzero (planes[2], w*h);
+ memset (planes[0], 0, w*h);
+ memset (planes[1], 0, w*h);
+ memset (planes[2], 0, w*h);
[self setXBMColor: [NSColor blackColor]];
return self;
}
[bmRep getBitmapDataPlanes: pixmapData];
for (i =0; i<4; i++)
- bzero (pixmapData[i], width*height);
+ memset (pixmapData[i], 0, width*height);
[self addRepresentation: bmRep];
return self;
}
/* Save the frame's previous menu bar contents data */
if (previous_menu_items_used)
- bcopy (XVECTOR (f->menu_bar_vector)->contents, previous_items,
- previous_menu_items_used * sizeof (Lisp_Object));
+ memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents,
+ previous_menu_items_used * sizeof (Lisp_Object));
/* parse stage 1: extract from lisp */
save_menu_items ();
{
EmacsImage **newBimgs
= 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)
{
- bcopy (bimgs, newBimgs, nBimgs * sizeof (EmacsImage *));
+ memcpy (newBimgs, bimgs, nBimgs * sizeof (EmacsImage *));
xfree (bimgs);
}
name: nil object: nil]; */
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);
terminal = ns_create_terminal (dpyinfo);
static Lisp_Object
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;
}
if (print_buffer_pos_byte + len >= print_buffer_size)
print_buffer = (char *) xrealloc (print_buffer,
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_byte += len;
}
print_buffer = (char *) xrealloc (print_buffer,
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_byte += size_byte;
}
if (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);
string = newstr;
}
USE_SAFE_ALLOCA;
SAFE_ALLOCA (buffer, char *, nbytes);
- bcopy (SDATA (string), buffer, nbytes);
+ memcpy (buffer, SDATA (string), nbytes);
strout (buffer, chars, SBYTES (string),
printcharfun, STRING_MULTIBYTE (string));
{
Lisp_Object cname = SYMBOL_NAME (caller);
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 (": ", 2, 0, 0);
}
register unsigned char *cp = NULL;
register int i;
- bzero (sa, len);
+ memset (sa, 0, len);
if (VECTORP (address))
{
/* This is broken, at least in the Linux 2.4 kernel.
To unbind, the arg must be a zero integer, not the empty string.
This should work on all systems. KFS. 2003-09-23. */
- bzero (devname, sizeof devname);
+ memset (devname, 0, sizeof devname);
if (STRINGP (val))
{
char *arg = (char *) SDATA (val);
int len = min (strlen (arg), IFNAMSIZ);
- bcopy (arg, devname, len);
+ memcpy (devname, arg, len);
}
else if (!NILP (val))
error ("Bad option value for %s", name);
host = Qnil;
}
CHECK_STRING (service);
- bzero (&address_un, sizeof address_un);
+ memset (&address_un, 0, sizeof address_un);
address_un.sun_family = AF_LOCAL;
strncpy (address_un.sun_path, SDATA (service), sizeof address_un.sun_path);
ai.ai_addr = (struct sockaddr *) &address_un;
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_addr.s_addr = INADDR_ANY;
address_in.sin_port = port;
if (host_info_ptr)
{
- bcopy (host_info_ptr->h_addr, (char *) &address_in.sin_addr,
- host_info_ptr->h_length);
+ memcpy (&address_in.sin_addr, host_info_ptr->h_addr,
+ host_info_ptr->h_length);
family = host_info_ptr->h_addrtype;
address_in.sin_family = family;
}
if (numeric_addr == -1)
error ("Unknown host \"%s\"", SDATA (host));
- bcopy ((char *)&numeric_addr, (char *) &address_in.sin_addr,
- sizeof (address_in.sin_addr));
+ memcpy (&address_in.sin_addr, &numeric_addr,
+ sizeof (address_in.sin_addr));
}
}
if (is_server)
{
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))
{
int rfamily, rlen;
}
}
else
- bcopy (lres->ai_addr, datagram_address[s].sa, lres->ai_addrlen);
+ memcpy (datagram_address[s].sa, lres->ai_addr, lres->ai_addrlen);
}
#endif
contact = Fplist_put (contact, QCaddress,
char namebuf[sizeof (ifq->ifr_name) + 1];
if (ifq->ifr_addr.sa_family != AF_INET)
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;
res = Fcons (Fcons (build_string (namebuf),
conv_sockaddr_to_lisp (&ifq->ifr_addr,
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));
s = socket (AF_INET, SOCK_STREAM, 0);
chars = (char *) alloca (carryover + readmax);
if (carryover)
/* See the comment above. */
- bcopy (SDATA (p->decoding_buf), chars, carryover);
+ memcpy (chars, SDATA (p->decoding_buf), carryover);
#ifdef DATAGRAM_SOCKETS
/* We have a working select, so proc_buffered_char is always -1. */
{
if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
p->decoding_buf = make_uninit_string (coding->carryover_bytes);
- bcopy (coding->carryover, SDATA (p->decoding_buf),
- coding->carryover_bytes);
+ memcpy (SDATA (p->decoding_buf), coding->carryover,
+ coding->carryover_bytes);
p->decoding_carryover = coding->carryover_bytes;
}
if (SBYTES (text) > 0)
{
if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
p->decoding_buf = make_uninit_string (coding->carryover_bytes);
- bcopy (coding->carryover, SDATA (p->decoding_buf),
- coding->carryover_bytes);
+ memcpy (SDATA (p->decoding_buf), coding->carryover,
+ coding->carryover_bytes);
p->decoding_carryover = coding->carryover_bytes;
}
/* Adjust the multibyteness of TEXT to that of the buffer. */
if (!proc_encode_coding_system[new_outfd])
proc_encode_coding_system[new_outfd]
= (struct coding_system *) xmalloc (sizeof (struct coding_system));
- bcopy (proc_encode_coding_system[old_outfd],
- proc_encode_coding_system[new_outfd],
- sizeof (struct coding_system));
- bzero (proc_encode_coding_system[old_outfd],
- sizeof (struct coding_system));
+ memcpy (proc_encode_coding_system[new_outfd],
+ proc_encode_coding_system[old_outfd],
+ sizeof (struct coding_system));
+ memset (proc_encode_coding_system[old_outfd], 0,
+ sizeof (struct coding_system));
XPROCESS (proc)->outfd = new_outfd;
}
chan_process[i] = Qnil;
proc_buffered_char[i] = -1;
}
- bzero (proc_decode_coding_system, sizeof proc_decode_coding_system);
- bzero (proc_encode_coding_system, sizeof proc_encode_coding_system);
+ memset (proc_decode_coding_system, 0, sizeof proc_decode_coding_system);
+ memset (proc_encode_coding_system, 0, sizeof proc_encode_coding_system);
#ifdef DATAGRAM_SOCKETS
- bzero (datagram_address, sizeof datagram_address);
+ memset (datagram_address, 0, sizeof datagram_address);
#endif
#ifdef HAVE_SOCKETS
typedef POINTER_TYPE *POINTER;
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
#define M_TOP_PAD -2
extern int mallopt (int, int);
#include <unistd.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 */
}
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;
}
}
}
else
{
- safe_bcopy (bloc->data, bloc->new_data, old_size);
- bzero ((char *) bloc->new_data + old_size, size - old_size);
+ memmove (bloc->new_data, bloc->data, old_size);
+ memset (bloc->new_data + old_size, 0, size - old_size);
*bloc->variable = bloc->data = bloc->new_data;
}
}
}
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;
}
}
header. */
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;
}
last_heap = first_heap;
}
- bzero (address, size);
+ memset (address, 0, size);
}
else /* size < 0 */
{
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;
}
}
abort ();
/* 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. */
if (!r_alloc_freeze_level)
{
even though it is after the sbrk value. */
/* Doubly true, with the additional call that explicitly adds the
rest of that page to the address space. */
- bzero (first_heap->start,
- (char *) first_heap->end - (char *) first_heap->start);
+ memset (first_heap->start, 0,
+ (char *) first_heap->end - (char *) first_heap->start);
virtual_break_value = break_value = first_heap->bloc_start = first_heap->end;
#endif
# endif
# define realloc xrealloc
-/* When used in Emacs's lib-src, we need to get bzero and bcopy somehow.
- If nothing else has been done, use the method below. */
-# ifdef INHIBIT_STRING_HEADER
-# if !(defined HAVE_BZERO && defined HAVE_BCOPY)
-# if !defined bzero && !defined bcopy
-# undef INHIBIT_STRING_HEADER
-# endif
+/* This is the normal way of making sure we have memcpy, memcmp and memset. */
+# if defined HAVE_STRING_H || defined STDC_HEADERS || defined _LIBC
+# include <string.h>
+# else
+# include <strings.h>
+# ifndef memcmp
+# define memcmp(s1, s2, n) bcmp (s1, s2, n)
# endif
-# endif
-
-/* 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
+# ifndef memcpy
+# define memcpy(d, s, n) (bcopy (s, d, n), (d))
# endif
# endif
if (done)
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)
if (ISALNUM (c))
BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH);
/* Clear the whole map. */
- bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH);
+ memset (b, 0, (1 << BYTEWIDTH) / BYTEWIDTH);
/* charset_not matches newline according to a syntax bit. */
if ((re_opcode_t) b[-2] == charset_not
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. */
analysis = analyse_first (bufp->buffer, bufp->buffer + bufp->used,
for received packets, so datagrams are broken too. */
#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
preprocessor symbol "COFF". */
#define COFF 1
#define HAVE_RANDOM 1
#undef HAVE_SYSINFO
#undef HAVE_LRAND48
-#define HAVE_BCOPY 1
-#define HAVE_BCMP 1
+#define HAVE_MEMCMP 1
+#define HAVE_MEMCPY 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MEMSET 1
#define HAVE_LOGB 1
#define HAVE_FREXP 1
#define HAVE_FMOD 1
#define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_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. */
#define MODE_LINE_BINARY_TEXT(buf) (NILP(buf->buffer_file_type) ? "T" : "B")
int *copy_from = (int *) alloca (window_size * sizeof (int));
/* 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)
copy_from[k] = -1;
old matrix. Lines not retained are empty. */
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. */
CHECK_MATRIX (current_matrix);
avg_length /= end - start;
threshold = avg_length / 4;
- bzero (lines, sizeof lines);
+ memset (lines, 0, sizeof lines);
/* Put new lines' hash codes in hash table. Ignore lines shorter
than the threshold. Thus, if the lines that are in common are
}
/* Store this character into the translated pattern. */
- bcopy (str, pat, charlen);
+ memcpy (pat, str, charlen);
pat += charlen;
base_pat += in_charlen;
len_byte -= in_charlen;
if (SYNTAX (c) == Sword)
{
- bcopy (SDATA (string) + i_byte_orig, o,
- i_byte - i_byte_orig);
+ memcpy (o, SDATA (string) + i_byte_orig, i_byte - i_byte_orig);
o += i_byte - i_byte_orig;
}
else if (i > 0 && SYNTAX (prev_c) == Sword && --word_count)
/* Now add to the end of SUBSTED. */
if (add_stuff)
{
- bcopy (add_stuff, substed + substed_len, add_len);
+ memcpy (substed + substed_len, add_stuff, add_len);
substed_len += add_len;
}
}
struct wav_header *header = (struct wav_header *) s->header;
if (s->header_size < sizeof *header
- || bcmp (s->header, "RIFF", 4) != 0)
+ || memcmp (s->header, "RIFF", 4) != 0)
return 0;
/* WAV files are in little-endian order. Convert the header
struct au_header *header = (struct au_header *) s->header;
if (s->header_size < sizeof *header
- || bcmp (s->header, ".snd", 4) != 0)
+ || memcmp (s->header, ".snd", 4) != 0)
return 0;
header->magic_number = be2hl (header->magic_number);
file = Qnil;
GCPRO2 (sound, file);
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));
- bzero (current_sound, sizeof (struct sound));
+ memset (current_sound, 0, sizeof (struct sound));
record_unwind_protect (sound_cleanup, Qnil);
current_sound->header = (char *) alloca (MAX_SOUND_HEADER_BYTES);
{
current_sound->data = attrs[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. */
&& (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE));
string_multibyte = SBYTES (string) > SCHARS (string);
- bzero (fastmap, sizeof fastmap);
+ memset (fastmap, 0, sizeof fastmap);
str = SDATA (string);
size_byte = SBYTES (string);
|| *class_end != ':' || class_end[1] != ']')
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;
cc = re_wctype (class_name);
unsigned char fastmap2[0400];
int range_start_byte, range_start_char;
- bcopy (fastmap2 + 0200, fastmap + 0200, 0200);
- bzero (fastmap + 0200, 0200);
+ memcpy (fastmap + 0200, fastmap2 + 0200, 0200);
+ memset (fastmap + 0200, 0, 0200);
/* We are sure that this loop stops. */
for (i = 0200; ! fastmap2[i]; i++);
c = BYTE8_TO_CHAR (i);
|| *class_end != ':' || class_end[1] != ']')
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;
cc = re_wctype (class_name);
if (! multibyte && n_char_ranges > 0)
{
- bzero (fastmap + 0200, 0200);
+ memset (fastmap + 0200, 0, 0200);
for (i = 0; i < n_char_ranges; i += 2)
{
int c1 = char_ranges[i];
multibyte = (!NILP (current_buffer->enable_multibyte_characters)
&& (XINT (lim) - PT != CHAR_TO_BYTE (XINT (lim)) - PT_BYTE));
- bzero (fastmap, sizeof fastmap);
+ memset (fastmap, 0, sizeof fastmap);
if (SBYTES (string) > SCHARS (string))
/* As this is very rare case (syntax spec is ASCII only), don't
dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil);
str = (unsigned char *) alloca (SCHARS (dir) + 2);
len = SCHARS (dir);
- bcopy (SDATA (dir), str, len);
+ memcpy (str, SDATA (dir), len);
if (str[len - 1] != '/') str[len++] = '/';
str[len] = 0;
xyzzy:
/* Retrieve the primary parameters - baud rate, character size, etcetera. */
#ifdef HAVE_TCATTR
/* 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)
return -1;
{
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. */
tcgetattr (fd, &new);
/* We cannot use memcmp on the whole structure here because under
}
#endif /* !HAVE_RMDIR */
+\f
+#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 */
\f
#ifndef HAVE_STRSIGNAL
char *
encode_terminal_src_size);
buf = encode_terminal_src + nbytes;
}
- bcopy (SDATA (string), buf, SBYTES (string));
+ memcpy (buf, SDATA (string), SBYTES (string));
buf += SBYTES (string);
nchars += SCHARS (string);
}
= (int *) xmalloc (sizeof (int)
+ 2 * max_frame_cols * sizeof (int));
- bzero (char_ins_del_vector, (sizeof (int)
- + 2 * max_frame_cols * sizeof (int)));
+ memset (char_ins_del_vector, 0,
+ (sizeof (int) + 2 * max_frame_cols * sizeof (int)));
if (f && (!tty->TS_ins_line && !tty->TS_del_line))
temp_it.what = IT_CHARACTER;
temp_it.len = 1;
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)
{
abort ();
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;
#else
tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info));
#endif
- bzero (tty, sizeof (struct tty_display_info));
+ memset (tty, 0, sizeof (struct tty_display_info));
tty->next = tty_list;
tty_list = tty;
xfree (tty->termcap_strings_buffer);
xfree (tty->termcap_term_buffer);
- bzero (tty, sizeof (struct tty_display_info));
+ memset (tty, 0, sizeof (struct tty_display_info));
xfree (tty);
}
char *realloc ();
#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
#include <unistd.h>
#endif
cut[last_p_param].len = r - cut[last_p_param].beg;
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;
}
}
else
{
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;
}
if (!(nread = read (fd, buf + bufp->full, bufp->size - bufp->full)))
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.
Note that reorder_modifiers assumes that the bits are in canonical
char *realloc ();
#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 */
#ifndef NULL
{
outlen = len + 40;
new = (char *) xmalloc (outlen);
- bcopy (outstring, new, offset);
+ memcpy (new, outstring, offset);
}
else
{
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.bsize = 0;
#ifdef _GOT
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_paddr = vaddr;
* 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)
newsyms = nhdr.aout.tsize + nhdr.aout.dsize;
int pagesize = getpagesize ();
char zeros[1 << 13];
- bzero (zeros, sizeof (zeros));
+ memset (zeros, 0, sizeof (zeros));
for (i = 0; ptr < end;)
{
char buf[UNEXEC_COPY_BUFSZ];
ssize_t bytes;
- bzero (buf, UNEXEC_COPY_BUFSZ);
+ memset (buf, 0, UNEXEC_COPY_BUFSZ);
if (lseek (outfd, dest, SEEK_SET) != dest)
return 0;
{
PAINTSTRUCT paintStruct;
RECT update_rect;
- bzero (&update_rect, sizeof (update_rect));
+ memset (&update_rect, 0, sizeof (update_rect));
f = x_window_to_frame (dpyinfo, hwnd);
if (f == 0)
f->output_method = output_w32;
f->output_data.w32 =
(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;
f->icon_name
f->output_method = output_w32;
f->output_data.w32 =
(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;
f->icon_name = Qnil;
specbind (Qinhibit_redisplay, Qt);
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.
I'm not sure about Windows 9x, so play it safe. */
if (w32_major_version > 4 && w32_major_version < 95)
/* On Windows, write permission is required to delete/move files. */
_chmod (path, 0666);
- bzero (tmp_path, sizeof (tmp_path));
+ memset (tmp_path, 0, sizeof (tmp_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.wFunc = FO_DELETE;
file_op.pFrom = tmp_path;
HDC dc;
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;
dc = get_frame_dc (f);
if (metrics)
{
- bzero (metrics, sizeof (struct font_metrics));
+ memset (metrics, 0, sizeof (struct font_metrics));
metrics->ascent = font->ascent;
metrics->descent = font->descent;
= xrealloc (w32_font->cached_metrics,
(block + 1)
* sizeof (struct w32_metric_cache *));
- bzero (w32_font->cached_metrics + w32_font->n_cache_blocks,
- ((block + 1 - w32_font->n_cache_blocks)
- * sizeof (struct w32_metric_cache *)));
+ memset (w32_font->cached_metrics + w32_font->n_cache_blocks, 0,
+ ((block + 1 - w32_font->n_cache_blocks)
+ * sizeof (struct w32_metric_cache *)));
w32_font->n_cache_blocks = block + 1;
}
{
w32_font->cached_metrics[block]
= xmalloc (CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache));
- bzero (w32_font->cached_metrics[block],
- CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache));
+ memset (w32_font->cached_metrics[block], 0,
+ CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache));
}
char_metric = w32_font->cached_metrics[block] + pos_in_block;
match_data.list = Qnil;
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);
/* If the charset is unrecognized, then we won't find a font, so don't
match_data.frame = frame;
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);
match_data.opentype_only = opentype_only;
if (!font)
return 0;
- bzero (&logfont, sizeof (logfont));
+ memset (&logfont, 0, sizeof (logfont));
fill_in_logfont (f, &logfont, font_entity);
/* Prefer truetype fonts, to avoid known problems with type1 fonts, and
{
metrics = (OUTLINETEXTMETRICW *) alloca (len);
if (GetOutlineTextMetricsW (dc, len, metrics))
- bcopy (&metrics->otmTextMetrics, &w32_font->metrics,
- sizeof (TEXTMETRICW));
+ memcpy (&w32_font->metrics, &metrics->otmTextMetrics,
+ sizeof (TEXTMETRICW));
else
metrics = NULL;
}
if (w32_font->glyph_idx)
options |= GGO_GLYPH_INDEX;
- bzero (&transform, sizeof (transform));
+ memset (&transform, 0, sizeof (transform));
transform.eM11.value = 1;
transform.eM22.value = 1;
HANDLE oldobj;
char buf[100];
- bzero (&cf, sizeof (cf));
- bzero (&lf, sizeof (lf));
+ memset (&cf, 0, sizeof (cf));
+ memset (&lf, 0, sizeof (lf));
cf.lStructSize = sizeof (cf);
cf.hwndOwner = FRAME_W32_WINDOW (f);
/* Save the frame's previous menu bar contents data. */
if (previous_menu_items_used)
- bcopy (XVECTOR (f->menu_bar_vector)->contents, previous_items,
- previous_menu_items_used * sizeof (Lisp_Object));
+ memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents,
+ previous_menu_items_used * sizeof (Lisp_Object));
/* Fill in menu_items with the current menu bar contents.
This can evaluate Lisp code. */
if (set_menu_item_info)
{
MENUITEMINFO info;
- bzero (&info, sizeof (info));
+ memset (&info, 0, sizeof (info));
info.cbSize = sizeof (info);
info.fMask = MIIM_DATA;
{
MENUITEMINFO info;
- bzero (&info, sizeof (info));
+ memset (&info, 0, sizeof (info));
info.cbSize = sizeof (info);
info.fMask = MIIM_DATA;
get_menu_item_info (menu, item, FALSE, &info);
for (i = 0; i < num; i++)
{
MENUITEMINFO info;
- bzero (&info, sizeof (info));
+ memset (&info, 0, sizeof (info));
info.cbSize = sizeof (info);
info.fMask = MIIM_DATA | MIIM_TYPE | MIIM_SUBMENU;
XCreateGC (void *ignore, Window window, unsigned long mask, XGCValues *xgcv)
{
XGCValues *gc = (XGCValues *) xmalloc (sizeof (XGCValues));
- bzero (gc, sizeof (XGCValues));
+ memset (gc, 0, sizeof (XGCValues));
XChangeGC (ignore, gc, mask, xgcv);
{
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. */
w32_display_name_list = Fcons (Fcons (display_name, Qnil),
HDC dc;
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. */
font_match_pattern.lfOutPrecision = OUT_OUTLINE_PRECIS;
if (nQueue)
{
- bcopy (&(lpHead->w32msg), lpmsg, sizeof (W32Msg));
+ memcpy (lpmsg, &lpHead->w32msg, sizeof (W32Msg));
{
int_msg * lpCur = lpHead;
if (!lpNew)
return (FALSE);
- bcopy (lpmsg, &(lpNew->w32msg), sizeof (W32Msg));
+ memcpy (&lpNew->w32msg, lpmsg, sizeof (W32Msg));
lpNew->lpNext = NULL;
enter_crit ();
if (!lpNew)
return (FALSE);
- bcopy (lpmsg, &(lpNew->w32msg), sizeof (W32Msg));
+ memcpy (&lpNew->w32msg, lpmsg, sizeof (W32Msg));
enter_crit ();
p->dedicated = Qnil;
p->window_parameters = Qnil;
p->pseudo_window_p = 0;
- bzero (&p->cursor, sizeof (p->cursor));
- bzero (&p->last_cursor, sizeof (p->last_cursor));
- bzero (&p->phys_cursor, sizeof (p->phys_cursor));
+ memset (&p->cursor, 0, sizeof (p->cursor));
+ memset (&p->last_cursor, 0, sizeof (p->last_cursor));
+ memset (&p->phys_cursor, 0, sizeof (p->phys_cursor));
p->desired_matrix = p->current_matrix = 0;
p->nrows_scale_factor = p->ncols_scale_factor = 1;
p->phys_cursor_type = -1;
p->total_lines = o->total_lines;
p->desired_matrix = p->current_matrix = 0;
p->vscroll = 0;
- bzero (&p->cursor, sizeof (p->cursor));
- bzero (&p->last_cursor, sizeof (p->last_cursor));
- bzero (&p->phys_cursor, sizeof (p->phys_cursor));
+ memset (&p->cursor, 0, sizeof (p->cursor));
+ memset (&p->last_cursor, 0, sizeof (p->last_cursor));
+ memset (&p->phys_cursor, 0, sizeof (p->phys_cursor));
p->phys_cursor_type = -1;
p->phys_cursor_width = -1;
p->must_be_updated_p = 0;
XSETFASTINT (w->window_end_pos, 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;
if (!(keep_margins_p && samebuf))
{ /* If we're not actually changing the buffer, don't reset hscroll and
p->parent = o->parent;
p->buffer = Qt;
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. */
}
/* Clear IT. */
- bzero (it, sizeof *it);
+ memset (it, 0, sizeof *it);
it->current.overlay_string_index = -1;
it->current.dpvec_index = -1;
it->base_face_id = remapped_base_face_id;
entries = \
(struct overlay_entry *) alloca (new_size \
* sizeof *entries); \
- bcopy (old, entries, size * sizeof *entries); \
+ memcpy (entries, old, size * sizeof *entries); \
size = new_size; \
} \
\
it->stop_charpos = -1;
/* 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.dpvec_index = -1;
xassert (charpos >= 0);
len = SBYTES (msg) + 1;
SAFE_ALLOCA (buffer, char *, len);
- bcopy (SDATA (msg), buffer, len);
+ memcpy (buffer, SDATA (msg), len);
message_dolog (buffer, len - 1, 1, 0);
SAFE_FREE ();
USE_SAFE_ALLOCA;
SAFE_ALLOCA (buffer, char *, nbytes);
- bcopy (SDATA (m), buffer, nbytes);
+ memcpy (buffer, SDATA (m), nbytes);
message_dolog (buffer, nbytes, 1, multibyte);
SAFE_FREE ();
}
higher level than this.) */
if (! STRINGP (f->name)
|| 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);
}
}
saved_pos = it->position;
it->what = IT_CHARACTER;
- bzero (&it->position, sizeof it->position);
+ memset (&it->position, 0, sizeof it->position);
it->object = make_number (0);
it->c = ' ';
it->len = 1;
(((it->ascent + it->descent)
* FONT_BASE (font)) / FONT_HEIGHT (font));
saved_pos = it->position;
- bzero (&it->position, sizeof it->position);
+ memset (&it->position, 0, sizeof it->position);
saved_avoid_cursor = it->avoid_cursor_p;
it->avoid_cursor_p = 1;
saved_face_id = it->face_id;
saved_pos = it->position;
it->what = IT_CHARACTER;
- bzero (&it->position, sizeof it->position);
+ memset (&it->position, 0, sizeof it->position);
it->object = make_number (0);
it->c = ' ';
it->len = 1;
eol_str = invalid_eol_type;
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;
}
XChar2b *char2b, struct window *w, struct glyph_row *row,
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->f = XFRAME (w->frame);
#ifdef HAVE_NTGUI
{
GC gc = xmalloc (sizeof (*gc));
if (gc)
- bcopy (xgcv, gc, sizeof (XGCValues));
+ memcpy (gc, xgcv, sizeof (XGCValues));
return gc;
}
lface = lface_from_face_name_no_resolve (f, face_name, signal_p);
if (! NILP (lface))
- bcopy (XVECTOR (lface)->contents, attrs,
- LFACE_VECTOR_SIZE * sizeof *attrs);
+ memcpy (attrs, XVECTOR (lface)->contents,
+ LFACE_VECTOR_SIZE * sizeof *attrs);
return !NILP (lface);
}
copy = Finternal_make_lisp_face (to, new_frame);
}
- bcopy (XVECTOR (lface)->contents, XVECTOR (copy)->contents,
- LFACE_VECTOR_SIZE * sizeof (Lisp_Object));
+ memcpy (XVECTOR (copy)->contents, XVECTOR (lface)->contents,
+ LFACE_VECTOR_SIZE * sizeof (Lisp_Object));
/* Changing a named face means that all realized faces depending on
that face are invalid. Since we cannot tell which realized faces
{
/* Ensure that the face vector is fully specified by merging
the previously-cached vector. */
- bcopy (oldface->lface, attrs, sizeof attrs);
+ memcpy (attrs, oldface->lface, sizeof attrs);
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);
if ((! UNSPECIFIEDP (gvec[LFACE_FAMILY_INDEX])
if (SBYTES (v1) != SBYTES (v2))
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_Symbol:
make_realized_face (Lisp_Object *attr)
{
struct face *face = (struct face *) xmalloc (sizeof *face);
- bzero (face, sizeof *face);
+ memset (face, 0, sizeof *face);
face->ascii_face = face;
- bcopy (attr, face->lface, sizeof face->lface);
+ memcpy (face->lface, attr, sizeof face->lface);
return face;
}
int size;
c = (struct face_cache *) xmalloc (sizeof *c);
- bzero (c, sizeof *c);
+ memset (c, 0, sizeof *c);
size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
c->buckets = (struct face **) xmalloc (size);
- bzero (c->buckets, size);
+ memset (c->buckets, 0, size);
c->size = 50;
c->faces_by_id = (struct face **) xmalloc (c->size * sizeof *c->faces_by_id);
c->f = f;
c->used = 0;
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
matrices as invalid because they will reference faces freed
if (! get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
return -1;
- bcopy (default_face->lface, attrs, sizeof attrs);
+ memcpy (attrs, default_face->lface, sizeof attrs);
merge_face_vectors (f, symbol_attrs, attrs, 0);
return lookup_face (f, attrs);
steps = eabs (steps);
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]);
new_face_id = face_id;
last_height = FONT_HEIGHT (face->font);
return 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);
font_clear_prop (attrs, FONT_SIZE_INDEX);
face_id = lookup_face (f, attrs);
if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
return -1;
- bcopy (default_face->lface, attrs, sizeof attrs);
+ memcpy (attrs, default_face->lface, sizeof attrs);
merge_face_vectors (f, symbol_attrs, attrs, 0);
return lookup_face (f, attrs);
}
Lisp_Object merged_attrs[LFACE_VECTOR_SIZE];
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);
int indices[DIM (font_sort_order)];
CHECK_LIST (order);
- bzero (indices, sizeof indices);
+ memset (indices, 0, sizeof indices);
i = 0;
for (list = order;
if (indices[i] == 0)
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);
}
/* Realize the face; it must be fully-specified now. */
xassert (lface_fully_specified_p (XVECTOR (lface)->contents));
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);
#ifdef HAVE_WINDOW_SYSTEM
{
Lisp_Object attrs[LFACE_VECTOR_SIZE];
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);
face_id = lookup_face (f, attrs);
}
return default_face->id;
/* 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. */
if (!NILP (prop))
return DEFAULT_FACE_ID;
/* 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. */
if (!NILP (prop))
return base_face->id;
/* 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. */
if (!NILP (prop))
}
/* 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))
{
{ /* There is no base font name, use the default. */
int len = strlen (base_fontname) + 2;
fontsetname = xmalloc (len);
- bzero (fontsetname, len);
+ memset (fontsetname, 0, len);
strcpy (fontsetname, base_fontname);
}
else
Use the specified font plus the default. */
int len = strlen (base_fontname) + strlen (xic_defaut_fontset) + 3;
fontsetname = xmalloc (len);
- bzero (fontsetname, len);
+ memset (fontsetname, 0, len);
strcpy (fontsetname, base_fontname);
strcat (fontsetname, sep);
strcat (fontsetname, xic_defaut_fontset);
int diff = (p2 - p3) - 2;
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) + 1] = '-';
strcpy (base + (p3 - base_fontname) + 2, p2);
/* Build the font spec that matches all charsets. */
len = p - base_fontname + strlen (allcs) + 1;
font_allcs = (char *) alloca (len);
- bzero (font_allcs, len);
- bcopy (base_fontname, font_allcs, p - base_fontname);
+ memset (font_allcs, 0, len);
+ memcpy (font_allcs, base_fontname, p - base_fontname);
strcat (font_allcs, allcs);
/* Build the font spec that matches all families and
add-styles. */
len = p - p1 + strlen (allcs) + strlen (allfamilies) + 1;
font_allfamilies = (char *) alloca (len);
- bzero (font_allfamilies, len);
+ memset (font_allfamilies, 0, len);
strcpy (font_allfamilies, allfamilies);
- bcopy (p1, font_allfamilies + strlen (allfamilies), p - p1);
+ memcpy (font_allfamilies + strlen (allfamilies), p1, p - p1);
strcat (font_allfamilies, allcs);
/* Build the font spec that matches all. */
len = p - p2 + strlen (allcs) + strlen (all) + strlen (allfamilies) + 1;
font_all = (char *) alloca (len);
- bzero (font_all, len);
+ memset (font_all, 0, len);
strcpy (font_all, allfamilies);
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);
/* Build the actual font set name. */
len = strlen (base_fontname) + strlen (font_allcs)
+ strlen (font_allfamilies) + strlen (font_all) + 5;
fontsetname = xmalloc (len);
- bzero (fontsetname, len);
+ memset (fontsetname, 0, len);
strcpy (fontsetname, base_fontname);
strcat (fontsetname, sep);
strcat (fontsetname, font_allcs);
f->output_method = output_x_window;
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;
FRAME_FONTSET (f) = -1;
f->output_data.x->scroll_bar_foreground_pixel = -1;
elements."
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
- 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
assume on that.
counts etc. */
f->output_method = output_x_window;
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;
FRAME_FONTSET (f) = -1;
f->output_data.x->scroll_bar_foreground_pixel = -1;
/* The XKB symbolic key names can be seen most easily in
the PS file generated by `xkbprint -label name
$DISPLAY'. */
- if (bcmp ("DELE", kb->names->keys[i].name, 4) == 0)
+ if (memcmp ("DELE", kb->names->keys[i].name, 4) == 0)
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;
}
val = assq_no_quit (QCname, AREF (spec, FONT_EXTRA_INDEX));
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)
return Qnil;
list = xfont_list_pattern (display, name, registry, script);
return Qnil;
}
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
return Qnil;
if (xfont_encode_coding_xlfd (name) < 0)
if (! *p1 || p1 == p0)
continue;
if (last_len == p1 - p0
- && bcmp (last_family, p0, last_len) == 0)
+ && memcmp (last_family, p0, last_len) == 0)
continue;
last_len = p1 - p0;
last_family = p0;
int i, first, x;
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++)
{
XChar2b char2b;
/* Save the frame's previous menu bar contents data. */
if (previous_menu_items_used)
- bcopy (XVECTOR (f->menu_bar_vector)->contents, previous_items,
- previous_menu_items_used * sizeof (Lisp_Object));
+ memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents,
+ previous_menu_items_used * sizeof (Lisp_Object));
/* Fill in menu_items with the current menu bar contents.
This can evaluate Lisp code. */
item_data
= (unsigned char *) alloca (maxwidth
+ SBYTES (descrip) + 1);
- bcopy (SDATA (item_name), item_data,
- SBYTES (item_name));
+ memcpy (item_data, SDATA (item_name), SBYTES (item_name));
for (j = SCHARS (item_name); j < maxwidth; j++)
item_data[j] = ' ';
- bcopy (SDATA (descrip), item_data + j,
- SBYTES (descrip));
+ memcpy (item_data + j, SDATA (descrip), SBYTES (descrip));
item_data[j + SBYTES (descrip)] = 0;
}
else
path = (char *) realloc (path, path_size);
}
- bcopy (next, path + path_len, next_len);
+ memcpy (path + path_len, next, next_len);
path_len += next_len;
p++;
path = (char *) realloc (path, path_size);
}
- bcopy (suffix, path + path_len, suffix_len);
+ memcpy (path + path_len, suffix, suffix_len);
path_len += suffix_len;
}
if (type == x_rm_string)
ret_value->addr = (char *) value.addr;
else
- bcopy (value.addr, ret_value->addr, ret_value->size);
+ memcpy (ret_value->addr, value.addr, ret_value->size);
return value.size;
}
This only happens for large requests which uses the incremental protocol. */
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);
x_decline_selection_request (event);
elements."
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
- 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
assume on that.
else
{
*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;
}
*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;
/* Use xfree, not XFree, because x_get_window_property
/* Check if smc_interact_CB was called and we shall generate a
SAVE_SESSION_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;
}
scroll_bar_windows = (struct window **) xrealloc (scroll_bar_windows,
nbytes);
- bzero (&scroll_bar_windows[i], nbytes - old_nbytes);
+ memset (&scroll_bar_windows[i], 0, nbytes - old_nbytes);
scroll_bar_windows_size = new_size;
}
if (f->output_data.x->saved_menu_event == 0) \
f->output_data.x->saved_menu_event \
= (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; \
XSETFRAME (inev.ie.frame_or_window, f); \
} \
this enables ComposeCharacter to work whether or
not it is combined with Meta. */
if (modifiers & dpyinfo->meta_mod_mask)
- bzero (&compose_status, sizeof (compose_status));
+ memset (&compose_status, 0, sizeof (compose_status));
#ifdef HAVE_X_I18N
if (FRAME_XIC (f))
if (compose_status.chars_matched > 0 && nbytes == 0)
break;
- bzero (&compose_status, sizeof (compose_status));
+ memset (&compose_status, 0, sizeof (compose_status));
orig_keysym = keysym;
/* Common for all keysym input events. */
by the rest of Emacs, we put it here. */
int tool_bar_p = 0;
- bzero (&compose_status, sizeof (compose_status));
+ memset (&compose_status, 0, sizeof (compose_status));
last_mouse_glyph_frame = 0;
last_user_time = event.xbutton.time;
if (x_error_message->string[0])
{
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 ();
error (format, string);
}
xim_inst->dpyinfo = dpyinfo;
len = strlen (resource_name);
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,
resource_name, EMACS_CLASS,
xim_instantiate_callback,
/* We have definitely succeeded. Record the new connection. */
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);