aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorJuanma Barranquero2010-07-20 22:21:03 +0200
committerJuanma Barranquero2010-07-20 22:21:03 +0200
commit7c3320d8b9d3beaf952b20cfe1843181c1c7af65 (patch)
tree188ab3f0c3582c2890365bd92939e32a6b01d44c /lib-src
parentaf4b9ae58662d50080a7661631ce6861dc6b6aa9 (diff)
downloademacs-7c3320d8b9d3beaf952b20cfe1843181c1c7af65.tar.gz
emacs-7c3320d8b9d3beaf952b20cfe1843181c1c7af65.zip
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.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog9
-rw-r--r--lib-src/emacsclient.c32
-rw-r--r--lib-src/ntlib.c22
3 files changed, 32 insertions, 31 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 03cf3efbd06..1b6a16dd524 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,12 @@
12010-07-20 Juanma Barranquero <lekktu@gmail.com>
2
3 * emacsclient.c (get_current_dir_name, w32_get_resource)
4 (w32_getenv, w32_set_user_model_id, w32_window_app, w32_execvp)
5 (close_winsock, initialize_sockets, w32_find_emacs_process)
6 (w32_give_focus):
7 * ntlib.c (getlogin, getuid, getgid, getegid):
8 Convert definitions to standard C.
9
12010-07-12 Andreas Schwab <schwab@linux-m68k.org> 102010-07-12 Andreas Schwab <schwab@linux-m68k.org>
2 11
3 * Makefile.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS) 12 * Makefile.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS)
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 79143ff7a34..bafc7e02720 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -235,7 +235,7 @@ xstrdup (const char *s)
235 Any other returned value must be freed with free. This is used 235 Any other returned value must be freed with free. This is used
236 only when get_current_dir_name is not defined on the system. */ 236 only when get_current_dir_name is not defined on the system. */
237char* 237char*
238get_current_dir_name () 238get_current_dir_name (void)
239{ 239{
240 char *buf; 240 char *buf;
241 char *pwd; 241 char *pwd;
@@ -311,10 +311,7 @@ get_current_dir_name ()
311 Return NULL if the variable was not found, or it was empty. 311 Return NULL if the variable was not found, or it was empty.
312 This code is based on w32_get_resource (w32.c). */ 312 This code is based on w32_get_resource (w32.c). */
313char * 313char *
314w32_get_resource (predefined, key, type) 314w32_get_resource (HKEY predefined, char *key, LPDWORD type)
315 HKEY predefined;
316 char *key;
317 LPDWORD type;
318{ 315{
319 HKEY hrootkey = NULL; 316 HKEY hrootkey = NULL;
320 char *result = NULL; 317 char *result = NULL;
@@ -347,8 +344,7 @@ w32_get_resource (predefined, key, type)
347 variables in the registry if they don't appear in the environment. 344 variables in the registry if they don't appear in the environment.
348*/ 345*/
349char * 346char *
350w32_getenv (envvar) 347w32_getenv (char *envvar)
351 char *envvar;
352{ 348{
353 char *value; 349 char *value;
354 DWORD dwType; 350 DWORD dwType;
@@ -396,7 +392,7 @@ w32_getenv (envvar)
396} 392}
397 393
398void 394void
399w32_set_user_model_id () 395w32_set_user_model_id (void)
400{ 396{
401 HMODULE shell; 397 HMODULE shell;
402 HRESULT (WINAPI * set_user_model) (wchar_t * id); 398 HRESULT (WINAPI * set_user_model) (wchar_t * id);
@@ -423,7 +419,7 @@ w32_set_user_model_id ()
423} 419}
424 420
425int 421int
426w32_window_app () 422w32_window_app (void)
427{ 423{
428 static int window_app = -1; 424 static int window_app = -1;
429 char szTitle[MAX_PATH]; 425 char szTitle[MAX_PATH];
@@ -446,13 +442,11 @@ w32_window_app ()
446 This is necessary due to the broken implementation of exec* routines in 442 This is necessary due to the broken implementation of exec* routines in
447 the Microsoft libraries: they concatenate the arguments together without 443 the Microsoft libraries: they concatenate the arguments together without
448 quoting special characters, and pass the result to CreateProcess, with 444 quoting special characters, and pass the result to CreateProcess, with
449 predictably bad results. By contrast, Posix execvp passes the arguments 445 predictably bad results. By contrast, POSIX execvp passes the arguments
450 directly into the argv array of the child process. 446 directly into the argv array of the child process.
451*/ 447*/
452int 448int
453w32_execvp (path, argv) 449w32_execvp (const char *path, char **argv)
454 char *path;
455 char **argv;
456{ 450{
457 int i; 451 int i;
458 452
@@ -900,15 +894,15 @@ file_name_absolute_p (const unsigned char *filename)
900 894
901#ifdef WINDOWSNT 895#ifdef WINDOWSNT
902/* Wrapper to make WSACleanup a cdecl, as required by atexit. */ 896/* Wrapper to make WSACleanup a cdecl, as required by atexit. */
903void 897void __cdecl
904__cdecl close_winsock () 898close_winsock (void)
905{ 899{
906 WSACleanup (); 900 WSACleanup ();
907} 901}
908 902
909/* Initialize the WinSock2 library. */ 903/* Initialize the WinSock2 library. */
910void 904void
911initialize_sockets () 905initialize_sockets (void)
912{ 906{
913 WSADATA wsaData; 907 WSADATA wsaData;
914 908
@@ -1408,9 +1402,7 @@ FARPROC set_fg; /* Pointer to AllowSetForegroundWindow. */
1408FARPROC get_wc; /* Pointer to RealGetWindowClassA. */ 1402FARPROC get_wc; /* Pointer to RealGetWindowClassA. */
1409 1403
1410BOOL CALLBACK 1404BOOL CALLBACK
1411w32_find_emacs_process (hWnd, lParam) 1405w32_find_emacs_process (HWND hWnd, LPARAM lParam)
1412 HWND hWnd;
1413 LPARAM lParam;
1414{ 1406{
1415 DWORD pid; 1407 DWORD pid;
1416 char class[6]; 1408 char class[6];
@@ -1438,7 +1430,7 @@ w32_find_emacs_process (hWnd, lParam)
1438 * process id = emacs_pid. If found, allow it to grab the focus. 1430 * process id = emacs_pid. If found, allow it to grab the focus.
1439 */ 1431 */
1440void 1432void
1441w32_give_focus () 1433w32_give_focus (void)
1442{ 1434{
1443 HANDLE user32; 1435 HANDLE user32;
1444 1436
diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c
index c815f32d51d..c24b35d9a19 100644
--- a/lib-src/ntlib.c
+++ b/lib-src/ntlib.c
@@ -38,7 +38,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
38 would necessitate including windows.h in the files that used it. 38 would necessitate including windows.h in the files that used it.
39 This is much easier. */ 39 This is much easier. */
40void 40void
41sleep(unsigned long seconds) 41sleep (unsigned long seconds)
42{ 42{
43 Sleep (seconds * 1000); 43 Sleep (seconds * 1000);
44} 44}
@@ -56,7 +56,7 @@ static HANDLE getppid_parent;
56static int getppid_ppid; 56static int getppid_ppid;
57 57
58int 58int
59getppid(void) 59getppid (void)
60{ 60{
61 char *ppid; 61 char *ppid;
62 DWORD result; 62 DWORD result;
@@ -64,7 +64,7 @@ getppid(void)
64 ppid = getenv ("EM_PARENT_PROCESS_ID"); 64 ppid = getenv ("EM_PARENT_PROCESS_ID");
65 if (!ppid) 65 if (!ppid)
66 { 66 {
67 printf("no pid.\n"); 67 printf ("no pid.\n");
68 return 0; 68 return 0;
69 } 69 }
70 else 70 else
@@ -74,11 +74,11 @@ getppid(void)
74 74
75 if (!getppid_parent) 75 if (!getppid_parent)
76 { 76 {
77 getppid_parent = OpenProcess (SYNCHRONIZE, FALSE, atoi(ppid)); 77 getppid_parent = OpenProcess (SYNCHRONIZE, FALSE, atoi (ppid));
78 if (!getppid_parent) 78 if (!getppid_parent)
79 { 79 {
80 printf ("Failed to open handle to parent process: %d\n", 80 printf ("Failed to open handle to parent process: %d\n",
81 GetLastError()); 81 GetLastError ());
82 exit (1); 82 exit (1);
83 } 83 }
84 } 84 }
@@ -94,13 +94,13 @@ getppid(void)
94 return 1; 94 return 1;
95 case WAIT_FAILED: 95 case WAIT_FAILED:
96 default: 96 default:
97 printf ("Checking parent status failed: %d\n", GetLastError()); 97 printf ("Checking parent status failed: %d\n", GetLastError ());
98 exit (1); 98 exit (1);
99 } 99 }
100} 100}
101 101
102char * 102char *
103getlogin () 103getlogin (void)
104{ 104{
105 static char user_name[256]; 105 static char user_name[256];
106 DWORD length = sizeof (user_name); 106 DWORD length = sizeof (user_name);
@@ -120,19 +120,19 @@ cuserid (char * s)
120} 120}
121 121
122unsigned 122unsigned
123getuid () 123getuid (void)
124{ 124{
125 return 0; 125 return 0;
126} 126}
127 127
128unsigned 128unsigned
129getgid () 129getgid (void)
130{ 130{
131 return 0; 131 return 0;
132} 132}
133 133
134unsigned 134unsigned
135getegid () 135getegid (void)
136{ 136{
137 return 0; 137 return 0;
138} 138}
@@ -219,7 +219,7 @@ sys_ctime (const time_t *t)
219} 219}
220 220
221FILE * 221FILE *
222sys_fopen(const char * path, const char * mode) 222sys_fopen (const char * path, const char * mode)
223{ 223{
224 return fopen (path, mode); 224 return fopen (path, mode);
225} 225}