From 8621e44cdaf0b4c66f2204e07d6ccf52a47fb4b7 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 18 Dec 2021 09:34:31 -0800 Subject: [PATCH] maint: use GNU style for spacing --- gl/lib/heap.c | 6 +++--- gl/lib/mbsalign.c | 4 ++-- gl/lib/randperm.c | 2 +- gl/lib/xdectoint.c | 4 ++-- src/basenc.c | 18 +++++++++--------- src/blake2/blake2.h | 4 ++-- src/blake2/blake2b-ref.c | 4 ++-- src/chroot.c | 2 +- src/cksum.c | 2 +- src/cksum_pclmul.c | 22 +++++++++++----------- src/copy.c | 2 +- src/coreutils-vdir.c | 2 +- src/cp.c | 2 +- src/csplit.c | 2 +- src/df.c | 4 ++-- src/digest.c | 16 ++++++++-------- src/expand-common.c | 4 ++-- src/expr.c | 4 ++-- src/factor.c | 26 +++++++++++++------------- src/ioblksize.h | 2 +- src/join.c | 4 ++-- src/libstdbuf.c | 2 +- src/ls.c | 6 +++--- src/make-prime-list.c | 10 +++++----- src/mktemp.c | 2 +- src/mv.c | 2 +- src/ptx.c | 2 +- src/relpath.c | 2 +- src/rmdir.c | 4 ++-- src/seq.c | 2 +- src/set-fields.c | 8 ++++---- src/shred.c | 2 +- src/sleep.c | 2 +- src/stat.c | 2 +- src/stty.c | 2 +- src/sum.h | 2 +- src/test.c | 2 +- src/timeout.c | 2 +- src/touch.c | 2 +- 39 files changed, 96 insertions(+), 96 deletions(-) diff --git a/gl/lib/heap.c b/gl/lib/heap.c index 3de3550d5f..b0c58ad8d7 100644 --- a/gl/lib/heap.c +++ b/gl/lib/heap.c @@ -118,7 +118,7 @@ heapify_down (void **array, size_t count, size_t initial, { size_t child = 2 * parent; - if (child < count && compare (array[child], array[child+1]) < 0) + if (child < count && compare (array[child], array[child + 1]) < 0) child++; if (compare (array[child], element) <= 0) @@ -141,9 +141,9 @@ heapify_up (void **array, size_t count, size_t k = count; void *new_element = array[k]; - while (k != 1 && compare (array[k/2], new_element) <= 0) + while (k != 1 && compare (array[k / 2], new_element) <= 0) { - array[k] = array[k/2]; + array[k] = array[k / 2]; k /= 2; } diff --git a/gl/lib/mbsalign.c b/gl/lib/mbsalign.c index 0ef9f8d129..61a4c2a98a 100644 --- a/gl/lib/mbsalign.c +++ b/gl/lib/mbsalign.c @@ -82,8 +82,8 @@ wc_truncate (wchar_t *wc, size_t width) is always added to DEST. A pointer to the terminating NUL is returned. */ -static char* -mbs_align_pad (char *dest, const char* dest_end, size_t n_spaces) +static char * +mbs_align_pad (char *dest, const char *dest_end, size_t n_spaces) { /* FIXME: Should we pad with "figure space" (\u2007) if non ascii data present? */ diff --git a/gl/lib/randperm.c b/gl/lib/randperm.c index bce7a2daf5..61f29662d2 100644 --- a/gl/lib/randperm.c +++ b/gl/lib/randperm.c @@ -118,7 +118,7 @@ sparse_new (size_t size_hint) index I in array V. */ static void -sparse_swap (sparse_map *sv, size_t* v, size_t i, size_t j) +sparse_swap (sparse_map *sv, size_t *v, size_t i, size_t j) { struct sparse_ent_ *v1 = hash_remove (sv, &(struct sparse_ent_) {i,0}); struct sparse_ent_ *v2 = hash_remove (sv, &(struct sparse_ent_) {j,0}); diff --git a/gl/lib/xdectoint.c b/gl/lib/xdectoint.c index 04f5c7035a..784fb7c6ae 100644 --- a/gl/lib/xdectoint.c +++ b/gl/lib/xdectoint.c @@ -48,10 +48,10 @@ __xnumtoint (char const *n_str, int base, __xdectoint_t min, __xdectoint_t max, s_err = LONGINT_OVERFLOW; /* Use have the INT range as a heuristic to distinguish type overflow rather than other min/max limits. */ - if (tnum > INT_MAX/2) + if (tnum > INT_MAX / 2) errno = EOVERFLOW; #if __xdectoint_signed - else if (tnum < INT_MIN/2) + else if (tnum < INT_MIN / 2) errno = EOVERFLOW; #endif else diff --git a/src/basenc.c b/src/basenc.c index f4ca872671..892112db78 100644 --- a/src/basenc.c +++ b/src/basenc.c @@ -175,13 +175,13 @@ from any other non-alphabet bytes in the encoded stream.\n"), exit (status); } -#define ENC_BLOCKSIZE (1024*3*10) +#define ENC_BLOCKSIZE (1024 * 3 * 10) #if BASE_TYPE == 32 # define BASE_LENGTH BASE32_LENGTH /* Note that increasing this may decrease performance if --ignore-garbage is used, because of the memmove operation below. */ -# define DEC_BLOCKSIZE (1024*5) +# define DEC_BLOCKSIZE (1024 * 5) /* Ensure that BLOCKSIZE is a multiple of 5 and 8. */ verify (ENC_BLOCKSIZE % 40 == 0); /* So padding chars only on last block. */ @@ -196,7 +196,7 @@ verify (DEC_BLOCKSIZE % 40 == 0); /* So complete encoded blocks are used. */ # define BASE_LENGTH BASE64_LENGTH /* Note that increasing this may decrease performance if --ignore-garbage is used, because of the memmove operation below. */ -# define DEC_BLOCKSIZE (1024*3) +# define DEC_BLOCKSIZE (1024 * 3) /* Ensure that BLOCKSIZE is a multiple of 3 and 4. */ verify (ENC_BLOCKSIZE % 12 == 0); /* So padding chars only on last block. */ @@ -310,7 +310,7 @@ base64url_encode (char const *restrict in, idx_t inlen, { base64_encode (in, inlen, out, outlen); /* translate 62nd and 63rd characters */ - char* p = out; + char *p = out; while (outlen--) { if (*p == '+') @@ -346,7 +346,7 @@ base64url_decode_ctx_wrapper (struct base_decode_context *ctx, /* translate 62nd and 63rd characters */ idx_t i = inlen; - char* p = ctx->inbuf; + char *p = ctx->inbuf; while (i--) { if (*p == '+' || *p == '/') @@ -395,7 +395,7 @@ base32_decode_ctx_wrapper (struct base_decode_context *ctx, /* ABCDEFGHIJKLMNOPQRSTUVWXYZ234567 to 0123456789ABCDEFGHIJKLMNOPQRSTUV */ -static const char base32_norm_to_hex[32+9] = { +static const char base32_norm_to_hex[32 + 9] = { /*0x32, 0x33, 0x34, 0x35, 0x36, 0x37, */ 'Q', 'R', 'S', 'T', 'U', 'V', @@ -417,7 +417,7 @@ static const char base32_norm_to_hex[32+9] = { /* 0123456789ABCDEFGHIJKLMNOPQRSTUV to ABCDEFGHIJKLMNOPQRSTUVWXYZ234567 */ -static const char base32_hex_to_norm[32+9] = { +static const char base32_hex_to_norm[32 + 9] = { /* from: 0x30 .. 0x39 ('0' to '9') */ /* to:*/ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', @@ -581,7 +581,7 @@ static int z85_length (int len) { /* Z85 does not allow padding, so no need to round to highest integer. */ - int outlen = (len*5)/4; + int outlen = (len * 5) / 4; return outlen; } @@ -1209,7 +1209,7 @@ main (int argc, char **argv) if (argc - optind > 1) { - error (0, 0, _("extra operand %s"), quote (argv[optind+1])); + error (0, 0, _("extra operand %s"), quote (argv[optind + 1])); usage (EXIT_FAILURE); } diff --git a/src/blake2/blake2.h b/src/blake2/blake2.h index e56879ac2b..be8b176d7e 100644 --- a/src/blake2/blake2.h +++ b/src/blake2/blake2.h @@ -139,8 +139,8 @@ extern "C" { /* Padded structs result in a compile-time error */ enum { - BLAKE2_DUMMY_1 = 1/(sizeof(blake2s_param) == BLAKE2S_OUTBYTES), - BLAKE2_DUMMY_2 = 1/(sizeof(blake2b_param) == BLAKE2B_OUTBYTES) + BLAKE2_DUMMY_1 = 1 / (sizeof (blake2s_param) == BLAKE2S_OUTBYTES), + BLAKE2_DUMMY_2 = 1 / (sizeof (blake2b_param) == BLAKE2B_OUTBYTES) }; /* Streaming API */ diff --git a/src/blake2/blake2b-ref.c b/src/blake2/blake2b-ref.c index 74cbf1fb41..436edca428 100644 --- a/src/blake2/blake2b-ref.c +++ b/src/blake2/blake2b-ref.c @@ -156,11 +156,11 @@ int blake2b_init_key( blake2b_state *S, size_t outlen, const void *key, size_t k #define G(r,i,a,b,c,d) \ do { \ - a = a + b + m[blake2b_sigma[r][2*i+0]]; \ + a = a + b + m[blake2b_sigma[r][2 * i + 0]]; \ d = rotr64(d ^ a, 32); \ c = c + d; \ b = rotr64(b ^ c, 24); \ - a = a + b + m[blake2b_sigma[r][2*i+1]]; \ + a = a + b + m[blake2b_sigma[r][2 * i + 1]]; \ d = rotr64(d ^ a, 16); \ c = c + d; \ b = rotr64(b ^ c, 63); \ diff --git a/src/chroot.c b/src/chroot.c index e5aa7c0b2c..fcfe45eda0 100644 --- a/src/chroot.c +++ b/src/chroot.c @@ -169,7 +169,7 @@ parse_additional_groups (char const *groups, GETGROUPS_T **pgids, could be bind mounted to a separate location. */ static bool -is_root (const char* dir) +is_root (const char *dir) { char *resolved = canonicalize_file_name (dir); bool is_res_root = resolved && STREQ ("/", resolved); diff --git a/src/cksum.c b/src/cksum.c index 2209807cb3..6f49f915e1 100644 --- a/src/cksum.c +++ b/src/cksum.c @@ -192,7 +192,7 @@ pclmul_supported (void) static bool cksum_slice8 (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out) { - uint32_t buf[BUFLEN/sizeof (uint32_t)]; + uint32_t buf[BUFLEN / sizeof (uint32_t)]; uint_fast32_t crc = 0; uintmax_t length = 0; size_t bytes_read; diff --git a/src/cksum_pclmul.c b/src/cksum_pclmul.c index d0e5ecc514..bff660052e 100644 --- a/src/cksum_pclmul.c +++ b/src/cksum_pclmul.c @@ -86,7 +86,7 @@ cksum_pclmul (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out) datap = (__m128i *)buf; /* Fold in parallel eight 16-byte blocks into four 16-byte blocks */ - if (bytes_read >= 16*8) + if (bytes_read >= 16 * 8) { data = _mm_loadu_si128 (datap); data = _mm_shuffle_epi8 (data, shuffle_constant); @@ -95,15 +95,15 @@ cksum_pclmul (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out) xor_crc = _mm_set_epi32 (crc, 0, 0, 0); crc = 0; data = _mm_xor_si128 (data, xor_crc); - data3 = _mm_loadu_si128 (datap+1); + data3 = _mm_loadu_si128 (datap + 1); data3 = _mm_shuffle_epi8 (data3, shuffle_constant); - data5 = _mm_loadu_si128 (datap+2); + data5 = _mm_loadu_si128 (datap + 2); data5 = _mm_shuffle_epi8 (data5, shuffle_constant); - data7 = _mm_loadu_si128 (datap+3); + data7 = _mm_loadu_si128 (datap + 3); data7 = _mm_shuffle_epi8 (data7, shuffle_constant); - while (bytes_read >= 16*8) + while (bytes_read >= 16 * 8) { datap += 4; @@ -128,17 +128,17 @@ cksum_pclmul (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out) data = _mm_xor_si128 (data, data2); data3 = _mm_xor_si128 (data3, data4); - data4 = _mm_loadu_si128 (datap+1); + data4 = _mm_loadu_si128 (datap + 1); data4 = _mm_shuffle_epi8 (data4, shuffle_constant); data3 = _mm_xor_si128 (data3, data4); data5 = _mm_xor_si128 (data5, data6); - data6 = _mm_loadu_si128 (datap+2); + data6 = _mm_loadu_si128 (datap + 2); data6 = _mm_shuffle_epi8 (data6, shuffle_constant); data5 = _mm_xor_si128 (data5, data6); data7 = _mm_xor_si128 (data7, data8); - data8 = _mm_loadu_si128 (datap+3); + data8 = _mm_loadu_si128 (datap + 3); data8 = _mm_shuffle_epi8 (data8, shuffle_constant); data7 = _mm_xor_si128 (data7, data8); @@ -149,11 +149,11 @@ cksum_pclmul (FILE *fp, uint_fast32_t *crc_out, uintmax_t *length_out) data = _mm_shuffle_epi8 (data, shuffle_constant); _mm_storeu_si128 (datap, data); data3 = _mm_shuffle_epi8 (data3, shuffle_constant); - _mm_storeu_si128 (datap+1, data3); + _mm_storeu_si128 (datap + 1, data3); data5 = _mm_shuffle_epi8 (data5, shuffle_constant); - _mm_storeu_si128 (datap+2, data5); + _mm_storeu_si128 (datap + 2, data5); data7 = _mm_shuffle_epi8 (data7, shuffle_constant); - _mm_storeu_si128 (datap+3, data7); + _mm_storeu_si128 (datap + 3, data7); } /* Fold two 16-byte blocks into one 16-byte block */ diff --git a/src/copy.c b/src/copy.c index 0f9aa52447..f6ac94ba85 100644 --- a/src/copy.c +++ b/src/copy.c @@ -301,7 +301,7 @@ functional_copy_file_range (void) print a diagnostic and return false upon error. Note that for best results, BUF should be "well"-aligned. BUF must have sizeof(uintptr_t)-1 bytes of additional space - beyond BUF[BUF_SIZE-1]. + beyond BUF[BUF_SIZE - 1]. Set *LAST_WRITE_MADE_HOLE to true if the final operation on DEST_FD introduced a hole. Set *TOTAL_N_READ to the number of bytes read. */ diff --git a/src/coreutils-vdir.c b/src/coreutils-vdir.c index 544f70d037..5e1a1bc970 100644 --- a/src/coreutils-vdir.c +++ b/src/coreutils-vdir.c @@ -26,7 +26,7 @@ int single_binary_main_ls (int argc, char **argv); int single_binary_main_vdir (int argc, char **argv); int -single_binary_main_vdir (int argc, char** argv) +single_binary_main_vdir (int argc, char **argv) { ls_mode = LS_LONG_FORMAT; return single_binary_main_ls (argc, argv); diff --git a/src/cp.c b/src/cp.c index c97a675631..ae73160f99 100644 --- a/src/cp.c +++ b/src/cp.c @@ -857,7 +857,7 @@ decode_preserve_arg (char const *arg, struct cp_options *x, bool on_off) PRESERVE_ALL }; /* Valid arguments to the '--preserve' option. */ - static char const* const preserve_args[] = + static char const *const preserve_args[] = { "mode", "timestamps", "ownership", "links", "context", "xattr", "all", NULL diff --git a/src/csplit.c b/src/csplit.c index be356df674..50ff5fbf69 100644 --- a/src/csplit.c +++ b/src/csplit.c @@ -1104,7 +1104,7 @@ parse_repeat_count (int argnum, struct control *p, char *str) quote (str)); *end = '\0'; - if (str+1 == end-1 && *(str+1) == '*') + if (str + 1 == end - 1 && *(str + 1) == '*') p->repeat_forever = true; else { diff --git a/src/df.c b/src/df.c index 4689493821..dfc132c468 100644 --- a/src/df.c +++ b/src/df.c @@ -1028,7 +1028,7 @@ add_to_grand_total (struct field_values_t *bv, struct field_values_t *iv) when df is invoked with no non-option argument. See below for details. */ static void -get_dev (char const *device, char const *mount_point, char const* file, +get_dev (char const *device, char const *mount_point, char const *file, char const *stat_file, char const *fstype, bool me_dummy, bool me_remote, const struct fs_usage *force_fsu, @@ -1282,7 +1282,7 @@ get_dev (char const *device, char const *mount_point, char const* file, /* Scan the mount list returning the _last_ device found for MOUNT. NULL is returned if MOUNT not found. The result is malloced. */ static char * -last_device_for_mount (char const* mount) +last_device_for_mount (char const *mount) { struct mount_entry const *me; struct mount_entry const *le = NULL; diff --git a/src/digest.c b/src/digest.c index 85e2909b4b..22e8622850 100644 --- a/src/digest.c +++ b/src/digest.c @@ -209,7 +209,7 @@ static unsigned char digest_delim = '\n'; static uintmax_t digest_length; #endif /* HASH_ALGO_BLAKE2 */ -typedef void (*digest_output_fn)(char const*, int, void const*, +typedef void (*digest_output_fn)(char const *, int, void const *, bool, unsigned char, bool, uintmax_t); #if HASH_ALGO_SUM enum Algorithm @@ -725,7 +725,7 @@ split_3 (char *s, size_t s_len, #if HASH_ALGO_CKSUM if (! algorithm_specified) { - ptrdiff_t algo_tag = algorithm_from_tag (s+i); + ptrdiff_t algo_tag = algorithm_from_tag (s + i); if (algo_tag >= 0) { if (algo_tag <= crc) @@ -1270,15 +1270,15 @@ main (int argc, char **argv) setvbuf (stdout, NULL, _IOLBF, 0); #if HASH_ALGO_SUM - const char* short_opts = "rs"; + const char *short_opts = "rs"; #elif HASH_ALGO_CKSUM - const char* short_opts = "a:l:bctwz"; - const char* digest_length_str = ""; + const char *short_opts = "a:l:bctwz"; + const char *digest_length_str = ""; #elif HASH_ALGO_BLAKE2 - const char* short_opts = "l:bctwz"; - const char* digest_length_str = ""; + const char *short_opts = "l:bctwz"; + const char *digest_length_str = ""; #else - const char* short_opts = "bctwz"; + const char *short_opts = "bctwz"; #endif while ((opt = getopt_long (argc, argv, short_opts, long_options, NULL)) != -1) diff --git a/src/expand-common.c b/src/expand-common.c index 4deb7bd8a6..33bdebf08a 100644 --- a/src/expand-common.c +++ b/src/expand-common.c @@ -275,8 +275,8 @@ finalize_tab_stops (void) extern uintmax_t -get_next_tab_column (const uintmax_t column, size_t* tab_index, - bool* last_tab) +get_next_tab_column (const uintmax_t column, size_t *tab_index, + bool *last_tab) { *last_tab = false; diff --git a/src/expr.c b/src/expr.c index e60fb70dc1..86e3549299 100644 --- a/src/expr.c +++ b/src/expr.c @@ -558,7 +558,7 @@ require_more_args (void) { if (nomoreargs ()) die (EXPR_INVALID, 0, _("syntax error: missing argument after %s"), - quotearg_n_style (0, locale_quoting_style, *(args-1))); + quotearg_n_style (0, locale_quoting_style, *(args - 1))); } @@ -674,7 +674,7 @@ eval7 (bool evaluate) v = eval (evaluate); if (nomoreargs ()) die (EXPR_INVALID, 0, _("syntax error: expecting ')' after %s"), - quotearg_n_style (0, locale_quoting_style, *(args-1))); + quotearg_n_style (0, locale_quoting_style, *(args - 1))); if (!nextarg (")")) die (EXPR_INVALID, 0, _("syntax error: expecting ')' instead of %s"), quotearg_n_style (0, locale_quoting_style, *args)); diff --git a/src/factor.c b/src/factor.c index 7fc30717a7..b79a3b855b 100644 --- a/src/factor.c +++ b/src/factor.c @@ -949,7 +949,7 @@ static const unsigned char binvert_table[128] = else \ { \ _r1 = 0; _r0 = (x); \ - _i = 2*W_TYPE_SIZE; \ + _i = 2 * W_TYPE_SIZE; \ } \ while (_i-- > 0) \ { \ @@ -1775,7 +1775,7 @@ isqrt (uintmax_t n) for (;;) { - uintmax_t y = (x + n/x) / 2; + uintmax_t y = (x + n / x) / 2; if (y >= x) return x; @@ -1849,7 +1849,7 @@ is_square (uintmax_t x) && ((MAGIC11 >> (x % 11) & 1))) { uintmax_t r = isqrt (x); - if (r*r == x) + if (r * r == x) return r; } return 0; @@ -1897,7 +1897,7 @@ static const unsigned short invtab[0x81] = _dinv = invtab[((d) >> (W_TYPE_SIZE - 8 - _cnt)) - 0x7f]; \ _q = _dinv * (_r >> (W_TYPE_SIZE - 3 - _cnt)) >> 11; \ } \ - _r -= _q*(d); \ + _r -= _q * (d); \ \ _mask = -(uintmax_t) (_r >= (d)); \ (r) = _r - (_mask & (d)); \ @@ -1913,11 +1913,11 @@ static const unsigned short invtab[0x81] = } while (0) /* Notes: Example N = 22117019. After first phase we find Q1 = 6314, Q - = 3025, P = 1737, representing F_{18} = (-6314, 2* 1737, 3025), + = 3025, P = 1737, representing F_{18} = (-6314, 2 * 1737, 3025), with 3025 = 55^2. Constructing the square root, we get Q1 = 55, Q = 8653, P = 4652, - representing G_0 = (-55, 2*4652, 8653). + representing G_0 = (-55, 2 * 4652, 8653). In the notation of the paper: @@ -2011,7 +2011,7 @@ factor_using_squfof (uintmax_t n1, uintmax_t n0, struct factors *factors) } /* Duplicate the new factors */ for (unsigned int i = 0; i < f.nfactors; i++) - factor_insert_multiplicity (factors, f.p[i], 2*f.e[i]); + factor_insert_multiplicity (factors, f.p[i], 2 * f.e[i]); } return true; } @@ -2040,7 +2040,7 @@ factor_using_squfof (uintmax_t n1, uintmax_t n0, struct factors *factors) Requiring 64 mu^3 < n seems sufficient. */ if (n1 == 0) { - if ((uintmax_t) mu*mu*mu >= n0 / 64) + if ((uintmax_t) mu * mu * mu >= n0 / 64) continue; } else @@ -2060,10 +2060,10 @@ factor_using_squfof (uintmax_t n1, uintmax_t n0, struct factors *factors) P = S; /* Square root remainder fits in one word, so ignore high part. */ - Q = Dl - P*P; + Q = Dl - P * P; /* FIXME: When can this differ from floor (sqrt (2 * sqrt (D)))? */ - L = isqrt (2*S); - B = 2*L; + L = isqrt (2 * S); + B = 2 * L; L1 = mu * 2 * L; /* The form is (+/- Q1, 2P, -/+ Q), of discriminant 4 (P^2 + Q Q1) = @@ -2073,7 +2073,7 @@ factor_using_squfof (uintmax_t n1, uintmax_t n0, struct factors *factors) { uintmax_t q, P1, t, rem; - div_smallq (q, rem, S+P, Q); + div_smallq (q, rem, S + P, Q); P1 = S - rem; /* P1 = q*Q - P */ IF_LINT (assert (q > 0 && Q > 0)); @@ -2162,7 +2162,7 @@ factor_using_squfof (uintmax_t n1, uintmax_t n0, struct factors *factors) floor([S+P]/\hat Q), but looking at the equations in Sec. 3.1, it should be q <-- floor([S+P] / Q). (In this code, \hat Q is Q1). */ - div_smallq (q, rem, S+P, Q); + div_smallq (q, rem, S + P, Q); P1 = S - rem; /* P1 = q*Q - P */ # if STAT_SQUFOF diff --git a/src/ioblksize.h b/src/ioblksize.h index 5d359d642e..cb59b0a8a1 100644 --- a/src/ioblksize.h +++ b/src/ioblksize.h @@ -70,7 +70,7 @@ In the future we could use the above method if available and default to io_blksize() if not. */ -enum { IO_BUFSIZE = 128*1024 }; +enum { IO_BUFSIZE = 128 * 1024 }; static inline size_t io_blksize (struct stat sb) { diff --git a/src/join.c b/src/join.c index f22ffda530..4d88630e84 100644 --- a/src/join.c +++ b/src/join.c @@ -398,7 +398,7 @@ check_order (const struct line *prev, if (check_input_order != CHECK_ORDER_DISABLED && ((check_input_order == CHECK_ORDER_ENABLED) || seen_unpairable)) { - if (!issued_disorder_warning[whatfile-1]) + if (!issued_disorder_warning[whatfile - 1]) { size_t join_field = whatfile == 1 ? join_field_1 : join_field_2; if (keycmp (prev, current, join_field, join_field) > 0) @@ -420,7 +420,7 @@ check_order (const struct line *prev, /* If we get to here, the message was merely a warning. Arrange to issue it only once per file. */ - issued_disorder_warning[whatfile-1] = true; + issued_disorder_warning[whatfile - 1] = true; } } } diff --git a/src/libstdbuf.c b/src/libstdbuf.c index e7642aebea..900c745703 100644 --- a/src/libstdbuf.c +++ b/src/libstdbuf.c @@ -32,7 +32,7 @@ the buffer size, and more problematically does not give any indication that the new size request was ignored: - setvbuf (stdout, (char*)NULL, _IOFBF, 8192); + setvbuf (stdout, NULL, _IOFBF, 8192); The ISO C99 standard section 7.19.5.6 on the setvbuf function says: diff --git a/src/ls.c b/src/ls.c index 77d94072b1..36ab42aad2 100644 --- a/src/ls.c +++ b/src/ls.c @@ -3312,7 +3312,7 @@ has_capability_cache (char const *file, struct fileinfo *f) } static bool -needs_quoting (char const* name) +needs_quoting (char const *name) { char test[2]; size_t len = quotearg_buffer (test, sizeof test , name, -1, @@ -4809,7 +4809,7 @@ print_name_with_quoting (const struct fileinfo *f, struct obstack *stack, size_t start_col) { - const char* name = symlink_target ? f->linkname : f->name; + const char *name = symlink_target ? f->linkname : f->name; const struct bin_str *color = print_with_color ? get_color_indicator (f, symlink_target) : NULL; @@ -4953,7 +4953,7 @@ get_color_indicator (const struct fileinfo *f, bool symlink_target) struct color_ext_type *ext; /* Color extension */ size_t len; /* Length of name */ - const char* name; + const char *name; mode_t mode; int linkok; if (symlink_target) diff --git a/src/make-prime-list.c b/src/make-prime-list.c index 579d3d89e8..70e4964746 100644 --- a/src/make-prime-list.c +++ b/src/make-prime-list.c @@ -60,10 +60,10 @@ ATTRIBUTE_CONST static wide_uint binvert (wide_uint a) { - wide_uint x = 0xf5397db1 >> (4*((a/2) & 0x7)); + wide_uint x = 0xf5397db1 >> (4 * ((a / 2) & 0x7)); for (;;) { - wide_uint y = 2*x - x*x*a; + wide_uint y = 2 * x - x * x * a; if (y == x) return x; x = y; @@ -198,7 +198,7 @@ main (int argc, char **argv) if ( !(limit & 1)) limit--; - size = (limit-1)/2; + size = (limit - 1) / 2; /* sieve[i] represents 3+2*i */ sieve = xalloc (size); memset (sieve, 1, size); @@ -208,12 +208,12 @@ main (int argc, char **argv) for (i = 0; i < size;) { - unsigned p = 3+2*i; + unsigned p = 3 + 2 * i; unsigned j; process_prime (&prime_list[nprimes++], p); - for (j = (p*p - 3)/2; j < size; j+= p) + for (j = (p * p - 3) / 2; j < size; j += p) sieve[j] = 0; while (++i < size && sieve[i] == 0) diff --git a/src/mktemp.c b/src/mktemp.c index c1344ca7cb..49c32639a2 100644 --- a/src/mktemp.c +++ b/src/mktemp.c @@ -107,7 +107,7 @@ static size_t count_consecutive_X_s (char const *s, size_t len) { size_t n = 0; - for ( ; len && s[len-1] == 'X'; len--) + for ( ; len && s[len - 1] == 'X'; len--) ++n; return n; } diff --git a/src/mv.c b/src/mv.c index 7d81b59a7d..2b782671f1 100644 --- a/src/mv.c +++ b/src/mv.c @@ -235,7 +235,7 @@ do_move (char const *source, char const *dest, const struct cp_options *x) dir[0] = dir_to_remove; dir[1] = NULL; - status = rm ((void*) dir, &rm_options); + status = rm ((void *) dir, &rm_options); assert (VALID_STATUS (status)); if (status == RM_ERROR) ok = false; diff --git a/src/ptx.c b/src/ptx.c index 497767fd5a..9cab2cdc36 100644 --- a/src/ptx.c +++ b/src/ptx.c @@ -1786,7 +1786,7 @@ static struct option const long_options[] = {NULL, 0, NULL, 0}, }; -static char const* const format_args[] = +static char const *const format_args[] = { "roff", "tex", NULL }; diff --git a/src/relpath.c b/src/relpath.c index 6a5275f78d..2798f63859 100644 --- a/src/relpath.c +++ b/src/relpath.c @@ -64,7 +64,7 @@ path_common_prefix (char const *path1, char const *path2) and adjust *PLEN to reflect the remaining space. Return TRUE on failure. */ static bool -buffer_or_output (const char* str, char **pbuf, size_t *plen) +buffer_or_output (const char *str, char **pbuf, size_t *plen) { if (*pbuf) { diff --git a/src/rmdir.c b/src/rmdir.c index c6e2aba0f2..77f08cbfb1 100644 --- a/src/rmdir.c +++ b/src/rmdir.c @@ -144,7 +144,7 @@ remove_parents (char *dir) } else { - char const* error_msg; + char const *error_msg; if (rmdir_errno != ENOTDIR) { /* Barring race conditions, @@ -266,7 +266,7 @@ main (int argc, char **argv) || (ret == 0 && S_ISDIR (st.st_mode))) { /* Ensure the last component was a symlink. */ - char* dir_arg = xstrdup (dir); + char *dir_arg = xstrdup (dir); strip_trailing_slashes (dir); ret = lstat (dir, &st); if (ret == 0 && S_ISLNK (st.st_mode)) diff --git a/src/seq.c b/src/seq.c index 1032b548b6..2774492a43 100644 --- a/src/seq.c +++ b/src/seq.c @@ -693,7 +693,7 @@ main (int argc, char **argv) if (step.value == 0) { error (0, 0, _("invalid Zero increment value: %s"), - quote (argv[optind-1])); + quote (argv[optind - 1])); usage (EXIT_FAILURE); } diff --git a/src/set-fields.c b/src/set-fields.c index a214ff21e1..611f208d8b 100644 --- a/src/set-fields.c +++ b/src/set-fields.c @@ -82,14 +82,14 @@ complement_rp (void) for (size_t i = 1; i < n; ++i) { - if (c[i-1].hi + 1 == c[i].lo) + if (c[i - 1].hi + 1 == c[i].lo) continue; - add_range_pair (c[i-1].hi + 1, c[i].lo - 1); + add_range_pair (c[i - 1].hi + 1, c[i].lo - 1); } - if (c[n-1].hi < UINTMAX_MAX) - add_range_pair (c[n-1].hi + 1, UINTMAX_MAX); + if (c[n - 1].hi < UINTMAX_MAX) + add_range_pair (c[n - 1].hi + 1, UINTMAX_MAX); free (c); } diff --git a/src/shred.c b/src/shred.c index ca7835512e..adc6de1b61 100644 --- a/src/shred.c +++ b/src/shred.c @@ -770,7 +770,7 @@ genpattern (int *dest, size_t num, struct randint_source *s) } } top = num - randpasses; /* Top of initialized data */ - /* assert (d == dest+top); */ + /* assert (d == dest + top); */ /* * We now have fixed patterns in the dest buffer up to diff --git a/src/sleep.c b/src/sleep.c index 2d3e26bbaa..9b2b6dd61f 100644 --- a/src/sleep.c +++ b/src/sleep.c @@ -125,7 +125,7 @@ main (int argc, char **argv) /* Nonnegative interval. */ || ! (0 <= s) /* No extra chars after the number and an optional s,m,h,d char. */ - || (*p && *(p+1)) + || (*p && *(p + 1)) /* Check any suffix char and update S based on the suffix. */ || ! apply_suffix (&s, *p)) { diff --git a/src/stat.c b/src/stat.c index 7849b54dc2..9ca175e78a 100644 --- a/src/stat.c +++ b/src/stat.c @@ -1115,7 +1115,7 @@ print_esc_char (char c) ATTRIBUTE_PURE static size_t -format_code_offset (char const* directive) +format_code_offset (char const *directive) { size_t len = strspn (directive + 1, printf_flags); char const *fmt_char = directive + len + 1; diff --git a/src/stty.c b/src/stty.c index fa5a0dc546..ee61d37811 100644 --- a/src/stty.c +++ b/src/stty.c @@ -1090,7 +1090,7 @@ apply_settings (bool checking, char const *device_name, #define check_argument(arg) \ do \ { \ - if (k == n_settings - 1 || ! settings[k+1]) \ + if (k == n_settings - 1 || ! settings[k + 1]) \ { \ error (0, 0, _("missing argument to %s"), quote (arg)); \ usage (EXIT_FAILURE); \ diff --git a/src/sum.h b/src/sum.h index 7e46b871ce..e1cf8a706d 100644 --- a/src/sum.h +++ b/src/sum.h @@ -4,7 +4,7 @@ bsd_sum_stream (FILE *stream, void *resstream, uintmax_t *length); extern int sysv_sum_stream (FILE *stream, void *resstream, uintmax_t *length); -typedef int (*sumfn)(FILE *, void *, uintmax_t*); +typedef int (*sumfn)(FILE *, void *, uintmax_t *); extern void diff --git a/src/test.c b/src/test.c index 79dc8d2133..00393ddd3b 100644 --- a/src/test.c +++ b/src/test.c @@ -628,7 +628,7 @@ three_arguments (void) else if (STREQ (argv[pos + 1], "-a") || STREQ (argv[pos + 1], "-o")) value = expr (); else - test_syntax_error (_("%s: binary operator expected"), quote (argv[pos+1])); + test_syntax_error (_("%s: binary operator expected"), quote (argv[pos + 1])); return (value); } diff --git a/src/timeout.c b/src/timeout.c index 6505634617..0eb1787239 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -84,7 +84,7 @@ static double kill_after; static bool foreground; /* whether to use another program group. */ static bool preserve_status; /* whether to use a timeout status or not. */ static bool verbose; /* whether to diagnose timeouts or not. */ -static char const* command; +static char const *command; /* for long options with no corresponding short option, use enum */ enum diff --git a/src/touch.c b/src/touch.c index 46ddd86bb9..65606564f7 100644 --- a/src/touch.c +++ b/src/touch.c @@ -94,7 +94,7 @@ static struct option const longopts[] = }; /* Valid arguments to the '--time' option. */ -static char const* const time_args[] = +static char const *const time_args[] = { "atime", "access", "use", "mtime", "modify", NULL }; -- 2.47.2