+2013-08-11 Paul Eggert <eggert@cs.ucla.edu>
+
+ Omit some unnecessary casts.
+ Many of these go back to the old pre-C89 days, when they may have
+ been needed, but we've been assuming C89 or later for a while now.
+ * alloc.c (live_string_p, live_cons_p, live_symbol_p)
+ (live_float_p, live_misc_p, live_vector_p):
+ * buffer.c (compare_overlays, cmp_for_strings, mmap_find)
+ (mmap_alloc, alloc_buffer_text, enlarge_buffer_text)
+ (defvar_per_buffer):
+ * callint.c (Fcall_interactively):
+ * doc.c (Fsubstitute_command_keys):
+ * filelock.c (get_boot_time):
+ * frame.c (xrdb_get_resource):
+ * gtkutil.c (hierarchy_ch_cb, qttip_cb, style_changed_cb)
+ (delete_cb, xg_dialog_response_cb, xg_maybe_add_timer)
+ (xg_get_file_name_from_selector, menuitem_destroy_callback)
+ (menuitem_highlight_callback, menu_destroy_callback)
+ (xg_update_menu_item, xg_modify_menubar_widgets, menubar_map_cb)
+ (xg_tool_bar_callback, xg_get_tool_bar_widgets)
+ (xg_tool_bar_detach_callback, xg_tool_bar_attach_callback)
+ (xg_tool_bar_help_callback, tb_size_cb):
+ * image.c (xpm_alloc_color, png_read_from_memory)
+ (png_read_from_file, png_load_body, our_memory_skip_input_data)
+ (jpeg_memory_src, jpeg_file_src, imagemagick_load_image)
+ (syms_of_image):
+ * keymap.c (describe_map):
+ * nsfns.m (Fns_display_monitor_attributes_list):
+ * nsmenu.m (process_dialog:):
+ * nsterm.m (hold_event):
+ * process.c (wait_reading_process_output):
+ * regex.c (REGEX_REALLOCATE, re_set_registers, re_exec, regexec):
+ * scroll.c (do_direct_scrolling, scrolling_1):
+ * termcap.c (tgetent):
+ * window.c (check_window_containing, add_window_to_list)
+ (freeze_window_starts):
+ * xdisp.c (compare_overlay_entries, vmessage):
+ * xfns.c (x_window, x_get_monitor_attributes_xinerama)
+ (x_get_monitor_attributes_xrandr)
+ (Fx_display_monitor_attributes_list, x_display_info_for_name)
+ (Fx_open_connection, file_dialog_cb, file_dialog_unmap_cb):
+ * xfont.c (xfont_match, xfont_open):
+ * xmenu.c (x_menu_wait_for_event, menu_highlight_callback)
+ (menubar_selection_callback, menu_position_func)
+ (popup_selection_callback, create_and_show_popup_menu)
+ (dialog_selection_callback, create_and_show_dialog):
+ * xrdb.c (x_get_string_resource):
+ (main) [TESTRM]:
+ * xsmfns.c (x_session_check_input):
+ * xterm.c (x_draw_glyphless_glyph_string_foreground)
+ (xm_scroll_callback, xg_scroll_callback, xg_end_scroll_callback)
+ (xaw_jump_callback, xaw_scroll_callback):
+ Omit unnecessary casts.
+
2013-08-10 Paul Eggert <eggert@cs.ucla.edu>
Minor string-length refactoring.
{
if (m->type == MEM_TYPE_STRING)
{
- struct string_block *b = (struct string_block *) m->start;
+ struct string_block *b = m->start;
ptrdiff_t offset = (char *) p - (char *) &b->strings[0];
/* P must point to the start of a Lisp_String structure, and it
{
if (m->type == MEM_TYPE_CONS)
{
- struct cons_block *b = (struct cons_block *) m->start;
+ struct cons_block *b = m->start;
ptrdiff_t offset = (char *) p - (char *) &b->conses[0];
/* P must point to the start of a Lisp_Cons, not be
{
if (m->type == MEM_TYPE_SYMBOL)
{
- struct symbol_block *b = (struct symbol_block *) m->start;
+ struct symbol_block *b = m->start;
ptrdiff_t offset = (char *) p - (char *) &b->symbols[0];
/* P must point to the start of a Lisp_Symbol, not be
{
if (m->type == MEM_TYPE_FLOAT)
{
- struct float_block *b = (struct float_block *) m->start;
+ struct float_block *b = m->start;
ptrdiff_t offset = (char *) p - (char *) &b->floats[0];
/* P must point to the start of a Lisp_Float and not be
{
if (m->type == MEM_TYPE_MISC)
{
- struct marker_block *b = (struct marker_block *) m->start;
+ struct marker_block *b = m->start;
ptrdiff_t offset = (char *) p - (char *) &b->markers[0];
/* P must point to the start of a Lisp_Misc, not be
if (m->type == MEM_TYPE_VECTOR_BLOCK)
{
/* This memory node corresponds to a vector block. */
- struct vector_block *block = (struct vector_block *) m->start;
+ struct vector_block *block = m->start;
struct Lisp_Vector *vector = (struct Lisp_Vector *) block->data;
/* P is in the block's allocation range. Scan the block
static int
compare_overlays (const void *v1, const void *v2)
{
- const struct sortvec *s1 = (const struct sortvec *) v1;
- const struct sortvec *s2 = (const struct sortvec *) v2;
+ const struct sortvec *s1 = v1;
+ const struct sortvec *s2 = v2;
if (s1->priority != s2->priority)
return s1->priority < s2->priority ? -1 : 1;
if (s1->beg != s2->beg)
static int
cmp_for_strings (const void *as1, const void *as2)
{
- struct sortstr *s1 = (struct sortstr *)as1;
- struct sortstr *s2 = (struct sortstr *)as2;
+ struct sortstr const *s1 = as1;
+ struct sortstr const *s2 = as2;
if (s1->size != s2->size)
return s2->size < s1->size ? -1 : 1;
if (s1->priority != s2->priority)
mmap_find (void *start, void *end)
{
struct mmap_region *r;
- char *s = (char *) start, *e = (char *) end;
+ char *s = start, *e = end;
for (r = mmap_regions; r; r = r->next)
{
}
else
{
- struct mmap_region *r = (struct mmap_region *) p;
+ struct mmap_region *r = p;
r->nbytes_specified = nbytes;
r->nbytes_mapped = map;
memory_full (nbytes);
}
- b->text->beg = (unsigned char *) p;
+ b->text->beg = p;
unblock_input ();
}
memory_full (nbytes);
}
- BUF_BEG_ADDR (b) = (unsigned char *) p;
+ BUF_BEG_ADDR (b) = p;
unblock_input ();
}
bo_fwd->predicate = predicate;
sym->declared_special = 1;
sym->redirect = SYMBOL_FORWARDED;
- {
- /* I tried to do the job without a cast, but it seems impossible.
- union Lisp_Fwd *fwd; &(fwd->u_buffer_objfwd) = bo_fwd; */
- SET_SYMBOL_FWD (sym, (union Lisp_Fwd *)bo_fwd);
- }
+ SET_SYMBOL_FWD (sym, (union Lisp_Fwd *) bo_fwd);
XSETSYMBOL (PER_BUFFER_SYMBOL (offset), sym);
if (PER_BUFFER_IDX (offset) == 0)
make_number (SCHARS (callint_message)),
Qface, Qminibuffer_prompt, callint_message);
args[i] = Fread_char (callint_message, Qnil, Qnil);
- message1_nolog ((char *) 0);
+ message1_nolog (0);
/* Passing args[i] directly stimulates compiler bug. */
teml = args[i];
/* See bug#8479. */
If this one's not active, get nil. */
earlier_maps = Fcdr (Fmemq (tem, Freverse (active_maps)));
describe_map_tree (tem, 1, Fnreverse (earlier_maps),
- Qnil, (char *)0, 1, 0, 0, 1);
+ Qnil, 0, 1, 0, 0, 1);
}
tem = Fbuffer_string ();
Ferase_buffer ();
since utmp is typically much smaller than wtmp.
Passing a null pointer causes get_boot_time_1
to inspect the default file, namely utmp. */
- get_boot_time_1 ((char *) 0, 0);
+ get_boot_time_1 (0, 0);
if (boot_time)
return boot_time;
value = x_get_string_resource (rdb, name_key, class_key);
- if (value != (char *) 0 && *value)
+ if (value && *value)
return build_string (value);
else
return Qnil;
GtkWidget *previous_toplevel,
gpointer user_data)
{
- struct frame *f = (struct frame *) user_data;
+ struct frame *f = user_data;
struct x_output *x = f->output_data.x;
GtkWidget *top = gtk_widget_get_toplevel (x->ttip_lbl);
GtkTooltip *tooltip,
gpointer user_data)
{
- struct frame *f = (struct frame *) user_data;
+ struct frame *f = user_data;
struct x_output *x = f->output_data.x;
if (x->ttip_widget == NULL)
{
gpointer user_data)
{
struct input_event event;
- GdkDisplay *gdpy = (GdkDisplay *) user_data;
+ GdkDisplay *gdpy = user_data;
const char *display_name = gdk_display_get_name (gdpy);
Display *dpy = GDK_DISPLAY_XDISPLAY (gdpy);
#ifdef HAVE_GTK3
/* The event doesn't arrive in the normal event loop. Send event
here. */
- struct frame *f = (struct frame *) user_data;
+ struct frame *f = user_data;
struct input_event ie;
EVENT_INIT (ie);
gint response,
gpointer user_data)
{
- struct xg_dialog_data *dd = (struct xg_dialog_data *)user_data;
+ struct xg_dialog_data *dd = user_data;
dd->response = response;
g_main_loop_quit (dd->loop);
}
static gboolean
xg_maybe_add_timer (gpointer data)
{
- struct xg_dialog_data *dd = (struct xg_dialog_data *) data;
+ struct xg_dialog_data *dd = data;
EMACS_TIME next_time = timer_check ();
dd->timerid = 0;
xg_get_file_name_from_selector (GtkWidget *w)
{
GtkFileSelection *filesel = GTK_FILE_SELECTION (w);
- return xstrdup ((char*) gtk_file_selection_get_filename (filesel));
+ return xstrdup (gtk_file_selection_get_filename (filesel));
}
/* Create a file selection dialog.
{
if (client_data)
{
- xg_menu_item_cb_data *data = (xg_menu_item_cb_data*) client_data;
+ xg_menu_item_cb_data *data = client_data;
xg_list_remove (&xg_menu_item_cb_list, &data->ptrs);
xfree (data);
}
ev.crossing = *event;
subwidget = gtk_get_event_widget (&ev);
- data = (xg_menu_item_cb_data *) g_object_get_data (G_OBJECT (subwidget),
- XG_ITEM_DATA);
+ data = g_object_get_data (G_OBJECT (subwidget), XG_ITEM_DATA);
if (data)
{
if (! NILP (data->help) && data->cl_data->highlight_cb)
static void
menu_destroy_callback (GtkWidget *w, gpointer client_data)
{
- unref_cl_data ((xg_menu_cb_data*) client_data);
+ unref_cl_data (client_data);
}
/* Make a GTK widget that contains both UTF8_LABEL and UTF8_KEY (both
else if (val->enabled && ! gtk_widget_get_sensitive (w))
gtk_widget_set_sensitive (w, TRUE);
- cb_data = (xg_menu_item_cb_data*) g_object_get_data (G_OBJECT (w),
- XG_ITEM_DATA);
+ cb_data = g_object_get_data (G_OBJECT (w), XG_ITEM_DATA);
if (cb_data)
{
cb_data->call_data = val->call_data;
if (! list) return;
- cl_data = (xg_menu_cb_data*) g_object_get_data (G_OBJECT (menubar),
- XG_FRAME_DATA);
+ cl_data = g_object_get_data (G_OBJECT (menubar), XG_FRAME_DATA);
xg_update_menubar (menubar, f, &list, list, 0, val->contents,
select_cb, deactivate_cb, highlight_cb, cl_data);
menubar_map_cb (GtkWidget *w, gpointer user_data)
{
GtkRequisition req;
- struct frame *f = (struct frame *) user_data;
+ struct frame *f = user_data;
gtk_widget_get_preferred_size (w, NULL, &req);
if (FRAME_MENUBAR_HEIGHT (f) != req.height)
{
gpointer gmod = g_object_get_data (G_OBJECT (w), XG_TOOL_BAR_LAST_MODIFIER);
intptr_t mod = (intptr_t) gmod;
- struct frame *f = (struct frame *) g_object_get_data (G_OBJECT (w),
- XG_FRAME_DATA);
+ struct frame *f = g_object_get_data (G_OBJECT (w), XG_FRAME_DATA);
Lisp_Object key, frame;
struct input_event event;
EVENT_INIT (event);
xg_get_tool_bar_widgets (GtkWidget *vb, GtkWidget **wimage)
{
GList *clist = gtk_container_get_children (GTK_CONTAINER (vb));
- GtkWidget *c1 = (GtkWidget *) clist->data;
- GtkWidget *c2 = clist->next ? (GtkWidget *) clist->next->data : NULL;
+ GtkWidget *c1 = clist->data;
+ GtkWidget *c2 = clist->next ? clist->next->data : NULL;
*wimage = GTK_IS_IMAGE (c1) ? c1 : c2;
g_list_free (clist);
GtkWidget *w,
gpointer client_data)
{
- struct frame *f = (struct frame *) client_data;
+ struct frame *f = client_data;
g_object_set (G_OBJECT (w), "show-arrow", !x_gtk_whole_detached_tool_bar,
NULL);
GtkWidget *w,
gpointer client_data)
{
- struct frame *f = (struct frame *) client_data;
+ struct frame *f = client_data;
g_object_set (G_OBJECT (w), "show-arrow", TRUE, NULL);
if (f)
gpointer client_data)
{
intptr_t idx = (intptr_t) client_data;
- struct frame *f = (struct frame *) g_object_get_data (G_OBJECT (w),
- XG_FRAME_DATA);
+ struct frame *f = g_object_get_data (G_OBJECT (w), XG_FRAME_DATA);
Lisp_Object help, frame;
if (! f || ! f->n_tool_bar_items || NILP (f->tool_bar_items))
/* When tool bar is created it has one preferred size. But when size is
allocated between widgets, it may get another. So we must update
size hints if tool bar size changes. Seen on Fedora 18 at least. */
- struct frame *f = (struct frame *) user_data;
+ struct frame *f = user_data;
if (xg_update_tool_bar_sizes (f))
x_wm_set_size_hint (f, 0, 0);
}
xpm_alloc_color (Display *dpy, Colormap cmap, char *color_name, XColor *color,
void *closure)
{
- return xpm_lookup_color ((struct frame *) closure, color_name, color);
+ return xpm_lookup_color (closure, color_name, color);
}
static void
png_read_from_memory (png_structp png_ptr, png_bytep data, png_size_t length)
{
- struct png_memory_storage *tbr
- = (struct png_memory_storage *) fn_png_get_io_ptr (png_ptr);
+ struct png_memory_storage *tbr = fn_png_get_io_ptr (png_ptr);
if (length > tbr->len - tbr->index)
fn_png_error (png_ptr, "Read error");
static void
png_read_from_file (png_structp png_ptr, png_bytep data, png_size_t length)
{
- FILE *fp = (FILE *) fn_png_get_io_ptr (png_ptr);
+ FILE *fp = fn_png_get_io_ptr (png_ptr);
if (fread (data, 1, length, fp) < length)
fn_png_error (png_ptr, "Read error");
/* Read image info. */
if (!NILP (specified_data))
- fn_png_set_read_fn (png_ptr, (void *) &tbr, png_read_from_memory);
+ fn_png_set_read_fn (png_ptr, &tbr, png_read_from_memory);
else
- fn_png_set_read_fn (png_ptr, (void *) fp, png_read_from_file);
+ fn_png_set_read_fn (png_ptr, fp, png_read_from_file);
fn_png_set_sig_bytes (png_ptr, sizeof sig);
fn_png_read_info (png_ptr, info_ptr);
static void
our_memory_skip_input_data (j_decompress_ptr cinfo, long int num_bytes)
{
- struct jpeg_source_mgr *src = (struct jpeg_source_mgr *) cinfo->src;
+ struct jpeg_source_mgr *src = cinfo->src;
if (src)
{
static void
jpeg_memory_src (j_decompress_ptr cinfo, JOCTET *data, ptrdiff_t len)
{
- struct jpeg_source_mgr *src;
+ struct jpeg_source_mgr *src = cinfo->src;
- if (cinfo->src == NULL)
+ if (! src)
{
/* First time for this JPEG object? */
- cinfo->src = (struct jpeg_source_mgr *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
- sizeof (struct jpeg_source_mgr));
- src = (struct jpeg_source_mgr *) cinfo->src;
+ src = cinfo->mem->alloc_small ((j_common_ptr) cinfo,
+ JPOOL_PERMANENT, sizeof *src);
+ cinfo->src = src;
src->next_input_byte = data;
}
- src = (struct jpeg_source_mgr *) cinfo->src;
src->init_source = our_common_init_source;
src->fill_input_buffer = our_memory_fill_input_buffer;
src->skip_input_data = our_memory_skip_input_data;
static void
jpeg_file_src (j_decompress_ptr cinfo, FILE *fp)
{
- struct jpeg_stdio_mgr *src;
+ struct jpeg_stdio_mgr *src = (struct jpeg_stdio_mgr *) cinfo->src;
- if (cinfo->src != NULL)
- src = (struct jpeg_stdio_mgr *) cinfo->src;
- else
+ if (! src)
{
/* First time for this JPEG object? */
- cinfo->src = (struct jpeg_source_mgr *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
- sizeof (struct jpeg_stdio_mgr));
- src = (struct jpeg_stdio_mgr *) cinfo->src;
- src->buffer = (JOCTET *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
- JPEG_STDIO_BUFFER_SIZE);
+ src = cinfo->mem->alloc_small ((j_common_ptr) cinfo,
+ JPOOL_PERMANENT, sizeof *src);
+ cinfo->src = (struct jpeg_source_mgr *) src;
+ src->buffer = cinfo->mem->alloc_small ((j_common_ptr) cinfo,
+ JPOOL_PERMANENT,
+ JPEG_STDIO_BUFFER_SIZE);
}
src->file = fp;
/* Copy pixels from the imagemagick image structure to the x image map. */
iterator = NewPixelIterator (image_wand);
- if (iterator == (PixelIterator *) NULL)
+ if (! iterator)
{
#ifdef COLOR_TABLE_SUPPORT
free_color_table ();
for (y = 0; y < image_height; y++)
{
pixels = PixelGetNextIteratorRow (iterator, &width);
- if (pixels == (PixelWand **) NULL)
+ if (! pixels)
break;
for (x = 0; x < (long) width; x++)
{
DEFVAR_LISP ("x-bitmap-file-path", Vx_bitmap_file_path,
doc: /* List of directories to search for window system bitmap files. */);
- Vx_bitmap_file_path = decode_env_path ((char *) 0, PATH_BITMAPS);
+ Vx_bitmap_file_path = decode_env_path (0, PATH_BITMAPS);
DEFVAR_LISP ("image-cache-eviction-delay", Vimage_cache_eviction_delay,
doc: /* Maximum time after which images are removed from the cache.
for (tail = map; CONSP (tail); tail = XCDR (tail))
length_needed++;
- vect = ((struct describe_map_elt *)
- alloca (sizeof (struct describe_map_elt) * length_needed));
+ vect = alloca (length_needed * sizeof *vect);
for (tail = map; CONSP (tail); tail = XCDR (tail))
{
if (n_monitors == 0)
return Qnil;
- monitors = (struct MonitorInfo *) xzalloc (n_monitors * sizeof (*monitors));
+ monitors = xzalloc (n_monitors * sizeof *monitors);
for (i = 0; i < [screens count]; ++i)
{
}
if (buttons > 0)
- button_values = (Lisp_Object *) xmalloc (buttons * sizeof (*button_values));
+ button_values = xmalloc (buttons * sizeof *button_values);
for (; XTYPE (list) == Lisp_Cons; list = XCDR (list))
{
{
if (hold_event_q.cap == 0) hold_event_q.cap = 10;
else hold_event_q.cap *= 2;
- hold_event_q.q = (struct input_event *)
- xrealloc (hold_event_q.q, hold_event_q.cap * sizeof (*hold_event_q.q));
+ hold_event_q.q =
+ xrealloc (hold_event_q.q, hold_event_q.cap * sizeof *hold_event_q.q);
}
hold_event_q.q[hold_event_q.nr++] = *event;
#endif
(max (max_process_desc, max_input_desc) + 1,
&Available,
- (check_write ? &Writeok : (SELECT_TYPE *)0),
+ (check_write ? &Writeok : 0),
NULL, &timeout, NULL);
#ifdef HAVE_GNUTLS
/* Assumes a `char *destination' variable. */
# define REGEX_REALLOCATE(source, osize, nsize) \
- (destination = (char *) alloca (nsize), \
+ (destination = alloca (nsize), \
memcpy (destination, source, osize))
/* No need to do anything to free, after alloca. */
{
bufp->regs_allocated = REGS_UNALLOCATED;
regs->num_regs = 0;
- regs->start = regs->end = (regoff_t *) 0;
+ regs->start = regs->end = 0;
}
}
WEAK_ALIAS (__re_set_registers, re_set_registers)
re_exec (const char *s)
{
const size_t len = strlen (s);
- return (re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0)
- >= 0);
+ return re_search (&re_comp_buf, s, len, 0, len, 0) >= 0;
}
#endif /* _REGEX_RE_COMP */
\f
/* Perform the searching operation. */
ret = re_search (&private_preg, string, len,
/* start: */ 0, /* range: */ len,
- want_reg_info ? ®s : (struct re_registers *) 0);
+ want_reg_info ? ®s : 0);
/* Copy the register information to the POSIX structure. */
if (want_reg_info)
/* A queue of deletions and insertions to be performed. */
struct alt_queue { int count, pos, window; };
- struct alt_queue *queue_start = (struct alt_queue *)
- alloca (window_size * sizeof *queue_start);
+ struct alt_queue *queue_start = alloca (window_size * sizeof *queue_start);
struct alt_queue *queue = queue_start;
/* True if a terminal window has been set with set_terminal_window. */
int unchanged_at_bottom, int *draw_cost, int *old_draw_cost,
int *old_hash, int *new_hash, int free_at_end)
{
- struct matrix_elt *matrix;
- matrix = ((struct matrix_elt *)
- alloca ((window_size + 1) * (window_size + 1) * sizeof *matrix));
+ struct matrix_elt *matrix
+ = alloca ((window_size + 1) * (window_size + 1) * sizeof *matrix);
if (FRAME_SCROLL_REGION_OK (frame))
{
if (termcap_name && !filep && !strcmp (name, getenv ("TERM")))
{
- indirect = tgetst1 (find_capability (termcap_name, "tc"), (char **) 0);
+ indirect = tgetst1 (find_capability (termcap_name, "tc"), 0);
if (!indirect)
{
if (!bp)
/* Does this entry refer to another terminal type's entry?
If something is found, copy it into heap and null-terminate it. */
tc_search_point = find_capability (tc_search_point, "tc");
- term = tgetst1 (tc_search_point, (char **) 0);
+ term = tgetst1 (tc_search_point, 0);
}
emacs_close (fd);
static int
check_window_containing (struct window *w, void *user_data)
{
- struct check_window_data *cw = (struct check_window_data *) user_data;
+ struct check_window_data *cw = user_data;
enum window_part found;
int continue_p = 1;
static int
add_window_to_list (struct window *w, void *user_data)
{
- Lisp_Object *list = (Lisp_Object *) user_data;
+ Lisp_Object *list = user_data;
Lisp_Object window;
XSETWINDOW (window, w);
*list = Fcons (window, *list);
void
freeze_window_starts (struct frame *f, bool freeze_p)
{
- foreach_window (f, freeze_window_start, (void *) (freeze_p ? f : 0));
+ foreach_window (f, freeze_window_start, freeze_p ? f : 0);
}
\f
static int
compare_overlay_entries (const void *e1, const void *e2)
{
- struct overlay_entry *entry1 = (struct overlay_entry *) e1;
- struct overlay_entry *entry2 = (struct overlay_entry *) e2;
+ struct overlay_entry const *entry1 = e1;
+ struct overlay_entry const *entry2 = e2;
int result;
if (entry1->after_string_p != entry2->after_string_p)
ptrdiff_t maxsize = FRAME_MESSAGE_BUF_SIZE (f);
char *message_buf = alloca (maxsize + 1);
- len = doprnt (message_buf, maxsize, m, (char *)0, ap);
+ len = doprnt (message_buf, maxsize, m, 0, ap);
message3 (make_string (message_buf, len));
}
/* maybe_set_screen_title_format (shell_widget); */
pane_widget = lw_create_widget ("main", "pane", widget_id_tick++,
- (widget_value *) NULL,
- shell_widget, False,
- (lw_callback) NULL,
- (lw_callback) NULL,
- (lw_callback) NULL,
- (lw_callback) NULL);
+ NULL, shell_widget, False,
+ NULL, NULL, NULL, NULL);
ac = 0;
XtSetArg (al[ac], XtNvisual, FRAME_X_VISUAL (f)); ac++;
*/
XChangeProperty (XtDisplay (frame_widget), XtWindow (frame_widget),
FRAME_X_DISPLAY_INFO (f)->Xatom_wm_protocols,
- XA_ATOM, 32, PropModeAppend,
- (unsigned char*) NULL, 0);
+ XA_ATOM, 32, PropModeAppend, NULL, 0);
/* Make all the standard events reach the Emacs frame. */
attributes.event_mask = STANDARD_EVENT_SET;
/ x_display_pixel_width (dpyinfo));
mm_height_per_pixel = ((double) HeightMMOfScreen (dpyinfo->screen)
/ x_display_pixel_height (dpyinfo));
- monitors = (struct MonitorInfo *) xzalloc (n_monitors * sizeof (*monitors));
+ monitors = xzalloc (n_monitors * sizeof *monitors);
for (i = 0; i < n_monitors; ++i)
{
struct MonitorInfo *mi = &monitors[i];
return Qnil;
}
n_monitors = resources->noutput;
- monitors = (struct MonitorInfo *) xzalloc (n_monitors * sizeof (*monitors));
+ monitors = xzalloc (n_monitors * sizeof *monitors);
#ifdef HAVE_XRRGETOUTPUTPRIMARY
pxid = XRRGetOutputPrimary (dpy, dpyinfo->root_window);
#endif
n_monitors = gdk_screen_get_n_monitors (gscreen);
monitor_frames = Fmake_vector (make_number (n_monitors), Qnil);
- monitors = (struct MonitorInfo *) xzalloc (n_monitors * sizeof (*monitors));
+ monitors = xzalloc (n_monitors * sizeof *monitors);
FOR_EACH_FRAME (rest, frame)
{
validate_x_resource_name ();
- dpyinfo = x_term_init (name, (char *)0,
- SSDATA (Vx_resource_name));
+ dpyinfo = x_term_init (name, 0, SSDATA (Vx_resource_name));
if (dpyinfo == 0)
error ("Cannot connect to X server %s", SDATA (name));
error ("Not using X Windows"); /* That doesn't stop us anymore. */
#endif
- if (! NILP (xrm_string))
- xrm_option = SSDATA (xrm_string);
- else
- xrm_option = (char *) 0;
+ xrm_option = NILP (xrm_string) ? 0 : SSDATA (xrm_string);
validate_x_resource_name ();
static void
file_dialog_cb (Widget widget, XtPointer client_data, XtPointer call_data)
{
- int *result = (int *) client_data;
- XmAnyCallbackStruct *cb = (XmAnyCallbackStruct *) call_data;
+ int *result = client_data;
+ XmAnyCallbackStruct *cb = call_data;
*result = cb->reason;
}
static void
file_dialog_unmap_cb (Widget widget, XtPointer client_data, XtPointer call_data)
{
- int *result = (int *) client_data;
+ int *result = client_data;
*result = XmCR_CANCEL;
}
{
if (XGetFontProperty (xfont, XA_FONT, &value))
{
- char *s;
-
- s = (char *) XGetAtomName (display, (Atom) value);
+ char *s = XGetAtomName (display, (Atom) value);
/* If DXPC (a Differential X Protocol Compressor)
Ver.3.7 is running, XGetAtomName will return null
char *p0, *p;
int dashes = 0;
- p0 = p = (char *) XGetAtomName (FRAME_X_DISPLAY (f), (Atom) value);
+ p0 = p = XGetAtomName (FRAME_X_DISPLAY (f), (Atom) value);
/* Count the number of dashes in the "full name".
If it is too few, this isn't really the font's full name,
so don't use it.
#elif defined USE_GTK
! gtk_events_pending ()
#else
- ! XPending ((Display*) data)
+ ! XPending (data)
#endif
)
{
xg_menu_item_cb_data *cb_data;
Lisp_Object help;
- cb_data = (xg_menu_item_cb_data*) g_object_get_data (G_OBJECT (widget),
- XG_ITEM_DATA);
+ cb_data = g_object_get_data (G_OBJECT (widget), XG_ITEM_DATA);
if (! cb_data) return;
help = call_data ? cb_data->help : Qnil;
static void
menu_highlight_callback (Widget widget, LWLIB_ID id, void *call_data)
{
- struct frame *f;
- Lisp_Object help;
-
- widget_value *wv = (widget_value *) call_data;
-
- help = wv ? wv->help : Qnil;
+ widget_value *wv = call_data;
+ Lisp_Object help = wv ? wv->help : Qnil;
/* Determine the frame for the help event. */
- f = menubar_id_to_frame (id);
+ struct frame *f = menubar_id_to_frame (id);
show_help_event (f, widget, help);
}
static void
menubar_selection_callback (GtkWidget *widget, gpointer client_data)
{
- xg_menu_item_cb_data *cb_data = (xg_menu_item_cb_data*) client_data;
+ xg_menu_item_cb_data *cb_data = client_data;
if (xg_crazy_callback_abort)
return;
static void
menu_position_func (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data)
{
- struct next_popup_x_y* data = (struct next_popup_x_y*)user_data;
+ struct next_popup_x_y *data = user_data;
GtkRequisition req;
struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (data->f);
int disp_width = x_display_pixel_width (dpyinfo);
static void
popup_selection_callback (GtkWidget *widget, gpointer client_data)
{
- xg_menu_item_cb_data *cb_data = (xg_menu_item_cb_data*) client_data;
+ xg_menu_item_cb_data *cb_data = client_data;
if (xg_crazy_callback_abort) return;
- if (cb_data) menu_item_selection = (Lisp_Object *) cb_data->call_data;
+ if (cb_data) menu_item_selection = cb_data->call_data;
}
static void
static void
popup_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
{
- menu_item_selection = (Lisp_Object *) client_data;
+ menu_item_selection = client_data;
}
/* ARG is the LWLIB ID of the dialog box, represented
make_number (menu_id & ~(-1 << (fact)))));
/* Process events that apply to the menu. */
- popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id, 1);
+ popup_get_selection (0, FRAME_X_DISPLAY_INFO (f), menu_id, 1);
unbind_to (specpdl_count, Qnil);
}
/* Treat the pointer as an integer. There's no problem
as long as pointers have enough bits to hold small integers. */
if ((intptr_t) client_data != -1)
- menu_item_selection = (Lisp_Object *) client_data;
+ menu_item_selection = client_data;
popup_activated_flag = 0;
}
/* Treat the pointer as an integer. There's no problem
as long as pointers have enough bits to hold small integers. */
if ((intptr_t) client_data != -1)
- menu_item_selection = (Lisp_Object *) client_data;
+ menu_item_selection = client_data;
block_input ();
lw_destroy_all_widgets (id);
Fcons (make_number (dialog_id >> (fact)),
make_number (dialog_id & ~(-1 << (fact)))));
- popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f),
- dialog_id, 1);
+ popup_get_selection (0, FRAME_X_DISPLAY_INFO (f), dialog_id, 1);
unbind_to (count, Qnil);
}
if (x_get_resource (rdb, name, class, x_rm_string, &value))
return (char *) value.addr;
- return (char *) 0;
+ return 0;
}
\f
/* Stand-alone test facilities. */
displayname = "localhost:0.0";
lp = member ("-xrm", arg_list);
- if (! NIL (lp))
- resource_string = car (cdr (lp));
- else
- resource_string = (char *) 0;
+ resource_string = NIL (lp) ? 0 : car (cdr (lp));
lp = member ("-c", arg_list);
if (! NIL (lp))
will be called. */
emacs_event.kind = NO_EVENT;
- ret = IceProcessMessages (SmcGetIceConnection (smc_conn),
- (IceReplyWaitInfo *)0, (Bool *)0);
+ ret = IceProcessMessages (SmcGetIceConnection (smc_conn), 0, 0);
if (ret != IceProcessMessagesSuccess)
{
/* Either IO error or Connection closed. */
}
else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEX_CODE)
{
- sprintf ((char *) buf, "%0*X",
+ sprintf (buf, "%0*X",
glyph->u.glyphless.ch < 0x10000 ? 4 : 6,
glyph->u.glyphless.ch);
str = buf;
static void
xm_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data)
{
- struct scroll_bar *bar = (struct scroll_bar *) client_data;
- XmScrollBarCallbackStruct *cs = (XmScrollBarCallbackStruct *) call_data;
+ struct scroll_bar *bar = client_data;
+ XmScrollBarCallbackStruct *cs = call_data;
int part = -1, whole = 0, portion = 0;
switch (cs->reason)
gdouble value,
gpointer user_data)
{
- struct scroll_bar *bar = (struct scroll_bar *) user_data;
+ struct scroll_bar *bar = user_data;
gdouble position;
int part = -1, whole = 0, portion = 0;
GtkAdjustment *adj = GTK_ADJUSTMENT (gtk_range_get_adjustment (range));
- struct frame *f = (struct frame *) g_object_get_data (G_OBJECT (range),
- XG_FRAME_DATA);
+ struct frame *f = g_object_get_data (G_OBJECT (range), XG_FRAME_DATA);
if (xg_ignore_gtk_scrollbar) return FALSE;
position = gtk_adjustment_get_value (adj);
GdkEventButton *event,
gpointer user_data)
{
- struct scroll_bar *bar = (struct scroll_bar *) user_data;
+ struct scroll_bar *bar = user_data;
bar->dragging = Qnil;
if (WINDOWP (window_being_scrolled))
{
static void
xaw_jump_callback (Widget widget, XtPointer client_data, XtPointer call_data)
{
- struct scroll_bar *bar = (struct scroll_bar *) client_data;
- float top = *(float *) call_data;
+ struct scroll_bar *bar = client_data;
+ float *top_addr = call_data;
+ float top = *top_addr;
float shown;
int whole, portion, height;
int part;
static void
xaw_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data)
{
- struct scroll_bar *bar = (struct scroll_bar *) client_data;
+ struct scroll_bar *bar = client_data;
/* The position really is stored cast to a pointer. */
- int position = (long) call_data;
+ int position = (intptr_t) call_data;
Dimension height;
int part;