1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-25 10:47:00 +00:00

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.
This commit is contained in:
Juanma Barranquero 2010-07-20 22:21:03 +02:00
parent af4b9ae586
commit 7c3320d8b9
16 changed files with 85 additions and 91 deletions

View 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)

View 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;

View 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);
}

View 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.

View 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)

View 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;

View 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;

View File

@ -174,7 +174,8 @@ WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow)
return 1;
}
void set_user_model_id ()
void
set_user_model_id (void)
{
HMODULE shell;
HRESULT (WINAPI * set_user_model) (wchar_t * id);

View 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.

View 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

View 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;

View 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);
}

View 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;

View 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;

View 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);

View 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);