From b7ad2f7401a22e6189d1b0a0523a3f98d1f70be5 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 17 Sep 2013 00:06:42 -0700 Subject: [PATCH] Don't overuse 'const' in types of locals. * bidi.c (bidi_count_bytes): * gtkutil.c, gtkutil.h (xg_event_is_for_menubar) (xg_event_is_for_scrollbar): * xselect.c (x_handle_property_notify) (x_handle_selection_notify, x_handle_dnd_message): * xsettings.c, xsettings.h (xft_settings_event): * xterm.c (x_handle_net_wm_state, handle_one_event) (x_menubar_window_to_frame, x_detect_focus_change) (construct_mouse_click, note_mouse_movement) (x_scroll_bar_to_input_event, x_scroll_bar_expose) (x_scroll_bar_handle_click, x_scroll_bar_note_movement) (handle_one_xevent, x_handle_net_wm_state): * xterm.h (x_handle_property_notify, x_handle_selection_notify) (x_handle_dnd_message): Avoid unnecessary 'const', typically the second 'const' in 'const foo * const arg', a 'const' that does not affect the API and doesn't significantly help the human reader. --- src/ChangeLog | 21 +++++++++++++++++++++ src/bidi.c | 4 ++-- src/gtkutil.c | 4 ++-- src/gtkutil.h | 4 ++-- src/xselect.c | 6 +++--- src/xsettings.c | 2 +- src/xsettings.h | 2 +- src/xterm.c | 28 ++++++++++++++-------------- src/xterm.h | 6 +++--- 9 files changed, 49 insertions(+), 28 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index f1ba30f023b..d477e3d2ae3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,24 @@ +2013-09-17 Paul Eggert + + Don't overuse 'const' in types of locals. + * bidi.c (bidi_count_bytes): + * gtkutil.c, gtkutil.h (xg_event_is_for_menubar) + (xg_event_is_for_scrollbar): + * xselect.c (x_handle_property_notify) + (x_handle_selection_notify, x_handle_dnd_message): + * xsettings.c, xsettings.h (xft_settings_event): + * xterm.c (x_handle_net_wm_state, handle_one_event) + (x_menubar_window_to_frame, x_detect_focus_change) + (construct_mouse_click, note_mouse_movement) + (x_scroll_bar_to_input_event, x_scroll_bar_expose) + (x_scroll_bar_handle_click, x_scroll_bar_note_movement) + (handle_one_xevent, x_handle_net_wm_state): + * xterm.h (x_handle_property_notify, x_handle_selection_notify) + (x_handle_dnd_message): + Avoid unnecessary 'const', typically the second 'const' in + 'const foo * const arg', a 'const' that does not affect the API + and doesn't significantly help the human reader. + 2013-09-17 Dmitry Antipov * image.c (fn_g_type_init) [WINDOWSNT]: Define and load diff --git a/src/bidi.c b/src/bidi.c index 7d082a94997..dc905cd9e5f 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -870,8 +870,8 @@ bidi_line_init (struct bidi_it *bidi_it) are zero-based character positions in S, BEGBYTE is byte position corresponding to BEG. UNIBYTE means S is a unibyte string. */ static ptrdiff_t -bidi_count_bytes (const unsigned char *s, const ptrdiff_t beg, - const ptrdiff_t begbyte, const ptrdiff_t end, bool unibyte) +bidi_count_bytes (const unsigned char *s, ptrdiff_t beg, + ptrdiff_t begbyte, ptrdiff_t end, bool unibyte) { ptrdiff_t pos = beg; const unsigned char *p = s + begbyte, *start = p; diff --git a/src/gtkutil.c b/src/gtkutil.c index 57b7b58d9d6..e20d01521f0 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -3409,7 +3409,7 @@ free_frame_menubar (struct frame *f) } bool -xg_event_is_for_menubar (struct frame *f, const XEvent * const event) +xg_event_is_for_menubar (struct frame *f, const XEvent *event) { struct x_output *x = f->output_data.x; GList *iter; @@ -3861,7 +3861,7 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, frame. This function does additional checks. */ bool -xg_event_is_for_scrollbar (struct frame *f, const XEvent * const event) +xg_event_is_for_scrollbar (struct frame *f, const XEvent *event) { bool retval = 0; diff --git a/src/gtkutil.h b/src/gtkutil.h index 57971cf4a38..1c26d2aa44b 100644 --- a/src/gtkutil.h +++ b/src/gtkutil.h @@ -105,7 +105,7 @@ extern void xg_modify_menubar_widgets (GtkWidget *menubar, extern void xg_update_frame_menubar (struct frame *f); -extern bool xg_event_is_for_menubar (struct frame *, const XEvent * const); +extern bool xg_event_is_for_menubar (struct frame *, const XEvent *); extern bool xg_have_tear_offs (void); @@ -129,7 +129,7 @@ extern void xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int position, int whole); -extern bool xg_event_is_for_scrollbar (struct frame *, const XEvent * const); +extern bool xg_event_is_for_scrollbar (struct frame *, const XEvent *); extern int xg_get_default_scrollbar_width (void); extern void update_frame_tool_bar (struct frame *f); diff --git a/src/xselect.c b/src/xselect.c index cec91e41e75..5eb263d8d0c 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -1141,7 +1141,7 @@ wait_for_property_change (struct prop_location *location) /* Called from XTread_socket in response to a PropertyNotify event. */ void -x_handle_property_notify (const XPropertyEvent * const event) +x_handle_property_notify (const XPropertyEvent *event) { struct prop_location *rest; @@ -1888,7 +1888,7 @@ clean_local_selection_data (Lisp_Object obj) We store t there if the reply is successful, lambda if not. */ void -x_handle_selection_notify (const XSelectionEvent * const event) +x_handle_selection_notify (const XSelectionEvent *event) { if (event->requestor != reading_selection_window) return; @@ -2488,7 +2488,7 @@ FRAME is on. If FRAME is nil, the selected frame is used. */) /* Convert an XClientMessageEvent to a Lisp event of type DRAG_N_DROP_EVENT. */ int -x_handle_dnd_message (struct frame *f, const XClientMessageEvent * const event, +x_handle_dnd_message (struct frame *f, const XClientMessageEvent *event, struct x_display_info *dpyinfo, struct input_event *bufp) { Lisp_Object vec; diff --git a/src/xsettings.c b/src/xsettings.c index 770cd8e4a56..bdf9f2876be 100644 --- a/src/xsettings.c +++ b/src/xsettings.c @@ -754,7 +754,7 @@ read_and_apply_settings (struct x_display_info *dpyinfo, int send_event_p) /* Check if EVENT for the display in DPYINFO is XSettings related. */ void -xft_settings_event (struct x_display_info *dpyinfo, const XEvent * const event) +xft_settings_event (struct x_display_info *dpyinfo, const XEvent *event) { bool check_window_p = 0, apply_settings_p = 0; diff --git a/src/xsettings.h b/src/xsettings.h index 4407ca7df92..a017c5d92d8 100644 --- a/src/xsettings.h +++ b/src/xsettings.h @@ -21,7 +21,7 @@ along with GNU Emacs. If not, see . */ #define XSETTINGS_H extern void xsettings_initialize (struct x_display_info *); -extern void xft_settings_event (struct x_display_info *, const XEvent * const); +extern void xft_settings_event (struct x_display_info *, const XEvent *); extern const char *xsettings_get_system_font (void); #ifdef USE_LUCID extern const char *xsettings_get_system_normal_font (void); diff --git a/src/xterm.c b/src/xterm.c index 90e58c81f44..ba588157fc0 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -303,12 +303,12 @@ static void x_scroll_bar_report_motion (struct frame **, Lisp_Object *, enum scroll_bar_part *, Lisp_Object *, Lisp_Object *, Time *); -static int x_handle_net_wm_state (struct frame *, const XPropertyEvent * const); +static int x_handle_net_wm_state (struct frame *, const XPropertyEvent *); static void x_check_fullscreen (struct frame *); static void x_check_expected_move (struct frame *, int, int); static void x_sync_with_move (struct frame *, int, int, int); static int handle_one_xevent (struct x_display_info *, - const XEvent * const, int *, + const XEvent *, int *, struct input_event *); #ifdef USE_GTK static int x_dispatch_event (XEvent *, Display *); @@ -3462,7 +3462,7 @@ x_any_window_to_frame (struct x_display_info *dpyinfo, int wdesc) static struct frame * x_menubar_window_to_frame (struct x_display_info *dpyinfo, - const XEvent * const event) + const XEvent *event) { Window wdesc = event->xany.window; Lisp_Object tail, frame; @@ -3544,7 +3544,7 @@ x_top_window_to_frame (struct x_display_info *dpyinfo, int wdesc) static void x_detect_focus_change (struct x_display_info *dpyinfo, struct frame *frame, - const XEvent * const event, struct input_event *bufp) + const XEvent *event, struct input_event *bufp) { if (!frame) return; @@ -3835,7 +3835,7 @@ x_get_keysym_name (int keysym) static Lisp_Object construct_mouse_click (struct input_event *result, - const XButtonEvent * const event, + const XButtonEvent *event, struct frame *f) { /* Make the event type NO_EVENT; we'll change that when we decide @@ -3868,7 +3868,7 @@ static XMotionEvent last_mouse_motion_event; static Lisp_Object last_mouse_motion_frame; static int -note_mouse_movement (struct frame *frame, const XMotionEvent * const event) +note_mouse_movement (struct frame *frame, const XMotionEvent *event) { last_mouse_movement_time = event->time; last_mouse_motion_event = *event; @@ -4359,7 +4359,7 @@ x_send_scroll_bar_event (Lisp_Object window, int part, int portion, int whole) in *IEVENT. */ static void -x_scroll_bar_to_input_event (const XEvent * const event, +x_scroll_bar_to_input_event (const XEvent *event, struct input_event *ievent) { XClientMessageEvent *ev = (XClientMessageEvent *) event; @@ -5504,7 +5504,7 @@ XTjudge_scroll_bars (struct frame *f) mark bits. */ static void -x_scroll_bar_expose (struct scroll_bar *bar, const XEvent * const event) +x_scroll_bar_expose (struct scroll_bar *bar, const XEvent *event) { Window w = bar->x_window; struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); @@ -5543,7 +5543,7 @@ x_scroll_bar_expose (struct scroll_bar *bar, const XEvent * const event) static void x_scroll_bar_handle_click (struct scroll_bar *bar, - const XEvent * const event, + const XEvent *event, struct input_event *emacs_event) { if (! WINDOWP (bar->window)) @@ -5602,7 +5602,7 @@ x_scroll_bar_handle_click (struct scroll_bar *bar, static void x_scroll_bar_note_movement (struct scroll_bar *bar, - const XMotionEvent * const event) + const XMotionEvent *event) { struct frame *f = XFRAME (XWINDOW (bar->window)->frame); @@ -5853,7 +5853,7 @@ static void xembed_send_message (struct frame *f, Time, static int handle_one_xevent (struct x_display_info *dpyinfo, - const XEvent * const event, + const XEvent *event, int *finish, struct input_event *hold_quit) { union { @@ -6078,7 +6078,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, goto OTHER; #endif /* USE_X_TOOLKIT */ { - const XSelectionClearEvent * const eventp = &event->xselectionclear; + const XSelectionClearEvent *eventp = &event->xselectionclear; inev.ie.kind = SELECTION_CLEAR_EVENT; SELECTION_EVENT_DISPLAY (&inev.sie) = eventp->display; @@ -6094,7 +6094,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, goto OTHER; #endif /* USE_X_TOOLKIT */ { - const XSelectionRequestEvent * const eventp = &event->xselectionrequest; + const XSelectionRequestEvent *eventp = &event->xselectionrequest; inev.ie.kind = SELECTION_REQUEST_EVENT; SELECTION_EVENT_DISPLAY (&inev.sie) = eventp->display; @@ -8533,7 +8533,7 @@ XTfullscreen_hook (struct frame *f) static int -x_handle_net_wm_state (struct frame *f, const XPropertyEvent * const event) +x_handle_net_wm_state (struct frame *f, const XPropertyEvent *event) { int value = FULLSCREEN_NONE; Lisp_Object lval; diff --git a/src/xterm.h b/src/xterm.h index 8dc86784b09..28b72969972 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -941,8 +941,8 @@ extern void x_wait_for_event (struct frame *, int); /* Defined in xselect.c */ -extern void x_handle_property_notify (const XPropertyEvent * const); -extern void x_handle_selection_notify (const XSelectionEvent * const); +extern void x_handle_property_notify (const XPropertyEvent *); +extern void x_handle_selection_notify (const XSelectionEvent *); extern void x_handle_selection_event (struct input_event *); extern void x_clear_frame_selections (struct frame *); @@ -954,7 +954,7 @@ extern void x_send_client_event (Lisp_Object display, Lisp_Object values); extern int x_handle_dnd_message (struct frame *, - const XClientMessageEvent * const, + const XClientMessageEvent *, struct x_display_info *, struct input_event *); extern int x_check_property_data (Lisp_Object); -- 2.39.2