]> code.delx.au - gnu-emacs/commitdiff
Fix minor problems found by static checking.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 26 Aug 2013 21:31:50 +0000 (14:31 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 26 Aug 2013 21:31:50 +0000 (14:31 -0700)
* 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.

src/ChangeLog
src/image.c
src/nsmenu.m
src/nsterm.h
src/nsterm.m
src/regex.c
src/xfaces.c
src/xgselect.c
src/xgselect.h

index bece374f0806f0a800d7fd42e39e537e8527f81d..01f3093b6dd2a1b35d5f605ffa89d7e8691af2d0 100644 (file)
@@ -1,3 +1,19 @@
+2013-08-26  Paul Eggert  <eggert@cs.ucla.edu>
+
+       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  <monnier@iro.umontreal.ca>
 
        * lread.c (substitute_object_recurse): Handle hash-tables as well
index 2db44d07c814db7fd7b339317f69438d1e15c9b8..59347161576cbd4c2401f0c3ac9d138d0c8ae148 100644 (file)
@@ -145,7 +145,7 @@ static Lisp_Object QCmax_width, QCmax_height;
 
 #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 @@ XGetPixel (XImagePtr ximage, int x, int y)
 
 /* 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 @@ xbm_read_bitmap_data (struct frame *f, unsigned char *contents, unsigned char *e
      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 @@ xpm_load_image (struct frame *f,
      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 @@ x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how)
   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 @@ x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how)
 #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
index 5af813ac7586a96cc05b3816829214cda9c2e7ff..7fe84343f1c9bbe523d2506645f965687b85f6ce 100644 (file)
@@ -730,7 +730,7 @@ extern NSString *NSMenuDidBeginTrackingNotification;
 
 - (void)fillWithWidgetValue: (void *)wvptr
 {
-  [self fillWithWidgetValue: wvptr frame:nil];
+  [self fillWithWidgetValue: wvptr frame: (struct frame *)nil];
 }
 
 - (void)fillWithWidgetValue: (void *)wvptr frame: (struct frame *)f
index c34067991f62bc583231990a993bccc8addc4d5f..a3174ade07b3eafed0384dbb3a081f0bccd89423 100644 (file)
@@ -874,8 +874,8 @@ extern int x_display_pixel_width (struct ns_display_info *);
 /* 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;
index 287c119ba73b9d3a3abeb05e52dfc6fb94ad041a..f7cc5933a53c69aa8dbca2ad90f61d921f6ebc72 100644 (file)
@@ -3540,7 +3540,8 @@ ns_read_socket (struct terminal *terminal, struct input_event *hold_quit)
 
 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 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds,
           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;
         }
index 06a9db2c55c6b16346a63823149c343e9955b188..2363fe2a290e601a94715b97d922d807e6c98eb6 100644 (file)
@@ -1238,12 +1238,12 @@ re_set_syntax (reg_syntax_t syntax)
 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)
 \f
index b76f9d24180d0d053e78297ed013351aad512744..a55ac90086dc33eeab297cd2964ea59ecd203844 100644 (file)
@@ -236,7 +236,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #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 */
index 4d90298a9d915a5e55685049cd23802b95fa53a9..97f53373b632ff3c963d4192aa158fcd9d718df4 100644 (file)
@@ -29,10 +29,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 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;
index f142e85d877ba0f0ab54c65ec29e6e5d3912537d..21c8acf1016fa10e19d9adfe913074a3a51242ef 100644 (file)
@@ -28,7 +28,7 @@ extern int xg_select (int max_fds,
                       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 */