From 7694c3415795fca12f214041baf7a75e25e9d97f Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 2 May 2011 19:05:03 +0000 Subject: * win32/win32.c: remove trailing spaces and no-cuddle "else". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- win32/win32.c | 53 +++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/win32/win32.c b/win32/win32.c index a7abbfb4a6..1b72ef79ee 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1343,7 +1343,7 @@ cmdglob(NtCmdLineElement *patt, NtCmdLineElement **tail) return tail; } -// +// // Check a command string to determine if it has I/O redirection // characters that require it to be executed by a command interpreter // @@ -1403,7 +1403,7 @@ skipspace(char *ptr) return ptr; } -int +int rb_w32_cmdvector(const char *cmd, char ***vec) { int globbing, len; @@ -1431,9 +1431,9 @@ rb_w32_cmdvector(const char *cmd, char ***vec) // // Ok, parse the command line, building a list of CmdLineElements. // When we've finished, and it's an input command (meaning that it's - // the processes argv), we'll do globing and then build the argument + // the processes argv), we'll do globing and then build the argument // vector. - // The outer loop does one interation for each element seen. + // The outer loop does one interation for each element seen. // The inner loop does one interation for each character in the element. // @@ -1470,7 +1470,7 @@ rb_w32_cmdvector(const char *cmd, char ***vec) case '?': case '[': case '{': - // + // // record the fact that this element has a wildcard character // N.B. Don't glob if inside a single quoted string // @@ -1484,7 +1484,7 @@ rb_w32_cmdvector(const char *cmd, char ***vec) case '\"': // // if we're already in a string, see if this is the - // terminating close-quote. If it is, we're finished with + // terminating close-quote. If it is, we're finished with // the string, but not neccessarily with the element. // If we're not already in a string, start one. // @@ -1520,7 +1520,7 @@ rb_w32_cmdvector(const char *cmd, char ***vec) if (done) --len; // - // if it's an input vector element and it's enclosed by quotes, + // if it's an input vector element and it's enclosed by quotes, // we can remove them. // @@ -1582,10 +1582,10 @@ rb_w32_cmdvector(const char *cmd, char ***vec) } // - // Almost done! + // Almost done! // Count up the elements, then allocate space for a vector of pointers // (argv) and a string table for the elements. - // + // for (elements = 0, strsz = 0, curr = cmdhead; curr; curr = curr->next) { elements++; @@ -1605,7 +1605,7 @@ rb_w32_cmdvector(const char *cmd, char ***vec) for (vptr = *vec; *vptr; ++vptr); return vptr - *vec; } - + // // make vptr point to the start of the buffer // and ptr point to the area we'll consider the string table. @@ -1646,7 +1646,7 @@ rb_w32_cmdvector(const char *cmd, char ***vec) // // The idea here is to read all the directory names into a string table // (separated by nulls) and when one of the other dir functions is called -// return the pointer to the current file name. +// return the pointer to the current file name. // #define GetBit(bits, i) ((bits)[(i) / CHAR_BIT] & (1 << (i) % CHAR_BIT)) @@ -1738,7 +1738,7 @@ opendir_internal(WCHAR *wpath, const char *filename) // // bump the string table size by enough for the - // new name and it's null terminator + // new name and it's null terminator // tmpW = realloc(p->start, (idx + len) * sizeof(WCHAR)); if (!tmpW) { @@ -1928,7 +1928,8 @@ readdir_internal(DIR *dirp, BOOL (*conv)(const WCHAR *, struct direct *, rb_enco return &(dirp->dirstr); - } else + } + else return NULL; } @@ -2194,7 +2195,7 @@ rb_w32_is_socket(int fd) } // -// Since the errors returned by the socket error function +// Since the errors returned by the socket error function // WSAGetLastError() are not known by the library routine strerror // we have to roll our own. // @@ -2294,7 +2295,7 @@ getegid(void) int setuid(rb_uid_t uid) -{ +{ return (uid == ROOT_UID ? 0 : -1); } @@ -2373,14 +2374,14 @@ rb_w32_fdcopy(rb_fdset_t *dst, const rb_fdset_t *src) dst->capa = (src->fdset->fd_count / FD_SETSIZE + 1) * FD_SETSIZE; dst->fdset = xrealloc(dst->fdset, sizeof(unsigned int) + sizeof(SOCKET) * dst->capa); } - + memcpy(dst->fdset->fd_array, src->fdset->fd_array, src->fdset->fd_count * sizeof(src->fdset->fd_array[0])); } // // Networking trampolines -// These are used to avoid socket startup/shutdown overhead in case +// These are used to avoid socket startup/shutdown overhead in case // the socket routines aren't used. // @@ -2411,7 +2412,7 @@ extract_fd(rb_fdset_t *dst, fd_set *src, int (*func)(SOCKET)) } memmove( &src->fd_array[s], - &src->fd_array[s+1], + &src->fd_array[s+1], sizeof(src->fd_array[0]) * (--src->fd_count - s)); } else s++; @@ -3005,7 +3006,7 @@ rb_w32_send(int fd, const char *buf, int len, int flags) } int WSAAPI -rb_w32_sendto(int fd, const char *buf, int len, int flags, +rb_w32_sendto(int fd, const char *buf, int len, int flags, const struct sockaddr *to, int tolen) { return overlapped_socket_io(FALSE, fd, (char *)buf, len, flags, @@ -3171,7 +3172,7 @@ rb_w32_setsockopt(int s, int level, int optname, const char *optval, int optlen) }); return r; } - + #undef shutdown int WSAAPI @@ -3615,7 +3616,8 @@ waitpid(rb_pid_t pid, int *stat_loc, int options) if (options == WNOHANG) { timeout = 0; - } else { + } + else { timeout = INFINITE; } @@ -3956,7 +3958,8 @@ wrename(const WCHAR *oldpath, const WCHAR *newpath) if (IsWinNT()) { if (MoveFileExW(oldpath, newpath, MOVEFILE_REPLACE_EXISTING)) res = 0; - } else { + } + else { for (;;) { if (!DeleteFileW(newpath) && GetLastError() != ERROR_FILE_NOT_FOUND) break; @@ -4519,8 +4522,7 @@ rb_w32_getc(FILE* stream) if (enough_to_get(stream->FILE_COUNT)) { c = (unsigned char)*stream->FILE_READPTR++; } - else - { + else { c = _filbuf(stream); #if defined __BORLANDC__ if ((c == EOF) && (errno == EPIPE)) { @@ -4539,8 +4541,7 @@ rb_w32_putc(int c, FILE* stream) if (enough_to_put(stream->FILE_COUNT)) { c = (unsigned char)(*stream->FILE_READPTR++ = (char)c); } - else - { + else { c = _flsbuf(c, stream); catch_interrupt(); } -- cgit v1.2.3