diff options
author | Jim Meyering <meyering@redhat.com> | 2009-08-22 18:56:06 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2009-08-25 09:21:00 +0200 |
commit | 5e778f7c8d1ecf3d8f11385db013af2ba026e2a5 (patch) | |
tree | e460d471f37f0dce1ba06f60f88114d1a65326c4 /lib | |
parent | 2bc0f3caaafeb240cdcfd050b7ad1fe0ad14addf (diff) | |
download | coreutils-5e778f7c8d1ecf3d8f11385db013af2ba026e2a5.tar.xz |
global: convert indentation-TABs to spaces
Transformed via this shell code:
t=$'\t'
git ls-files \
| grep -vE '(^|/)((GNU)?[Mm]akefile|ChangeLog)|\.(am|mk)$' \
| grep -vE 'tests/pr/|help2man' \
| xargs grep -lE "^ *$t" \
| xargs perl -MText::Tabs -ni -le \
'$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
Diffstat (limited to 'lib')
-rw-r--r-- | lib/buffer-lcm.c | 32 | ||||
-rw-r--r-- | lib/euidaccess-stat.c | 24 | ||||
-rw-r--r-- | lib/fdopendir-glibc.c | 14 | ||||
-rw-r--r-- | lib/memxfrm.c | 50 | ||||
-rw-r--r-- | lib/strnumcmp-in.h | 144 | ||||
-rw-r--r-- | lib/strnumcmp.c | 2 | ||||
-rwxr-xr-x | lib/t-chdir-long | 8 | ||||
-rw-r--r-- | lib/xfts.c | 26 | ||||
-rw-r--r-- | lib/xfts.h | 2 | ||||
-rw-r--r-- | lib/xmemxfrm.c | 6 |
10 files changed, 154 insertions, 154 deletions
diff --git a/lib/buffer-lcm.c b/lib/buffer-lcm.c index b8d87d31d..ee901741d 100644 --- a/lib/buffer-lcm.c +++ b/lib/buffer-lcm.c @@ -34,22 +34,22 @@ buffer_lcm (size_t a, size_t b, size_t lcm_max) else { if (b) - { - /* Return lcm (A, B) if it is in range; otherwise, fall back - on A. */ - - size_t lcm, m, n, q, r; - - /* N = gcd (A, B). */ - for (m = a, n = b; (r = m % n) != 0; m = n, n = r) - continue; - - /* LCM = lcm (A, B), if in range. */ - q = a / n; - lcm = q * b; - if (lcm <= lcm_max && lcm / b == q) - return lcm; - } + { + /* Return lcm (A, B) if it is in range; otherwise, fall back + on A. */ + + size_t lcm, m, n, q, r; + + /* N = gcd (A, B). */ + for (m = a, n = b; (r = m % n) != 0; m = n, n = r) + continue; + + /* LCM = lcm (A, B), if in range. */ + q = a / n; + lcm = q * b; + if (lcm <= lcm_max && lcm / b == q) + return lcm; + } size = a; } diff --git a/lib/euidaccess-stat.c b/lib/euidaccess-stat.c index 0213c93fc..98ce28157 100644 --- a/lib/euidaccess-stat.c +++ b/lib/euidaccess-stat.c @@ -57,8 +57,8 @@ euidaccess_stat (struct stat const *st, int mode) mode &= 7; else mode = ((mode & R_OK ? 4 : 0) - + (mode & W_OK ? 2 : 0) - + (mode & X_OK ? 1 : 0)); + + (mode & W_OK ? 2 : 0) + + (mode & X_OK ? 1 : 0)); if (mode == 0) return true; /* The file exists. */ @@ -68,7 +68,7 @@ euidaccess_stat (struct stat const *st, int mode) /* The super-user can read and write any file, and execute any file that anyone can execute. */ if (euid == 0 && ((mode & X_OK) == 0 - || (st->st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))) + || (st->st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))) return true; /* Convert the file's permission bits to traditional form. */ @@ -84,14 +84,14 @@ euidaccess_stat (struct stat const *st, int mode) granted = st->st_mode; else granted = ( (st->st_mode & S_IRUSR ? 4 << 6 : 0) - + (st->st_mode & S_IWUSR ? 2 << 6 : 0) - + (st->st_mode & S_IXUSR ? 1 << 6 : 0) - + (st->st_mode & S_IRGRP ? 4 << 3 : 0) - + (st->st_mode & S_IWGRP ? 2 << 3 : 0) - + (st->st_mode & S_IXGRP ? 1 << 3 : 0) - + (st->st_mode & S_IROTH ? 4 << 0 : 0) - + (st->st_mode & S_IWOTH ? 2 << 0 : 0) - + (st->st_mode & S_IXOTH ? 1 << 0 : 0)); + + (st->st_mode & S_IWUSR ? 2 << 6 : 0) + + (st->st_mode & S_IXUSR ? 1 << 6 : 0) + + (st->st_mode & S_IRGRP ? 4 << 3 : 0) + + (st->st_mode & S_IWGRP ? 2 << 3 : 0) + + (st->st_mode & S_IXGRP ? 1 << 3 : 0) + + (st->st_mode & S_IROTH ? 4 << 0 : 0) + + (st->st_mode & S_IWOTH ? 2 << 0 : 0) + + (st->st_mode & S_IXOTH ? 1 << 0 : 0)); if (euid == st->st_uid) granted >>= 6; @@ -99,7 +99,7 @@ euidaccess_stat (struct stat const *st, int mode) { gid_t egid = getegid (); if (egid == st->st_gid || group_member (st->st_gid)) - granted >>= 3; + granted >>= 3; } if ((mode & ~granted) == 0) diff --git a/lib/fdopendir-glibc.c b/lib/fdopendir-glibc.c index a35917113..1e6a460e9 100644 --- a/lib/fdopendir-glibc.c +++ b/lib/fdopendir-glibc.c @@ -77,12 +77,12 @@ __alloc_dir (int fd, bool close_fd) size_t allocation; #ifdef _STATBUF_ST_BLKSIZE if (__builtin_expect ((size_t) statp->st_blksize >= sizeof (struct dirent64), - 1)) + 1)) allocation = statp->st_blksize; else #endif allocation = (BUFSIZ < sizeof (struct dirent64) - ? sizeof (struct dirent64) : BUFSIZ); + ? sizeof (struct dirent64) : BUFSIZ); const int pad = -sizeof (DIR) % __alignof__ (struct dirent64); @@ -91,11 +91,11 @@ __alloc_dir (int fd, bool close_fd) lose: { if (close_fd) - { - int save_errno = errno; - close_not_cancel_no_status (fd); - __set_errno (save_errno); - } + { + int save_errno = errno; + close_not_cancel_no_status (fd); + __set_errno (save_errno); + } return NULL; } memset (dirp, '\0', sizeof (DIR)); diff --git a/lib/memxfrm.c b/lib/memxfrm.c index 7376b3e97..a186ed87a 100644 --- a/lib/memxfrm.c +++ b/lib/memxfrm.c @@ -40,7 +40,7 @@ size_t memxfrm (char *restrict dest, size_t destsize, - char *restrict src, size_t srcsize) + char *restrict src, size_t srcsize) { #if HAVE_STRXFRM @@ -59,33 +59,33 @@ memxfrm (char *restrict dest, size_t destsize, errno = 0; result += strxfrm (dest + di, src + si, destsize - di) + 1; if (errno != 0) - break; + break; if (result <= result0) - { - errno = ERANGE; - break; - } + { + errno = ERANGE; + break; + } if (result == destsize + 1 && si + slen == srcsize) - { - /* The destination is exactly the right size, but strxfrm wants - room for a trailing null. Work around the problem with a - temporary buffer. */ - size_t bufsize = destsize - di + 1; - char stackbuf[4000]; - char *buf = stackbuf; - if (sizeof stackbuf < bufsize) - { - buf = malloc (bufsize); - if (! buf) - break; - } - strxfrm (buf, src + si, bufsize); - memcpy (dest + di, buf, destsize - di); - if (sizeof stackbuf < bufsize) - free (buf); - errno = 0; - } + { + /* The destination is exactly the right size, but strxfrm wants + room for a trailing null. Work around the problem with a + temporary buffer. */ + size_t bufsize = destsize - di + 1; + char stackbuf[4000]; + char *buf = stackbuf; + if (sizeof stackbuf < bufsize) + { + buf = malloc (bufsize); + if (! buf) + break; + } + strxfrm (buf, src + si, bufsize); + memcpy (dest + di, buf, destsize - di); + if (sizeof stackbuf < bufsize) + free (buf); + errno = 0; + } di = (result < destsize ? result : destsize); si += slen + 1; diff --git a/lib/strnumcmp-in.h b/lib/strnumcmp-in.h index db2d15875..886427490 100644 --- a/lib/strnumcmp-in.h +++ b/lib/strnumcmp-in.h @@ -77,28 +77,28 @@ fraccompare (char const *a, char const *b, char decimal_point) if (*a == decimal_point && *b == decimal_point) { while (*++a == *++b) - if (! ISDIGIT (*a)) - return 0; + if (! ISDIGIT (*a)) + return 0; if (ISDIGIT (*a) && ISDIGIT (*b)) - return *a - *b; + return *a - *b; if (ISDIGIT (*a)) - goto a_trailing_nonzero; + goto a_trailing_nonzero; if (ISDIGIT (*b)) - goto b_trailing_nonzero; + goto b_trailing_nonzero; return 0; } else if (*a++ == decimal_point) { a_trailing_nonzero: while (*a == NUMERIC_ZERO) - a++; + a++; return ISDIGIT (*a); } else if (*b++ == decimal_point) { b_trailing_nonzero: while (*b == NUMERIC_ZERO) - b++; + b++; return - ISDIGIT (*b); } return 0; @@ -113,7 +113,7 @@ fraccompare (char const *a, char const *b, char decimal_point) static inline int numcompare (char const *a, char const *b, - int decimal_point, int thousands_sep) + int decimal_point, int thousands_sep) { unsigned char tmpa = *a; unsigned char tmpb = *b; @@ -124,119 +124,119 @@ numcompare (char const *a, char const *b, if (tmpa == NEGATION_SIGN) { do - tmpa = *++a; + tmpa = *++a; while (tmpa == NUMERIC_ZERO || tmpa == thousands_sep); if (tmpb != NEGATION_SIGN) - { - if (tmpa == decimal_point) - do - tmpa = *++a; - while (tmpa == NUMERIC_ZERO); - if (ISDIGIT (tmpa)) - return -1; - while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep) - tmpb = *++b; - if (tmpb == decimal_point) - do - tmpb = *++b; - while (tmpb == NUMERIC_ZERO); - return - ISDIGIT (tmpb); - } + { + if (tmpa == decimal_point) + do + tmpa = *++a; + while (tmpa == NUMERIC_ZERO); + if (ISDIGIT (tmpa)) + return -1; + while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep) + tmpb = *++b; + if (tmpb == decimal_point) + do + tmpb = *++b; + while (tmpb == NUMERIC_ZERO); + return - ISDIGIT (tmpb); + } do - tmpb = *++b; + tmpb = *++b; while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep); while (tmpa == tmpb && ISDIGIT (tmpa)) - { - do - tmpa = *++a; - while (tmpa == thousands_sep); - do - tmpb = *++b; - while (tmpb == thousands_sep); - } + { + do + tmpa = *++a; + while (tmpa == thousands_sep); + do + tmpb = *++b; + while (tmpb == thousands_sep); + } if ((tmpa == decimal_point && !ISDIGIT (tmpb)) - || (tmpb == decimal_point && !ISDIGIT (tmpa))) - return fraccompare (b, a, decimal_point); + || (tmpb == decimal_point && !ISDIGIT (tmpa))) + return fraccompare (b, a, decimal_point); tmp = tmpb - tmpa; for (log_a = 0; ISDIGIT (tmpa); ++log_a) - do - tmpa = *++a; - while (tmpa == thousands_sep); + do + tmpa = *++a; + while (tmpa == thousands_sep); for (log_b = 0; ISDIGIT (tmpb); ++log_b) - do - tmpb = *++b; - while (tmpb == thousands_sep); + do + tmpb = *++b; + while (tmpb == thousands_sep); if (log_a != log_b) - return log_a < log_b ? 1 : -1; + return log_a < log_b ? 1 : -1; if (!log_a) - return 0; + return 0; return tmp; } else if (tmpb == NEGATION_SIGN) { do - tmpb = *++b; + tmpb = *++b; while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep); if (tmpb == decimal_point) - do - tmpb = *++b; - while (tmpb == NUMERIC_ZERO); + do + tmpb = *++b; + while (tmpb == NUMERIC_ZERO); if (ISDIGIT (tmpb)) - return 1; + return 1; while (tmpa == NUMERIC_ZERO || tmpa == thousands_sep) - tmpa = *++a; + tmpa = *++a; if (tmpa == decimal_point) - do - tmpa = *++a; - while (tmpa == NUMERIC_ZERO); + do + tmpa = *++a; + while (tmpa == NUMERIC_ZERO); return ISDIGIT (tmpa); } else { while (tmpa == NUMERIC_ZERO || tmpa == thousands_sep) - tmpa = *++a; + tmpa = *++a; while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep) - tmpb = *++b; + tmpb = *++b; while (tmpa == tmpb && ISDIGIT (tmpa)) - { - do - tmpa = *++a; - while (tmpa == thousands_sep); - do - tmpb = *++b; - while (tmpb == thousands_sep); - } + { + do + tmpa = *++a; + while (tmpa == thousands_sep); + do + tmpb = *++b; + while (tmpb == thousands_sep); + } if ((tmpa == decimal_point && !ISDIGIT (tmpb)) - || (tmpb == decimal_point && !ISDIGIT (tmpa))) - return fraccompare (a, b, decimal_point); + || (tmpb == decimal_point && !ISDIGIT (tmpa))) + return fraccompare (a, b, decimal_point); tmp = tmpa - tmpb; for (log_a = 0; ISDIGIT (tmpa); ++log_a) - do - tmpa = *++a; - while (tmpa == thousands_sep); + do + tmpa = *++a; + while (tmpa == thousands_sep); for (log_b = 0; ISDIGIT (tmpb); ++log_b) - do - tmpb = *++b; - while (tmpb == thousands_sep); + do + tmpb = *++b; + while (tmpb == thousands_sep); if (log_a != log_b) - return log_a < log_b ? -1 : 1; + return log_a < log_b ? -1 : 1; if (!log_a) - return 0; + return 0; return tmp; } diff --git a/lib/strnumcmp.c b/lib/strnumcmp.c index 2a2f2f729..aae09e156 100644 --- a/lib/strnumcmp.c +++ b/lib/strnumcmp.c @@ -25,7 +25,7 @@ int strnumcmp (char const *a, char const *b, - int decimal_point, int thousands_sep) + int decimal_point, int thousands_sep) { return numcompare (a, b, decimal_point, thousands_sep); } diff --git a/lib/t-chdir-long b/lib/t-chdir-long index e92d445ae..489c6b50a 100755 --- a/lib/t-chdir-long +++ b/lib/t-chdir-long @@ -38,10 +38,10 @@ function mkdir_len ( cd $root && perl -e 'my $len='$n'-length "'$root'";$i=100;$d="z"x$i; while ($i+2 < $len) { - $len -= $i + 1; - mkdir $d,0700 or die "$!\n"; - chdir $d} $d="z"x($len-1); - mkdir $d or die "mkdir_len: $d: $!\n"' ) + $len -= $i + 1; + mkdir $d,0700 or die "$!\n"; + chdir $d} $d="z"x($len-1); + mkdir $d or die "mkdir_len: $d: $!\n"' ) } size_list= diff --git a/lib/xfts.c b/lib/xfts.c index e91ab079e..5994a5fef 100644 --- a/lib/xfts.c +++ b/lib/xfts.c @@ -35,28 +35,28 @@ FTS * xfts_open (char * const *argv, int options, - int (*compar) (const FTSENT **, const FTSENT **)) + int (*compar) (const FTSENT **, const FTSENT **)) { FTS *fts = fts_open (argv, options | FTS_CWDFD, compar); if (fts == NULL) { /* This can fail in three ways: out of memory, invalid bit_flags, - and one or more of the FILES is an empty string. We could try - to decipher that errno==EINVAL means invalid bit_flags and - errno==ENOENT means there's an empty string, but that seems wrong. - Ideally, fts_open would return a proper error indicator. For now, - we'll presume that the bit_flags are valid and just check for - empty strings. */ + and one or more of the FILES is an empty string. We could try + to decipher that errno==EINVAL means invalid bit_flags and + errno==ENOENT means there's an empty string, but that seems wrong. + Ideally, fts_open would return a proper error indicator. For now, + we'll presume that the bit_flags are valid and just check for + empty strings. */ bool invalid_arg = false; for (; *argv; ++argv) - { - if (**argv == '\0') - invalid_arg = true; - } + { + if (**argv == '\0') + invalid_arg = true; + } if (invalid_arg) - error (EXIT_FAILURE, 0, _("invalid argument: %s"), quote ("")); + error (EXIT_FAILURE, 0, _("invalid argument: %s"), quote ("")); else - xalloc_die (); + xalloc_die (); } return fts; diff --git a/lib/xfts.h b/lib/xfts.h index 47906132a..27ddb5d48 100644 --- a/lib/xfts.h +++ b/lib/xfts.h @@ -2,4 +2,4 @@ FTS * xfts_open (char * const *, int options, - int (*) (const FTSENT **, const FTSENT **)); + int (*) (const FTSENT **, const FTSENT **)); diff --git a/lib/xmemxfrm.c b/lib/xmemxfrm.c index 2e9979ddb..bfbf658ab 100644 --- a/lib/xmemxfrm.c +++ b/lib/xmemxfrm.c @@ -45,7 +45,7 @@ size_t xmemxfrm (char *restrict dest, size_t destsize, - char *restrict src, size_t srcsize) + char *restrict src, size_t srcsize) { size_t translated_size = memxfrm (dest, destsize, src, srcsize); @@ -54,8 +54,8 @@ xmemxfrm (char *restrict dest, size_t destsize, error (0, errno, _("string transformation failed")); error (0, 0, _("set LC_ALL='C' to work around the problem")); error (exit_failure, 0, - _("the untransformed string was %s"), - quotearg_n_style_mem (0, locale_quoting_style, src, srcsize)); + _("the untransformed string was %s"), + quotearg_n_style_mem (0, locale_quoting_style, src, srcsize)); } return translated_size; |