From f0227ea3c78d8d23dc35f0939219649447eecfae Mon Sep 17 00:00:00 2001
From: Christopher Faylor <me@cgf.cx>
Date: Mon, 23 Sep 2002 00:31:31 +0000
Subject: [PATCH] More GNUify non-GNU formatted functions calls throughout.

---
 winsup/cygwin/ChangeLog           |  4 ++++
 winsup/cygwin/cygheap.cc          |  2 +-
 winsup/cygwin/delqueue.cc         |  6 +++---
 winsup/cygwin/dir.cc              |  2 +-
 winsup/cygwin/dll_init.cc         |  2 +-
 winsup/cygwin/dtable.cc           |  2 +-
 winsup/cygwin/environ.cc          | 10 +++++-----
 winsup/cygwin/fhandler.cc         |  2 +-
 winsup/cygwin/fhandler_mem.cc     | 10 +++++-----
 winsup/cygwin/fhandler_process.cc |  4 ++--
 winsup/cygwin/fhandler_termios.cc | 26 +++++++++++++-------------
 winsup/cygwin/ipc.cc              |  4 ++--
 winsup/cygwin/localtime.cc        |  6 +++---
 winsup/cygwin/malloc_wrapper.cc   |  5 -----
 winsup/cygwin/mmap.cc             | 12 ++++++------
 winsup/cygwin/net.cc              |  2 +-
 winsup/cygwin/path.cc             |  2 +-
 winsup/cygwin/sched.cc            | 10 +++++-----
 winsup/cygwin/select.cc           | 28 ++++++++++++++--------------
 winsup/cygwin/signal.cc           |  4 ++--
 winsup/cygwin/strace.cc           |  6 +++---
 winsup/cygwin/times.cc            |  4 ++--
 winsup/cygwin/window.cc           |  2 +-
 23 files changed, 77 insertions(+), 78 deletions(-)

diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index da2ff4c9a..d6ec54bc6 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,7 @@
+2002-09-22  Christopher Faylor  <cgf@redhat.com>
+
+	More GNUify non-GNU formatted functions calls throughout.
+
 2002-09-22  Christopher Faylor  <cgf@redhat.com>
 
 	* Makefile.in (DLL_O_FILES): Restore formatting.
diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc
index 937c3392c..60eafcd44 100644
--- a/winsup/cygwin/cygheap.cc
+++ b/winsup/cygwin/cygheap.cc
@@ -263,7 +263,7 @@ _crealloc (void *ptr, int size)
 
 /* End Copyright (C) 1997 DJ Delorie */
 
-#define sizeof_cygheap(n) ((n) + sizeof(cygheap_entry))
+#define sizeof_cygheap(n) ((n) + sizeof (cygheap_entry))
 
 #define N ((cygheap_entry *) NULL)
 #define tocygheap(s) ((cygheap_entry *) (((char *) (s)) - (int) (N->data)))
diff --git a/winsup/cygwin/delqueue.cc b/winsup/cygwin/delqueue.cc
index b7314eab2..11c8c503b 100644
--- a/winsup/cygwin/delqueue.cc
+++ b/winsup/cygwin/delqueue.cc
@@ -24,7 +24,7 @@ void
 delqueue_list::init ()
 {
   empty = 1;
-  memset(inuse, 0, MAX_DELQUEUES_PENDING);
+  memset (inuse, 0, MAX_DELQUEUES_PENDING);
 }
 
 void
@@ -43,7 +43,7 @@ delqueue_list::queue_file (const char *dosname)
   {
     /* check for duplicates */
     for (int i=0; i < MAX_DELQUEUES_PENDING; i++)
-      if (inuse[i] && strcmp(name[i], temp) == 0)
+      if (inuse[i] && strcmp (name[i], temp) == 0)
 	return;
   }
 
@@ -52,7 +52,7 @@ delqueue_list::queue_file (const char *dosname)
       {
 	/* set the name first, in case someone else is running the
 	   queue they'll get a valid name */
-	strcpy(name[i], temp);
+	strcpy (name[i], temp);
 	inuse[i] = 1;
 	empty = 0;
 	debug_printf ("adding '%s' to queue %d", temp, i);
diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc
index 45ba57ff6..a2024233d 100644
--- a/winsup/cygwin/dir.cc
+++ b/winsup/cygwin/dir.cc
@@ -240,7 +240,7 @@ mkdir (const char *dir, mode_t mode)
       goto done;
     }
 
-  nofinalslash(real_dir.get_win32 (), real_dir.get_win32 ());
+  nofinalslash (real_dir.get_win32 (), real_dir.get_win32 ());
   if (! writable_directory (real_dir.get_win32 ()))
     goto done;
 
diff --git a/winsup/cygwin/dll_init.cc b/winsup/cygwin/dll_init.cc
index 5a5b165dc..51441ab39 100644
--- a/winsup/cygwin/dll_init.cc
+++ b/winsup/cygwin/dll_init.cc
@@ -29,7 +29,7 @@ static int dll_global_dtors_recorded;
 
 /* Run destructors for all DLLs on exit. */
 static void
-dll_global_dtors()
+dll_global_dtors ()
 {
   for (dll *d = dlls.istart (DLL_ANY); d; d = dlls.inext ())
     d->p.run_dtors ();
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index 9fc6f4e21..4f2b544a6 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -691,7 +691,7 @@ dtable::vfork_child_fixup ()
 }
 
 #define DEVICE_PREFIX "\\device\\"
-#define DEVICE_PREFIX_LEN sizeof(DEVICE_PREFIX) - 1
+#define DEVICE_PREFIX_LEN sizeof (DEVICE_PREFIX) - 1
 #define REMOTE "\\Device\\LanmanRedirector\\"
 #define REMOTE_LEN sizeof (REMOTE) - 1
 
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index ce6c8ba5d..d2385f39b 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -622,7 +622,7 @@ regopt (const char *name)
   /* FIXME: should not be under mount */
   reg_key r (KEY_READ, CYGWIN_INFO_PROGRAM_OPTIONS_NAME, NULL);
   char buf[MAX_PATH];
-  char lname[strlen(name) + 1];
+  char lname[strlen (name) + 1];
   strlwr (strcpy (lname, name));
 
   if (r.get_string (lname, buf, sizeof (buf) - 1, "") == ERROR_SUCCESS)
@@ -665,8 +665,8 @@ environ_init (char **envp, int envc)
     {
       for (int i = 0; conv_envvars[i].name != NULL; i++)
 	{
-	  conv_start_chars[cyg_tolower(conv_envvars[i].name[0])] = 1;
-	  conv_start_chars[cyg_toupper(conv_envvars[i].name[0])] = 1;
+	  conv_start_chars[cyg_tolower (conv_envvars[i].name[0])] = 1;
+	  conv_start_chars[cyg_toupper (conv_envvars[i].name[0])] = 1;
 	}
       initted = 1;
     }
@@ -728,8 +728,8 @@ environ_init (char **envp, int envc)
 	ucenv (newp, eq);
       if (*newp == 'T' && strncmp (newp, "TERM=", 5) == 0)
 	sawTERM = 1;
-      if (*newp == 'C' && strncmp (newp, "CYGWIN=", sizeof("CYGWIN=") - 1) == 0)
-	parse_options (newp + sizeof("CYGWIN=") - 1);
+      if (*newp == 'C' && strncmp (newp, "CYGWIN=", sizeof ("CYGWIN=") - 1) == 0)
+	parse_options (newp + sizeof ("CYGWIN=") - 1);
       if (*eq && conv_start_chars[(unsigned char)envp[i][0]])
 	posify (envp + i, *++eq ? eq : --eq);
       debug_printf ("%p: %s", envp[i], envp[i]);
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index e1271bc79..fccbb361e 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -617,7 +617,7 @@ fhandler_base::write (const void *ptr, size_t len)
 	     fill in the gap with zeros. - DJ */
 	  char zeros[512];
 	  int number_of_zeros_to_write = current_position - actual_length;
-	  memset(zeros, 0, 512);
+	  memset (zeros, 0, 512);
 	  SetFilePointer (get_handle (), 0, 0, FILE_END);
 	  while (number_of_zeros_to_write > 0)
 	    {
diff --git a/winsup/cygwin/fhandler_mem.cc b/winsup/cygwin/fhandler_mem.cc
index 7613b11ec..177e645c0 100644
--- a/winsup/cygwin/fhandler_mem.cc
+++ b/winsup/cygwin/fhandler_mem.cc
@@ -116,7 +116,7 @@ fhandler_dev_mem::open (path_conv *, int flags, mode_t)
 
   HANDLE mem;
   NTSTATUS ret = NtOpenSection (&mem, section_access, &attr);
-  if (!NT_SUCCESS(ret))
+  if (!NT_SUCCESS (ret))
     {
       __seterrno_from_win_error (RtlNtStatusToDosError (ret));
       set_io_handle (NULL);
@@ -166,7 +166,7 @@ fhandler_dev_mem::write (const void *ptr, size_t ulen)
 
   memcpy ((char *) viewmem + (pos - phys.QuadPart), ptr, ulen);
 
-  if (!NT_SUCCESS(ret = NtUnmapViewOfSection (INVALID_HANDLE_VALUE, viewmem)))
+  if (!NT_SUCCESS (ret = NtUnmapViewOfSection (INVALID_HANDLE_VALUE, viewmem)))
     {
       __seterrno_from_win_error (RtlNtStatusToDosError (ret));
       return -1;
@@ -214,7 +214,7 @@ fhandler_dev_mem::read (void *ptr, size_t ulen)
 
   memcpy (ptr, (char *) viewmem + (pos - phys.QuadPart), ulen);
 
-  if (!NT_SUCCESS(ret = NtUnmapViewOfSection (INVALID_HANDLE_VALUE, viewmem)))
+  if (!NT_SUCCESS (ret = NtUnmapViewOfSection (INVALID_HANDLE_VALUE, viewmem)))
     {
       __seterrno_from_win_error (RtlNtStatusToDosError (ret));
       return -1;
@@ -304,7 +304,7 @@ fhandler_dev_mem::mmap (caddr_t *addr, size_t len, DWORD access,
 
   HANDLE h;
   NTSTATUS ret = NtOpenSection (&h, section_access, &attr);
-  if (!NT_SUCCESS(ret))
+  if (!NT_SUCCESS (ret))
     {
       __seterrno_from_win_error (RtlNtStatusToDosError (ret));
       syscall_printf ("-1 = mmap(): NtOpenSection failed with %E");
@@ -348,7 +348,7 @@ int
 fhandler_dev_mem::munmap (HANDLE h, caddr_t addr, size_t len)
 {
   NTSTATUS ret;
-  if (!NT_SUCCESS(ret = NtUnmapViewOfSection (INVALID_HANDLE_VALUE, addr)))
+  if (!NT_SUCCESS (ret = NtUnmapViewOfSection (INVALID_HANDLE_VALUE, addr)))
     {
       __seterrno_from_win_error (RtlNtStatusToDosError (ret));
       return -1;
diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc
index 0633b0ebc..755d639af 100644
--- a/winsup/cygwin/fhandler_process.cc
+++ b/winsup/cygwin/fhandler_process.cc
@@ -62,7 +62,7 @@ static const char * const process_listing[] =
 };
 
 static const int PROCESS_LINK_COUNT =
-  (sizeof(process_listing) / sizeof(const char *)) - 1;
+  (sizeof (process_listing) / sizeof (const char *)) - 1;
 
 static off_t format_process_stat (_pinfo *p, char *destbuf, size_t maxsize);
 static off_t format_process_status (_pinfo *p, char *destbuf, size_t maxsize);
@@ -475,7 +475,7 @@ format_process_stat (_pinfo *p, char *destbuf, size_t maxsize)
     }
   else
     {
-      start_time = (GetTickCount() / 1000 - time(NULL) + p->start_time) * HZ;
+      start_time = (GetTickCount () / 1000 - time (NULL) + p->start_time) * HZ;
     }
   return __small_sprintf (destbuf, "%d (%s) %c "
 				   "%d %d %d %d %d "
diff --git a/winsup/cygwin/fhandler_termios.cc b/winsup/cygwin/fhandler_termios.cc
index c1cca494c..cfdb1578f 100644
--- a/winsup/cygwin/fhandler_termios.cc
+++ b/winsup/cygwin/fhandler_termios.cc
@@ -225,11 +225,11 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
       if (tc->ti.c_lflag & ISIG)
 	{
 	  int sig;
-	  if (CCEQ(tc->ti.c_cc[VINTR], c))
+	  if (CCEQ (tc->ti.c_cc[VINTR], c))
 	    sig = SIGINT;
-	  else if (CCEQ(tc->ti.c_cc[VQUIT], c))
+	  else if (CCEQ (tc->ti.c_cc[VQUIT], c))
 	    sig = SIGQUIT;
-	  else if (CCEQ(tc->ti.c_cc[VSUSP], c))
+	  else if (CCEQ (tc->ti.c_cc[VSUSP], c))
 	    sig = SIGTSTP;
 	  else
 	    goto not_a_sig;
@@ -244,7 +244,7 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
     not_a_sig:
       if (tc->ti.c_iflag & IXON)
 	{
-	  if (CCEQ(tc->ti.c_cc[VSTOP], c))
+	  if (CCEQ (tc->ti.c_cc[VSTOP], c))
 	    {
 	      if (!tc->output_stopped)
 		{
@@ -253,7 +253,7 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
 		}
 	      continue;
 	    }
-	  else if (CCEQ(tc->ti.c_cc[VSTART], c))
+	  else if (CCEQ (tc->ti.c_cc[VSTART], c))
 	    {
     restart_output:
 	      tc->output_stopped = 0;
@@ -263,20 +263,20 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
 	  else if ((tc->ti.c_iflag & IXANY) && tc->output_stopped)
 	    goto restart_output;
 	}
-      if (iscanon && tc->ti.c_lflag & IEXTEN && CCEQ(tc->ti.c_cc[VDISCARD], c))
+      if (iscanon && tc->ti.c_lflag & IEXTEN && CCEQ (tc->ti.c_cc[VDISCARD], c))
 	{
 	  tc->ti.c_lflag ^= FLUSHO;
 	  continue;
 	}
       if (!iscanon)
 	/* nothing */;
-      else if (CCEQ(tc->ti.c_cc[VERASE], c))
+      else if (CCEQ (tc->ti.c_cc[VERASE], c))
 	{
 	  if (eat_readahead (1))
 	    echo_erase ();
 	  continue;
 	}
-      else if (CCEQ(tc->ti.c_cc[VWERASE], c))
+      else if (CCEQ (tc->ti.c_cc[VWERASE], c))
 	{
 	  int ch;
 	  do
@@ -287,7 +287,7 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
 	  while ((ch = peek_readahead (1)) >= 0 && !isspace (ch));
 	  continue;
 	}
-      else if (CCEQ(tc->ti.c_cc[VKILL], c))
+      else if (CCEQ (tc->ti.c_cc[VKILL], c))
 	{
 	  int nchars = eat_readahead (-1);
 	  if (tc->ti.c_lflag & ECHO)
@@ -295,7 +295,7 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
 	      echo_erase (1);
 	  continue;
 	}
-      else if (CCEQ(tc->ti.c_cc[VREPRINT], c))
+      else if (CCEQ (tc->ti.c_cc[VREPRINT], c))
 	{
 	  if (tc->ti.c_lflag & ECHO)
 	    {
@@ -304,14 +304,14 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
 	    }
 	  continue;
 	}
-      else if (CCEQ(tc->ti.c_cc[VEOF], c))
+      else if (CCEQ (tc->ti.c_cc[VEOF], c))
 	{
 	  termios_printf ("EOF");
 	  input_done = 1;
 	  continue;
 	}
-      else if (CCEQ(tc->ti.c_cc[VEOL], c) ||
-	       CCEQ(tc->ti.c_cc[VEOL2], c) ||
+      else if (CCEQ (tc->ti.c_cc[VEOL], c) ||
+	       CCEQ (tc->ti.c_cc[VEOL2], c) ||
 	       c == '\n')
 	{
 	  set_input_done (1);
diff --git a/winsup/cygwin/ipc.cc b/winsup/cygwin/ipc.cc
index 4665fd84a..538791553 100644
--- a/winsup/cygwin/ipc.cc
+++ b/winsup/cygwin/ipc.cc
@@ -19,10 +19,10 @@ extern "C"
 
 /* Notes: we return a valid key even if id's low order 8 bits are 0. */
 key_t
-ftok(const char *path, int id)
+ftok (const char *path, int id)
 {
   struct stat statbuf;
-  if (stat(path, &statbuf))
+  if (stat (path, &statbuf))
     {
       /* stat set the appropriate errno for us */
       return (key_t) -1;
diff --git a/winsup/cygwin/localtime.cc b/winsup/cygwin/localtime.cc
index 8267bdebb..3000eaffd 100644
--- a/winsup/cygwin/localtime.cc
+++ b/winsup/cygwin/localtime.cc
@@ -777,8 +777,8 @@ tzload(const char *name, struct state *sp)
 
 		if (fid == -2)
 		  {
-		    memcpy(u.buf, _posixrules_data, sizeof(_posixrules_data));
-		    i = sizeof(_posixrules_data);
+		    memcpy(u.buf, _posixrules_data, sizeof (_posixrules_data));
+		    i = sizeof (_posixrules_data);
 		  }
 		else
 		  {
@@ -1473,7 +1473,7 @@ tzset P((void))
 
 	if (lcl_is_set > 0  &&  strcmp(lcl_TZname, name) == 0)
 		return;
-	lcl_is_set = (strlen(name) < sizeof(lcl_TZname));
+	lcl_is_set = (strlen(name) < sizeof (lcl_TZname));
 	if (lcl_is_set)
 		(void) strcpy(lcl_TZname, name);
 
diff --git a/winsup/cygwin/malloc_wrapper.cc b/winsup/cygwin/malloc_wrapper.cc
index 51cc81832..bd671a6fc 100644
--- a/winsup/cygwin/malloc_wrapper.cc
+++ b/winsup/cygwin/malloc_wrapper.cc
@@ -35,11 +35,6 @@ details. */
 static int export_malloc_called;
 static int use_internal_malloc = 1;
 
-#undef in
-#undef out
-#define in(x)
-#define out(x)
-
 #ifdef MALLOC_DEBUG
 extern "C" void * _sbrk (size_t incr_arg);
 
diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc
index e2684630e..bb45ac8e6 100644
--- a/winsup/cygwin/mmap.cc
+++ b/winsup/cygwin/mmap.cc
@@ -25,8 +25,8 @@ details. */
 
 #define PAGE_CNT(bytes) howmany((bytes),getpagesize())
 
-#define PGBITS		(sizeof(DWORD)*8)
-#define MAPSIZE(pages)	howmany((pages),PGBITS)
+#define PGBITS		(sizeof (DWORD)*8)
+#define MAPSIZE(pages)	howmany ((pages), PGBITS)
 
 #define MAP_SET(n)	(map_map_[(n)/PGBITS] |= (1L << ((n) % PGBITS)))
 #define MAP_CLR(n)	(map_map_[(n)/PGBITS] &= ~(1L << ((n) % PGBITS)))
@@ -80,7 +80,7 @@ class mmap_record
     void alloc_map ()
       {
 	/* Allocate one bit per page */
-	map_map_ = (DWORD *) calloc (MAPSIZE(PAGE_CNT (size_to_map_)),
+	map_map_ = (DWORD *) calloc (MAPSIZE (PAGE_CNT (size_to_map_)),
 				     sizeof (DWORD));
 	if (wincap.virtual_protect_works_on_shared_pages ())
 	  {
@@ -191,7 +191,7 @@ mmap_record::unmap_map (caddr_t addr, DWORD len)
     MAP_CLR (off);
   /* Return TRUE if all pages are free'd which may result in unmapping
      the whole chunk. */
-  for (len = MAPSIZE(PAGE_CNT (size_to_map_)); len > 0; )
+  for (len = MAPSIZE (PAGE_CNT (size_to_map_)); len > 0; )
     if (map_map_[--len])
       return FALSE;
   return TRUE;
@@ -277,7 +277,7 @@ public:
 list::list ()
 : nrecs (0), maxrecs (10), fd (0), hash (0)
 {
-  recs = (mmap_record *) malloc (10 * sizeof(mmap_record));
+  recs = (mmap_record *) malloc (10 * sizeof (mmap_record));
 }
 
 list::~list ()
@@ -362,7 +362,7 @@ public:
 
 map::map ()
 {
-  lists = (list **) malloc (10 * sizeof(list *));
+  lists = (list **) malloc (10 * sizeof (list *));
   nlists = 0;
   maxlists = 10;
 }
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index 32b4b2ef1..ecf0cdf45 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -918,7 +918,7 @@ dup_hostent_ptr (struct hostent *src)
   if (src->h_aliases && !(dst->h_aliases = dup_char_list (src->h_aliases)))
     goto out;
   if (src->h_addr_list
-      && !(dst->h_addr_list = dup_addr_list(src->h_addr_list, src->h_length)))
+      && !(dst->h_addr_list = dup_addr_list (src->h_addr_list, src->h_length)))
     goto out;
 
   debug_printf ("hostent: copied %s", dst->h_name);
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index a185e60e9..29e21674b 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1304,7 +1304,7 @@ slash_unc_prefix_p (const char *path)
 	     && isalpha (path[2])
 	     && path[3] != 0
 	     && !isdirsep (path[3])
-	     && ((p = strpbrk(path + 3, "\\/")) != NULL));
+	     && ((p = strpbrk (path + 3, "\\/")) != NULL));
   if (!ret || p == NULL)
     return ret;
   return ret && isalnum (p[1]);
diff --git a/winsup/cygwin/sched.cc b/winsup/cygwin/sched.cc
index 7b4074d7f..185530210 100644
--- a/winsup/cygwin/sched.cc
+++ b/winsup/cygwin/sched.cc
@@ -1,6 +1,6 @@
 /* sched.cc: scheduler interface for Cygwin
 
-   Copyright 2001  Red Hat, Inc.
+   Copyright 2001, 2002  Red Hat, Inc.
 
    Written by Robert Collins <rbtcollins@hotmail.com>
 
@@ -81,7 +81,7 @@ sched_get_priority_min (int policy)
 
 /* Check a scheduler parameter struct for valid settings */
 int
-valid_sched_parameters(const struct sched_param *param)
+valid_sched_parameters (const struct sched_param *param)
 {
   if (param->sched_priority < -14 || param->sched_priority > 15)
     {
@@ -283,7 +283,7 @@ sched_setparam (pid_t pid, const struct sched_param *param)
       return -1;
     }
 
-  if (!valid_sched_parameters(param))
+  if (!valid_sched_parameters (param))
     {
       set_errno (EINVAL);
       return -1;
@@ -400,7 +400,7 @@ sched_setparam (pid_t pid, const struct sched_param *param)
  * a wide range of values is to allow more flexible code in the future.
  */
 int
-sched_set_thread_priority(HANDLE thread, int priority)
+sched_set_thread_priority (HANDLE thread, int priority)
 {
   int real_pri;
   real_pri = 16 - ((priority + 16) >> 1);
@@ -418,7 +418,7 @@ sched_set_thread_priority(HANDLE thread, int priority)
   else
     real_pri = THREAD_PRIORITY_HIGHEST;
 
-  if (!SetThreadPriority(thread, real_pri))
+  if (!SetThreadPriority (thread, real_pri))
     /* invalid handle, no access are the only expected errors. */
     return EPERM;
   return 0;
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index c540563fd..1b9f9d93f 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -555,9 +555,9 @@ out:
 static int
 start_thread_pipe (select_record *me, select_stuff *stuff)
 {
-  if (stuff->device_specific[FHDEVN(FH_PIPE)])
+  if (stuff->device_specific[FHDEVN (FH_PIPE)])
     {
-      me->h = *((pipeinf *) stuff->device_specific[FHDEVN(FH_PIPE)])->thread;
+      me->h = *((pipeinf *) stuff->device_specific[FHDEVN (FH_PIPE)])->thread;
       return 1;
     }
   pipeinf *pi = new pipeinf;
@@ -567,20 +567,20 @@ start_thread_pipe (select_record *me, select_stuff *stuff)
   me->h = *pi->thread;
   if (!me->h)
     return 0;
-  stuff->device_specific[FHDEVN(FH_PIPE)] = (void *)pi;
+  stuff->device_specific[FHDEVN (FH_PIPE)] = (void *)pi;
   return 1;
 }
 
 static void
 pipe_cleanup (select_record *, select_stuff *stuff)
 {
-  pipeinf *pi = (pipeinf *)stuff->device_specific[FHDEVN(FH_PIPE)];
+  pipeinf *pi = (pipeinf *)stuff->device_specific[FHDEVN (FH_PIPE)];
   if (pi && pi->thread)
     {
       pi->stop_thread_pipe = true;
       pi->thread->detach ();
       delete pi;
-      stuff->device_specific[FHDEVN(FH_PIPE)] = NULL;
+      stuff->device_specific[FHDEVN (FH_PIPE)] = NULL;
     }
 }
 
@@ -976,9 +976,9 @@ thread_serial (void *arg)
 static int
 start_thread_serial (select_record *me, select_stuff *stuff)
 {
-  if (stuff->device_specific[FHDEVN(FH_SERIAL)])
+  if (stuff->device_specific[FHDEVN (FH_SERIAL)])
     {
-      me->h = *((serialinf *) stuff->device_specific[FHDEVN(FH_SERIAL)])->thread;
+      me->h = *((serialinf *) stuff->device_specific[FHDEVN (FH_SERIAL)])->thread;
       return 1;
     }
   serialinf *si = new serialinf;
@@ -986,20 +986,20 @@ start_thread_serial (select_record *me, select_stuff *stuff)
   si->stop_thread_serial = FALSE;
   si->thread = new cygthread (thread_serial, (LPVOID)si, "select_serial");
   me->h = *si->thread;
-  stuff->device_specific[FHDEVN(FH_SERIAL)] = (void *)si;
+  stuff->device_specific[FHDEVN (FH_SERIAL)] = (void *)si;
   return 1;
 }
 
 static void
 serial_cleanup (select_record *, select_stuff *stuff)
 {
-  serialinf *si = (serialinf *)stuff->device_specific[FHDEVN(FH_SERIAL)];
+  serialinf *si = (serialinf *)stuff->device_specific[FHDEVN (FH_SERIAL)];
   if (si && si->thread)
     {
       si->stop_thread_serial = true;
       si->thread->detach ();
       delete si;
-      stuff->device_specific[FHDEVN(FH_SERIAL)] = NULL;
+      stuff->device_specific[FHDEVN (FH_SERIAL)] = NULL;
     }
 }
 
@@ -1247,7 +1247,7 @@ start_thread_socket (select_record *me, select_stuff *stuff)
 {
   socketinf *si;
 
-  if ((si = (socketinf *)stuff->device_specific[FHDEVN(FH_SOCKET)]))
+  if ((si = (socketinf *)stuff->device_specific[FHDEVN (FH_SOCKET)]))
     {
       me->h = *si->thread;
       return 1;
@@ -1315,7 +1315,7 @@ start_thread_socket (select_record *me, select_stuff *stuff)
   select_printf ("exitsock %p", si->exitsock);
   WINSOCK_FD_SET ((HANDLE) si->exitsock, &si->readfds);
   WINSOCK_FD_SET ((HANDLE) si->exitsock, &si->exceptfds);
-  stuff->device_specific[FHDEVN(FH_SOCKET)] = (void *) si;
+  stuff->device_specific[FHDEVN (FH_SOCKET)] = (void *) si;
   si->start = &stuff->start;
   select_printf ("stuff_start %p", &stuff->start);
   si->thread = new cygthread (thread_socket, (LPVOID)si, "select_socket");
@@ -1331,7 +1331,7 @@ err:
 void
 socket_cleanup (select_record *, select_stuff *stuff)
 {
-  socketinf *si = (socketinf *)stuff->device_specific[FHDEVN(FH_SOCKET)];
+  socketinf *si = (socketinf *)stuff->device_specific[FHDEVN (FH_SOCKET)];
   select_printf ("si %p si->thread %p", si, si ? si->thread : NULL);
   if (si && si->thread)
     {
@@ -1359,7 +1359,7 @@ socket_cleanup (select_record *, select_stuff *stuff)
       si->thread->detach ();
       shutdown (si->exitsock, SD_BOTH);
       closesocket (si->exitsock);
-      stuff->device_specific[FHDEVN(FH_SOCKET)] = NULL;
+      stuff->device_specific[FHDEVN (FH_SOCKET)] = NULL;
       delete si;
     }
   select_printf ("returning");
diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc
index 5b42a1ff1..07417de98 100644
--- a/winsup/cygwin/signal.cc
+++ b/winsup/cygwin/signal.cc
@@ -202,7 +202,7 @@ _kill (pid_t pid, int sig)
 
   /* Silently ignore stop signals from a member of orphaned process group.
      FIXME: Why??? */
-  if (ISSTATE(myself, PID_ORPHANED) &&
+  if (ISSTATE (myself, PID_ORPHANED) &&
       (sig == SIGTSTP || sig == SIGTTIN || sig == SIGTTOU))
     sig = 0;
 
@@ -230,7 +230,7 @@ kill_pgrp (pid_t pid, int sig)
       /* Is it a process we want to kill?  */
       if ((pid == 0 && (p->pgid != myself->pgid || p->ctty != myself->ctty)) ||
 	  (pid > 1 && p->pgid != pid) ||
-	  (sig < 0 && NOTSTATE(p, PID_STOPPED)))
+	  (sig < 0 && NOTSTATE (p, PID_STOPPED)))
 	continue;
       sigproc_printf ("killing pid %d, pgrp %d, p->ctty %d, myself->ctty %d",
 		      p->pid, p->pgid, p->ctty, myself->ctty);
diff --git a/winsup/cygwin/strace.cc b/winsup/cygwin/strace.cc
index 4a8b48c3c..506d44ec9 100644
--- a/winsup/cygwin/strace.cc
+++ b/winsup/cygwin/strace.cc
@@ -20,8 +20,8 @@ details. */
 #include "hires.h"
 #include "cygthread.h"
 
-#define PROTECT(x) x[sizeof(x)-1] = 0
-#define CHECK(x) if (x[sizeof(x)-1] != 0) { small_printf ("array bound exceeded %d\n", __LINE__); ExitProcess (1); }
+#define PROTECT(x) x[sizeof (x)-1] = 0
+#define CHECK(x) if (x[sizeof (x)-1] != 0) { small_printf ("array bound exceeded %d\n", __LINE__); ExitProcess (1); }
 
 class strace NO_COPY strace;
 
@@ -77,7 +77,7 @@ getfunc (char *in_dst, const char *func)
   for (p = func; (pe = strchr (p, '(')); p = pe + 1)
     if (isalnum ((int)pe[-1]) || pe[-1] == '_')
       break;
-    else if (isspace((int)pe[-1]))
+    else if (isspace ((int)pe[-1]))
       {
 	pe--;
 	break;
diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc
index 6bb981d1a..635d89268 100644
--- a/winsup/cygwin/times.cc
+++ b/winsup/cygwin/times.cc
@@ -334,7 +334,7 @@ corelocaltime (const time_t * tim_p)
   int yleap;
   _CONST int *ip;
 #ifdef _MT_SAFE
-  struct tm &localtime_buf=_reent_winsup()->_localtime_buf;
+  struct tm &localtime_buf=_reent_winsup ()->_localtime_buf;
 #else
   static NO_COPY struct tm localtime_buf = {0};
 #endif
@@ -416,7 +416,7 @@ localtime (const time_t *tim_p)
   time_t tim = *tim_p;
   struct tm *rtm;
 
-  tzset();
+  tzset ();
 
   tim -= _timezone;
 
diff --git a/winsup/cygwin/window.cc b/winsup/cygwin/window.cc
index 7919ab17e..04ce590ee 100644
--- a/winsup/cygwin/window.cc
+++ b/winsup/cygwin/window.cc
@@ -64,7 +64,7 @@ WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 	}
       return 0;
     case WM_ASYNCIO:
-      if (WSAGETSELECTEVENT(lParam) == FD_OOB)
+      if (WSAGETSELECTEVENT (lParam) == FD_OOB)
 	raise (SIGURG);
       else
 	raise (SIGIO);