]> code.delx.au - gnu-emacs/commitdiff
Convert some more functions to standard C.
authorJuanma Barranquero <lekktu@gmail.com>
Tue, 20 Jul 2010 20:21:03 +0000 (22:21 +0200)
committerJuanma Barranquero <lekktu@gmail.com>
Tue, 20 Jul 2010 20:21:03 +0000 (22:21 +0200)
* lib-src/emacsclient.c (get_current_dir_name, w32_get_resource)
  (w32_getenv, w32_set_user_model_id, w32_window_app, w32_execvp)
  (close_winsock, initialize_sockets, w32_find_emacs_process)
  (w32_give_focus):
* lib-src/ntlib.c (getlogin, getuid, getgid, getegid):
* nt/addpm.c (add_registry, main):
* nt/cmdproxy.c (get_env_size):
* nt/ddeclient.c (main):
* nt/runemacs.c (set_user_model_id):
* src/alloc.c (emacs_blocked_free, emacs_blocked_malloc)
  (emacs_blocked_realloc, uninterrupt_malloc):
* src/fringe.c (w32_reset_fringes):
* src/image.c (convert_mono_to_color_image, lookup_rgb_color)
  (init_color_table, XPutPixel, jpeg_resync_to_restart_wrapper):
* src/sound.c (be2hs, do_play_sound):
* src/vm-limit.c (get_lim_data, ret_lim_data):
* src/w32term.c (x_free_frame_resources):
* src/xfaces.c (x_create_gc, x_free_gc):
  Convert definitions to standard C.

16 files changed:
lib-src/ChangeLog
lib-src/emacsclient.c
lib-src/ntlib.c
nt/ChangeLog
nt/addpm.c
nt/cmdproxy.c
nt/ddeclient.c
nt/runemacs.c
src/ChangeLog
src/alloc.c
src/fringe.c
src/image.c
src/sound.c
src/vm-limit.c
src/w32term.c
src/xfaces.c

index 03cf3efbd068477b065eea549c2e45d2c73af118..1b6a16dd52484907963a8c4edd117947fad7930b 100644 (file)
@@ -1,3 +1,12 @@
+2010-07-20  Juanma Barranquero  <lekktu@gmail.com>
+
+       * emacsclient.c (get_current_dir_name, w32_get_resource)
+       (w32_getenv, w32_set_user_model_id, w32_window_app, w32_execvp)
+       (close_winsock, initialize_sockets, w32_find_emacs_process)
+       (w32_give_focus):
+       * ntlib.c (getlogin, getuid, getgid, getegid):
+       Convert definitions to standard C.
+
 2010-07-12  Andreas Schwab  <schwab@linux-m68k.org>
 
        * Makefile.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS)
index 79143ff7a34895de10f02cb0c49d994f574d326d..bafc7e02720d45c88e8f655e42db324c3388150a 100644 (file)
@@ -235,7 +235,7 @@ xstrdup (const char *s)
    Any other returned value must be freed with free.  This is used
    only when get_current_dir_name is not defined on the system.  */
 char*
-get_current_dir_name ()
+get_current_dir_name (void)
 {
   char *buf;
   char *pwd;
@@ -311,10 +311,7 @@ get_current_dir_name ()
    Return NULL if the variable was not found, or it was empty.
    This code is based on w32_get_resource (w32.c).  */
 char *
-w32_get_resource (predefined, key, type)
-     HKEY predefined;
-     char *key;
-     LPDWORD type;
+w32_get_resource (HKEY predefined, char *key, LPDWORD type)
 {
   HKEY hrootkey = NULL;
   char *result = NULL;
@@ -347,8 +344,7 @@ w32_get_resource (predefined, key, type)
   variables in the registry if they don't appear in the environment.
 */
 char *
-w32_getenv (envvar)
-     char *envvar;
+w32_getenv (char *envvar)
 {
   char *value;
   DWORD dwType;
@@ -396,7 +392,7 @@ w32_getenv (envvar)
 }
 
 void
-w32_set_user_model_id ()
+w32_set_user_model_id (void)
 {
   HMODULE shell;
   HRESULT (WINAPI * set_user_model) (wchar_t * id);
@@ -423,7 +419,7 @@ w32_set_user_model_id ()
 }
 
 int
-w32_window_app ()
+w32_window_app (void)
 {
   static int window_app = -1;
   char szTitle[MAX_PATH];
@@ -446,13 +442,11 @@ w32_window_app ()
   This is necessary due to the broken implementation of exec* routines in
   the Microsoft libraries: they concatenate the arguments together without
   quoting special characters, and pass the result to CreateProcess, with
-  predictably bad results.  By contrast, Posix execvp passes the arguments
+  predictably bad results.  By contrast, POSIX execvp passes the arguments
   directly into the argv array of the child process.
 */
 int
-w32_execvp (path, argv)
-     char *path;
-     char **argv;
+w32_execvp (const char *path, char **argv)
 {
   int i;
 
@@ -900,15 +894,15 @@ file_name_absolute_p (const unsigned char *filename)
 
 #ifdef WINDOWSNT
 /* Wrapper to make WSACleanup a cdecl, as required by atexit.  */
-void
-__cdecl close_winsock ()
+void __cdecl
+close_winsock (void)
 {
   WSACleanup ();
 }
 
 /* Initialize the WinSock2 library.  */
 void
-initialize_sockets ()
+initialize_sockets (void)
 {
   WSADATA wsaData;
 
@@ -1408,9 +1402,7 @@ FARPROC set_fg;  /* Pointer to AllowSetForegroundWindow.  */
 FARPROC get_wc;  /* Pointer to RealGetWindowClassA.  */
 
 BOOL CALLBACK
-w32_find_emacs_process (hWnd, lParam)
-     HWND hWnd;
-     LPARAM lParam;
+w32_find_emacs_process (HWND hWnd, LPARAM lParam)
 {
   DWORD pid;
   char class[6];
@@ -1438,7 +1430,7 @@ w32_find_emacs_process (hWnd, lParam)
  * process id = emacs_pid.  If found, allow it to grab the focus.
  */
 void
-w32_give_focus ()
+w32_give_focus (void)
 {
   HANDLE user32;
 
index c815f32d51d0bc37f3a5ce8036d6980359c1f326..c24b35d9a1984a4911e12f102f3610166d757738 100644 (file)
@@ -38,7 +38,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
    would necessitate including windows.h in the files that used it.
    This is much easier.  */
 void
-sleep(unsigned long seconds)
+sleep (unsigned long seconds)
 {
   Sleep (seconds * 1000);
 }
@@ -56,7 +56,7 @@ static HANDLE getppid_parent;
 static int    getppid_ppid;
 
 int
-getppid(void)
+getppid (void)
 {
   char *ppid;
   DWORD result;
@@ -64,7 +64,7 @@ getppid(void)
   ppid = getenv ("EM_PARENT_PROCESS_ID");
   if (!ppid)
     {
-      printf("no pid.\n");
+      printf ("no pid.\n");
       return 0;
     }
   else
@@ -74,11 +74,11 @@ getppid(void)
 
   if (!getppid_parent)
     {
-      getppid_parent = OpenProcess (SYNCHRONIZE, FALSE, atoi(ppid));
+      getppid_parent = OpenProcess (SYNCHRONIZE, FALSE, atoi (ppid));
       if (!getppid_parent)
        {
          printf ("Failed to open handle to parent process: %d\n",
-                GetLastError());
+                GetLastError ());
          exit (1);
        }
     }
@@ -94,13 +94,13 @@ getppid(void)
       return 1;
     case WAIT_FAILED:
     default:
-      printf ("Checking parent status failed: %d\n", GetLastError());
+      printf ("Checking parent status failed: %d\n", GetLastError ());
       exit (1);
     }
 }
 
 char *
-getlogin ()
+getlogin (void)
 {
   static char user_name[256];
   DWORD  length = sizeof (user_name);
@@ -120,19 +120,19 @@ cuserid (char * s)
 }
 
 unsigned
-getuid ()
+getuid (void)
 {
   return 0;
 }
 
 unsigned
-getgid ()
+getgid (void)
 {
   return 0;
 }
 
 unsigned
-getegid ()
+getegid (void)
 {
   return 0;
 }
@@ -219,7 +219,7 @@ sys_ctime (const time_t *t)
 }
 
 FILE *
-sys_fopen(const char * path, const char * mode)
+sys_fopen (const char * path, const char * mode)
 {
   return fopen (path, mode);
 }
index 14c0eb03ad25e66c1ed69c839c146ed5edac6059..0d389a2f518703d8140acb2e9c87db6d7027ad47 100644 (file)
@@ -1,3 +1,11 @@
+2010-07-20  Juanma Barranquero  <lekktu@gmail.com>
+
+       * addpm.c (add_registry, main):
+       * cmdproxy.c (get_env_size):
+       * ddeclient.c (main):
+       * runemacs.c (set_user_model_id):
+       Convert definitions to standard C.
+
 2010-07-20  Juanma Barranquero  <lekktu@gmail.com>
 
        * gmake.defs (CHECKING_CFLAGS) [ENABLECHECKS]: Add -fno-crossjumping.
index 9bdfafc2a3e45b854a283f8b44d13bce5a595419..20b289f6761da64169a99d42ea753b42ce533ac1 100644 (file)
@@ -83,8 +83,7 @@ env_vars[] =
 };
 
 BOOL
-add_registry (path)
-     char *path;
+add_registry (char *path)
 {
   HKEY hrootkey = NULL;
   int i;
@@ -175,9 +174,7 @@ add_registry (path)
 }
 
 int
-main (argc, argv)
-     int argc;
-     char *argv[];
+main (int argc, char *argv[])
 {
   char start_folder[MAX_PATH + 1];
   int shortcuts_created = 0;
@@ -315,10 +312,10 @@ main (argc, argv)
                  if (SUCCEEDED (IPersistFile_Save (lnk, unicode_path, TRUE)))
                    shortcuts_created = 1;
                  IPersistFile_Release (lnk);
-                 
+
                }
            }
-       }      
+       }
     }
 
   if (com_available)
index aae852bf4fa7b4af91751b68d83346687b81253f..4f167339b7f83a2492a369953740e358ba8b35b4 100644 (file)
@@ -407,7 +407,7 @@ spawn (char * progname, char * cmdline, char * dir, int * retcode)
 
 /* Return size of current environment block.  */
 int
-get_env_size ()
+get_env_size (void)
 {
   char * start = GetEnvironmentStrings ();
   char * tmp = start;
index b8c6683c3a3fa3abb8d6af2279a35aac4c2598ac..ef287f017ba70d25cd2037a238b29e3a0251ae23 100644 (file)
@@ -35,9 +35,7 @@ DdeCallback (UINT uType, UINT uFmt, HCONV hconv,
                              CF_TEXT, XTYP_EXECUTE, 30000, NULL)
 
 int
-main (argc, argv)
-     int argc;
-     char *argv[];
+main (int argc, char *argv[])
 {
   DWORD idDde = 0;
   HCONV HConversation;
index 4a3d4a9536d43d35651704ffe4afa10667c212bb..d28d677dca882b287114eabdf014b4d3e86158b1 100644 (file)
@@ -174,7 +174,8 @@ error:
   return 1;
 }
 
-void set_user_model_id ()
+void
+set_user_model_id (void)
 {
   HMODULE shell;
   HRESULT (WINAPI * set_user_model) (wchar_t * id);
index 81b4560e06d511dceb991a0f539719e041903aad..414f22d3bfd6d4ca3558a8d64731b5ac251da1be 100644 (file)
@@ -1,3 +1,16 @@
+2010-07-20  Juanma Barranquero  <lekktu@gmail.com>
+
+       * alloc.c (emacs_blocked_free, emacs_blocked_malloc)
+       (emacs_blocked_realloc, uninterrupt_malloc):
+       * fringe.c (w32_reset_fringes):
+       * image.c (convert_mono_to_color_image, lookup_rgb_color)
+       (init_color_table, XPutPixel, jpeg_resync_to_restart_wrapper):
+       * sound.c (be2hs, do_play_sound):
+       * vm-limit.c (get_lim_data, ret_lim_data):
+       * w32term.c (x_free_frame_resources):
+       * xfaces.c (x_create_gc, x_free_gc):
+       Convert definitions to standard C.
+
 2010-07-20  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * eval.c (Feval, Ffuncall): Use the new names.
index 5c860bc1f8e6812d7431b05846fad63e5167308e..2ce74f97ff753fbbf6e68d9f8b8446ae58012683 100644 (file)
@@ -1161,9 +1161,7 @@ static void (*old_free_hook) (void*, const void*);
 /* This function is used as the hook for free to call.  */
 
 static void
-emacs_blocked_free (ptr, ptr2)
-     void *ptr;
-     const void *ptr2;
+emacs_blocked_free (void *ptr, const void *ptr2)
 {
   BLOCK_INPUT_ALLOC;
 
@@ -1211,9 +1209,7 @@ emacs_blocked_free (ptr, ptr2)
 /* This function is the malloc hook that Emacs uses.  */
 
 static void *
-emacs_blocked_malloc (size, ptr)
-     size_t size;
-     const void *ptr;
+emacs_blocked_malloc (size_t size, const void *ptr)
 {
   void *value;
 
@@ -1260,10 +1256,7 @@ emacs_blocked_malloc (size, ptr)
 /* This function is the realloc hook that Emacs uses.  */
 
 static void *
-emacs_blocked_realloc (ptr, size, ptr2)
-     void *ptr;
-     size_t size;
-     const void *ptr2;
+emacs_blocked_realloc (void *ptr, size_t size, const void *ptr2)
 {
   void *value;
 
@@ -1337,7 +1330,7 @@ reset_malloc_hooks ()
 /* Called from main to set up malloc to use our hooks.  */
 
 void
-uninterrupt_malloc ()
+uninterrupt_malloc (void)
 {
 #ifdef HAVE_GTK_AND_PTHREAD
 #ifdef DOUG_LEA_MALLOC
index cab3c6feabc01697256c63c2da6408439e658b65..bfb2c217172a0025876744f17732c01cc32ad678 100644 (file)
@@ -1836,7 +1836,7 @@ w32_init_fringe (struct redisplay_interface *rif)
 }
 
 void
-w32_reset_fringes ()
+w32_reset_fringes (void)
 {
   /* Destroy row bitmaps.  */
   int bt;
index 6e75921414ba49d1ec95019f6afd41d2b1fe4236..d55d3ca0a6e136a40ef7107e5b74d3019ac3c114 100644 (file)
@@ -2560,10 +2560,8 @@ w32_create_pixmap_from_bitmap_data (int width, int height, char *data)
 }
 
 static void
-convert_mono_to_color_image (f, img, foreground, background)
-     struct frame *f;
-     struct image *img;
-     COLORREF foreground, background;
+convert_mono_to_color_image (struct frame *f, struct image *img,
+                            COLORREF foreground, COLORREF background)
 {
   HDC hdc, old_img_dc, new_img_dc;
   HGDIOBJ old_prev, new_prev;
@@ -4357,9 +4355,7 @@ colors_in_color_table (int *n)
 #else /* COLOR_TABLE_SUPPORT */
 
 static unsigned long
-lookup_rgb_color (f, r, g, b)
-     struct frame *f;
-     int r, g, b;
+lookup_rgb_color (struct frame *f, int r, int g, int b)
 {
   unsigned long pixel;
 
@@ -4374,7 +4370,7 @@ lookup_rgb_color (f, r, g, b)
 }
 
 static void
-init_color_table ()
+init_color_table (void)
 {
 }
 #endif /* COLOR_TABLE_SUPPORT */
@@ -4492,10 +4488,7 @@ x_to_xcolors (struct frame *f, struct image *img, int rgb_p)
    stored in ximg->data.  */
 
 static void
-XPutPixel (ximg, x, y, color)
-     XImagePtr  ximg;
-     int x, y;
-     COLORREF color;
+XPutPixel (XImagePtr ximg, int x, int y, COLORREF color)
 {
   int width = ximg->info.bmiHeader.biWidth;
   int height = ximg->info.bmiHeader.biHeight;
@@ -6071,9 +6064,7 @@ init_jpeg_functions (Lisp_Object libraries)
 /* Wrapper since we can't directly assign the function pointer
    to another function pointer that was declared more completely easily.  */
 static boolean
-jpeg_resync_to_restart_wrapper (cinfo, desired)
-     j_decompress_ptr cinfo;
-     int desired;
+jpeg_resync_to_restart_wrapper (j_decompress_ptr cinfo, int desired)
 {
   return fn_jpeg_resync_to_restart (cinfo, desired);
 }
index 2bf0b59ffd689bb3a9943d9620ba89f8f981a8c8..e0ebd565151114ee55562cf74df53b6afb520a10 100644 (file)
@@ -522,8 +522,7 @@ be2hl (u_int32_t value)
    to host byte-order.  */
 
 static u_int16_t
-be2hs (value)
-     u_int16_t value;
+be2hs (u_int16_t value)
 {
 #ifndef WORDS_BIG_ENDIAN
   unsigned char *p = (unsigned char *) &value;
@@ -1209,7 +1208,8 @@ alsa_write (struct sound_device *sd, const char *buffer, int nbytes)
 }
 
 static void
-snd_error_quiet (const char *file, int line, const char *function, int err, const char *fmt)
+snd_error_quiet (const char *file, int line, const char *function, int err,
+                const char *fmt)
 {
 }
 
@@ -1266,9 +1266,7 @@ alsa_init (struct sound_device *sd)
   }
 
 static int
-do_play_sound (psz_file, ui_volume)
-     const char *psz_file;
-     unsigned long ui_volume;
+do_play_sound (const char *psz_file, unsigned long ui_volume)
 {
   int i_result = 0;
   MCIERROR mci_error = 0;
index aca0e0afb47694da411bc599f05a39a6e704a2cc..b288276f394e3c462f8781b4c576ad855ba9cd39 100644 (file)
@@ -69,7 +69,7 @@ get_lim_data (void)
 #ifdef USG
 
 static void
-get_lim_data ()
+get_lim_data (void)
 {
   extern long ulimit ();
 
@@ -93,7 +93,7 @@ get_lim_data ()
 #ifdef WINDOWSNT
 
 static void
-get_lim_data ()
+get_lim_data (void)
 {
   extern unsigned long reserved_heap_size;
   lim_data = reserved_heap_size;
@@ -104,7 +104,7 @@ get_lim_data ()
 
 #ifdef MSDOS
 void
-get_lim_data ()
+get_lim_data (void)
 {
   _go32_dpmi_meminfo info;
   unsigned long lim1, lim2;
@@ -135,14 +135,14 @@ get_lim_data ()
 }
 
 unsigned long
-ret_lim_data ()
+ret_lim_data (void)
 {
   get_lim_data ();
   return lim_data;
 }
 #else /* not MSDOS */
 static void
-get_lim_data ()
+get_lim_data (void)
 {
   lim_data = vlimit (LIM_DATA, -1);
 }
@@ -151,7 +151,7 @@ get_lim_data ()
 #else /* BSD4_2 */
 
 static void
-get_lim_data ()
+get_lim_data (void)
 {
   struct rlimit XXrlimit;
 
index 9db533eb5e9e2e46550fe2dfb71eced47cf2b7b8..3a0a1b1abae11b996f8df1f0bda4a64693f564ac 100644 (file)
@@ -5694,8 +5694,7 @@ x_iconify_frame (struct frame *f)
 /* Free X resources of frame F.  */
 
 void
-x_free_frame_resources (f)
-     struct frame *f;
+x_free_frame_resources (struct frame *f)
 {
   struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
 
index ea0f57469e10b055383cf7b76e66dbc1f5c5edcf..d5aabd40c0cfc0d224f0e4e2cd8bccdceb18fff8 100644 (file)
@@ -726,10 +726,7 @@ x_free_gc (struct frame *f, GC gc)
 /* W32 emulation of GCs */
 
 static INLINE GC
-x_create_gc (f, mask, xgcv)
-     struct frame *f;
-     unsigned long mask;
-     XGCValues *xgcv;
+x_create_gc (struct frame *f, unsigned long mask, XGCValues *xgcv)
 {
   GC gc;
   BLOCK_INPUT;
@@ -743,9 +740,7 @@ x_create_gc (f, mask, xgcv)
 /* Free GC which was used on frame F.  */
 
 static INLINE void
-x_free_gc (f, gc)
-     struct frame *f;
-     GC gc;
+x_free_gc (struct frame *f, GC gc)
 {
   IF_DEBUG (xassert (--ngcs >= 0));
   xfree (gc);