[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r114014: Fix minor problems found by static checking
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] trunk r114014: Fix minor problems found by static checking. |
Date: |
Mon, 26 Aug 2013 21:31:54 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 114014
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Mon 2013-08-26 14:31:50 -0700
message:
Fix minor problems found by static checking.
* image.c (XGetPixel, XPutPixel) [HAVE_NS]: Now static.
(expect): Avoid nested-if warning.
(x_build_heuristic_mask) [HAVE_NS]: Avoid unused-var warning.
* nsmenu.m (fillWithWidgetValue:): Avoid type warning.
* nsterm.h, nsterm.m (ns_select):
* xgselect.c, xgselect.h (xg_select):
Adjust signature to better match pselect's.
* nsterm.m (ns_select):
Don't set *TIMEOUT, since pselect doesn't.
* regex.c (whitespace_regexp): Now const_re_char *, to avoid
diagnostic about assigning const char * to it.
* xfaces.c (x_display_info) [HAVE_NS]: Remove; unused.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/image.c image.c-20091113204419-o5vbwnq5f7feedwu-2969
src/nsmenu.m nsmenu.m-20091113204419-o5vbwnq5f7feedwu-8744
src/nsterm.h nsterm.h-20091113204419-o5vbwnq5f7feedwu-8746
src/nsterm.m nsterm.m-20091113204419-o5vbwnq5f7feedwu-8747
src/regex.c regex.c-20091113204419-o5vbwnq5f7feedwu-518
src/xfaces.c xfaces.c-20091113204419-o5vbwnq5f7feedwu-560
src/xgselect.c xgselect.c-20091121171556-bypaf8oo9ygoo13w-2
src/xgselect.h xgselect.h-20091121171556-bypaf8oo9ygoo13w-3
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-08-26 20:33:21 +0000
+++ b/src/ChangeLog 2013-08-26 21:31:50 +0000
@@ -1,3 +1,19 @@
+2013-08-26 Paul Eggert <address@hidden>
+
+ Fix minor problems found by static checking.
+ * image.c (XGetPixel, XPutPixel) [HAVE_NS]: Now static.
+ (expect): Avoid nested-if warning.
+ (x_build_heuristic_mask) [HAVE_NS]: Avoid unused-var warning.
+ * nsmenu.m (fillWithWidgetValue:): Avoid type warning.
+ * nsterm.h, nsterm.m (ns_select):
+ * xgselect.c, xgselect.h (xg_select):
+ Adjust signature to better match pselect's.
+ * nsterm.m (ns_select):
+ Don't set *TIMEOUT, since pselect doesn't.
+ * regex.c (whitespace_regexp): Now const_re_char *, to avoid
+ diagnostic about assigning const char * to it.
+ * xfaces.c (x_display_info) [HAVE_NS]: Remove; unused.
+
2013-08-26 Stefan Monnier <address@hidden>
* lread.c (substitute_object_recurse): Handle hash-tables as well
=== modified file 'src/image.c'
--- a/src/image.c 2013-08-20 00:51:35 +0000
+++ b/src/image.c 2013-08-26 21:31:50 +0000
@@ -145,7 +145,7 @@
#ifdef HAVE_NS
/* Use with images created by ns_image_for_XPM. */
-unsigned long
+static unsigned long
XGetPixel (XImagePtr ximage, int x, int y)
{
return ns_get_pixel (ximage, x, y);
@@ -153,7 +153,7 @@
/* Use with images created by ns_image_for_XPM; alpha set to 1;
pixel is assumed to be in RGB form. */
-void
+static void
XPutPixel (XImagePtr ximage, int x, int y, unsigned long pixel)
{
ns_put_pixel (ximage, x, y, pixel);
@@ -2713,10 +2713,13 @@
LA1 = xbm_scan (&s, end, buffer, &value)
#define expect(TOKEN) \
- if (LA1 != (TOKEN)) \
- goto failure; \
- else \
- match ()
+ do \
+ { \
+ if (LA1 != (TOKEN)) \
+ goto failure; \
+ match (); \
+ } \
+ while (0)
#define expect_ident(IDENT) \
if (LA1 == XBM_TK_IDENT && strcmp (buffer, (IDENT)) == 0) \
@@ -3976,10 +3979,13 @@
LA1 = xpm_scan (&s, end, &beg, &len)
#define expect(TOKEN) \
- if (LA1 != (TOKEN)) \
- goto failure; \
- else \
- match ()
+ do \
+ { \
+ if (LA1 != (TOKEN)) \
+ goto failure; \
+ match (); \
+ } \
+ while (0)
#define expect_ident(IDENT) \
if (LA1 == XPM_TK_IDENT \
@@ -4932,7 +4938,7 @@
int row_width;
#endif /* HAVE_NTGUI */
int x, y;
- bool rc, use_img_background;
+ bool use_img_background;
unsigned long bg = 0;
if (img->mask)
@@ -4941,9 +4947,8 @@
#ifndef HAVE_NTGUI
#ifndef HAVE_NS
/* Create an image and pixmap serving as mask. */
- rc = image_create_x_image_and_pixmap (f, img, img->width, img->height, 1,
- &mask_img, 1);
- if (!rc)
+ if (! image_create_x_image_and_pixmap (f, img, img->width, img->height, 1,
+ &mask_img, 1))
return;
#endif /* !HAVE_NS */
#else
=== modified file 'src/nsmenu.m'
--- a/src/nsmenu.m 2013-08-15 17:36:45 +0000
+++ b/src/nsmenu.m 2013-08-26 21:31:50 +0000
@@ -730,7 +730,7 @@
- (void)fillWithWidgetValue: (void *)wvptr
{
- [self fillWithWidgetValue: wvptr frame:nil];
+ [self fillWithWidgetValue: wvptr frame: (struct frame *)nil];
}
- (void)fillWithWidgetValue: (void *)wvptr frame: (struct frame *)f
=== modified file 'src/nsterm.h'
--- a/src/nsterm.h 2013-08-13 15:39:14 +0000
+++ b/src/nsterm.h 2013-08-26 21:31:50 +0000
@@ -874,8 +874,8 @@
/* This in nsterm.m */
extern void x_destroy_window (struct frame *f);
extern int ns_select (int nfds, fd_set *readfds, fd_set *writefds,
- fd_set *exceptfds, EMACS_TIME *timeout,
- sigset_t *sigmask);
+ fd_set *exceptfds, EMACS_TIME const *timeout,
+ sigset_t const *sigmask);
extern unsigned long ns_get_rgb_color (struct frame *f,
float r, float g, float b, float a);
extern NSPoint last_mouse_motion_position;
=== modified file 'src/nsterm.m'
--- a/src/nsterm.m 2013-08-23 04:03:25 +0000
+++ b/src/nsterm.m 2013-08-26 21:31:50 +0000
@@ -3540,7 +3540,8 @@
int
ns_select (int nfds, fd_set *readfds, fd_set *writefds,
- fd_set *exceptfds, EMACS_TIME *timeout, sigset_t *sigmask)
+ fd_set *exceptfds, EMACS_TIME const *timeout,
+ sigset_t const *sigmask)
/* --------------------------------------------------------------------------
Replacement for select, checking for events
--------------------------------------------------------------------------
*/
@@ -3666,7 +3667,6 @@
pthread_mutex_lock (&select_mutex);
if (readfds) *readfds = select_readfds;
if (writefds) *writefds = select_writefds;
- if (timeout) *timeout = select_timeout;
pthread_mutex_unlock (&select_mutex);
result = t;
}
=== modified file 'src/regex.c'
--- a/src/regex.c 2013-08-11 01:30:20 +0000
+++ b/src/regex.c 2013-08-26 21:31:50 +0000
@@ -1238,12 +1238,12 @@
WEAK_ALIAS (__re_set_syntax, re_set_syntax)
/* Regexp to use to replace spaces, or NULL meaning don't. */
-static re_char *whitespace_regexp;
+static const_re_char *whitespace_regexp;
void
re_set_whitespace_regexp (const char *regexp)
{
- whitespace_regexp = (re_char *) regexp;
+ whitespace_regexp = (const_re_char *) regexp;
}
WEAK_ALIAS (__re_set_syntax, re_set_syntax)
=== modified file 'src/xfaces.c'
--- a/src/xfaces.c 2013-08-13 08:18:11 +0000
+++ b/src/xfaces.c 2013-08-26 21:31:50 +0000
@@ -236,7 +236,6 @@
#ifdef HAVE_NS
#undef FRAME_X_DISPLAY_INFO
#define FRAME_X_DISPLAY_INFO FRAME_NS_DISPLAY_INFO
-#define x_display_info ns_display_info
#define GCGraphicsExposures 0
#endif /* HAVE_NS */
#endif /* HAVE_WINDOW_SYSTEM */
=== modified file 'src/xgselect.c'
--- a/src/xgselect.c 2013-06-08 18:13:24 +0000
+++ b/src/xgselect.c 2013-08-26 21:31:50 +0000
@@ -29,10 +29,11 @@
int
xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE
*efds,
- EMACS_TIME *timeout, sigset_t *sigmask)
+ EMACS_TIME const *timeout, sigset_t const *sigmask)
{
SELECT_TYPE all_rfds, all_wfds;
- EMACS_TIME tmo, *tmop = timeout;
+ EMACS_TIME tmo;
+ EMACS_TIME const *tmop = timeout;
GMainContext *context;
int have_wfds = wfds != NULL;
=== modified file 'src/xgselect.h'
--- a/src/xgselect.h 2013-01-01 09:11:05 +0000
+++ b/src/xgselect.h 2013-08-26 21:31:50 +0000
@@ -28,7 +28,7 @@
SELECT_TYPE *rfds,
SELECT_TYPE *wfds,
SELECT_TYPE *efds,
- EMACS_TIME *timeout,
- sigset_t *sigmask);
+ EMACS_TIME const *timeout,
+ sigset_t const *sigmask);
#endif /* XGSELECT_H */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r114014: Fix minor problems found by static checking.,
Paul Eggert <=