# HG changeset patch # User Juanma Barranquero # Date 1279657263 -7200 # Node ID d12162869c07ce284a82186170f41454e8b8d0fa # Parent a2fe058b3eb25e9857b84eec1a57473a947f2c5b Convert some more functions to standard C. * 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. diff -r a2fe058b3eb2 -r d12162869c07 lib-src/ChangeLog --- a/lib-src/ChangeLog Tue Jul 20 21:15:01 2010 +0200 +++ b/lib-src/ChangeLog Tue Jul 20 22:21:03 2010 +0200 @@ -1,3 +1,12 @@ +2010-07-20 Juanma Barranquero + + * 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 * Makefile.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS) diff -r a2fe058b3eb2 -r d12162869c07 lib-src/emacsclient.c --- a/lib-src/emacsclient.c Tue Jul 20 21:15:01 2010 +0200 +++ b/lib-src/emacsclient.c Tue Jul 20 22:21:03 2010 +0200 @@ -235,7 +235,7 @@ 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 @@ 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 @@ 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 @@ } 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 @@ } int -w32_window_app () +w32_window_app (void) { static int window_app = -1; char szTitle[MAX_PATH]; @@ -446,13 +442,11 @@ 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 @@ #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 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 @@ * process id = emacs_pid. If found, allow it to grab the focus. */ void -w32_give_focus () +w32_give_focus (void) { HANDLE user32; diff -r a2fe058b3eb2 -r d12162869c07 lib-src/ntlib.c --- a/lib-src/ntlib.c Tue Jul 20 21:15:01 2010 +0200 +++ b/lib-src/ntlib.c Tue Jul 20 22:21:03 2010 +0200 @@ -38,7 +38,7 @@ 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 int getppid_ppid; int -getppid(void) +getppid (void) { char *ppid; DWORD result; @@ -64,7 +64,7 @@ ppid = getenv ("EM_PARENT_PROCESS_ID"); if (!ppid) { - printf("no pid.\n"); + printf ("no pid.\n"); return 0; } else @@ -74,11 +74,11 @@ 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 @@ 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 @@ } unsigned -getuid () +getuid (void) { return 0; } unsigned -getgid () +getgid (void) { return 0; } unsigned -getegid () +getegid (void) { return 0; } @@ -219,7 +219,7 @@ } FILE * -sys_fopen(const char * path, const char * mode) +sys_fopen (const char * path, const char * mode) { return fopen (path, mode); } diff -r a2fe058b3eb2 -r d12162869c07 nt/ChangeLog --- a/nt/ChangeLog Tue Jul 20 21:15:01 2010 +0200 +++ b/nt/ChangeLog Tue Jul 20 22:21:03 2010 +0200 @@ -1,3 +1,11 @@ +2010-07-20 Juanma Barranquero + + * 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 * gmake.defs (CHECKING_CFLAGS) [ENABLECHECKS]: Add -fno-crossjumping. diff -r a2fe058b3eb2 -r d12162869c07 nt/addpm.c --- a/nt/addpm.c Tue Jul 20 21:15:01 2010 +0200 +++ b/nt/addpm.c Tue Jul 20 22:21:03 2010 +0200 @@ -83,8 +83,7 @@ }; BOOL -add_registry (path) - char *path; +add_registry (char *path) { HKEY hrootkey = NULL; int i; @@ -175,9 +174,7 @@ } 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 @@ if (SUCCEEDED (IPersistFile_Save (lnk, unicode_path, TRUE))) shortcuts_created = 1; IPersistFile_Release (lnk); - + } } - } + } } if (com_available) diff -r a2fe058b3eb2 -r d12162869c07 nt/cmdproxy.c --- a/nt/cmdproxy.c Tue Jul 20 21:15:01 2010 +0200 +++ b/nt/cmdproxy.c Tue Jul 20 22:21:03 2010 +0200 @@ -407,7 +407,7 @@ /* Return size of current environment block. */ int -get_env_size () +get_env_size (void) { char * start = GetEnvironmentStrings (); char * tmp = start; diff -r a2fe058b3eb2 -r d12162869c07 nt/ddeclient.c --- a/nt/ddeclient.c Tue Jul 20 21:15:01 2010 +0200 +++ b/nt/ddeclient.c Tue Jul 20 22:21:03 2010 +0200 @@ -35,9 +35,7 @@ CF_TEXT, XTYP_EXECUTE, 30000, NULL) int -main (argc, argv) - int argc; - char *argv[]; +main (int argc, char *argv[]) { DWORD idDde = 0; HCONV HConversation; diff -r a2fe058b3eb2 -r d12162869c07 nt/runemacs.c --- a/nt/runemacs.c Tue Jul 20 21:15:01 2010 +0200 +++ b/nt/runemacs.c Tue Jul 20 22:21:03 2010 +0200 @@ -174,7 +174,8 @@ return 1; } -void set_user_model_id () +void +set_user_model_id (void) { HMODULE shell; HRESULT (WINAPI * set_user_model) (wchar_t * id); diff -r a2fe058b3eb2 -r d12162869c07 src/ChangeLog --- a/src/ChangeLog Tue Jul 20 21:15:01 2010 +0200 +++ b/src/ChangeLog Tue Jul 20 22:21:03 2010 +0200 @@ -1,3 +1,16 @@ +2010-07-20 Juanma Barranquero + + * 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 * eval.c (Feval, Ffuncall): Use the new names. diff -r a2fe058b3eb2 -r d12162869c07 src/alloc.c --- a/src/alloc.c Tue Jul 20 21:15:01 2010 +0200 +++ b/src/alloc.c Tue Jul 20 22:21:03 2010 +0200 @@ -1161,9 +1161,7 @@ /* 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 @@ /* 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 @@ /* 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 @@ /* 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 diff -r a2fe058b3eb2 -r d12162869c07 src/fringe.c --- a/src/fringe.c Tue Jul 20 21:15:01 2010 +0200 +++ b/src/fringe.c Tue Jul 20 22:21:03 2010 +0200 @@ -1836,7 +1836,7 @@ } void -w32_reset_fringes () +w32_reset_fringes (void) { /* Destroy row bitmaps. */ int bt; diff -r a2fe058b3eb2 -r d12162869c07 src/image.c --- a/src/image.c Tue Jul 20 21:15:01 2010 +0200 +++ b/src/image.c Tue Jul 20 22:21:03 2010 +0200 @@ -2560,10 +2560,8 @@ } 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 @@ #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 @@ } static void -init_color_table () +init_color_table (void) { } #endif /* COLOR_TABLE_SUPPORT */ @@ -4492,10 +4488,7 @@ 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 @@ /* 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); } diff -r a2fe058b3eb2 -r d12162869c07 src/sound.c --- a/src/sound.c Tue Jul 20 21:15:01 2010 +0200 +++ b/src/sound.c Tue Jul 20 22:21:03 2010 +0200 @@ -522,8 +522,7 @@ 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 @@ } 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 @@ } 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; diff -r a2fe058b3eb2 -r d12162869c07 src/vm-limit.c --- a/src/vm-limit.c Tue Jul 20 21:15:01 2010 +0200 +++ b/src/vm-limit.c Tue Jul 20 22:21:03 2010 +0200 @@ -69,7 +69,7 @@ #ifdef USG static void -get_lim_data () +get_lim_data (void) { extern long ulimit (); @@ -93,7 +93,7 @@ #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 @@ #ifdef MSDOS void -get_lim_data () +get_lim_data (void) { _go32_dpmi_meminfo info; unsigned long lim1, lim2; @@ -135,14 +135,14 @@ } 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 @@ #else /* BSD4_2 */ static void -get_lim_data () +get_lim_data (void) { struct rlimit XXrlimit; diff -r a2fe058b3eb2 -r d12162869c07 src/w32term.c --- a/src/w32term.c Tue Jul 20 21:15:01 2010 +0200 +++ b/src/w32term.c Tue Jul 20 22:21:03 2010 +0200 @@ -5694,8 +5694,7 @@ /* 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); diff -r a2fe058b3eb2 -r d12162869c07 src/xfaces.c --- a/src/xfaces.c Tue Jul 20 21:15:01 2010 +0200 +++ b/src/xfaces.c Tue Jul 20 22:21:03 2010 +0200 @@ -726,10 +726,7 @@ /* 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 @@ /* 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);