Skip to content

Commit 0bfc7c1

Browse files
committed
Merge branch 'fc/styles'
C coding style fixes. * fc/styles: block-sha1/sha1.c: have SP around arithmetic operators base85.c: have SP around arithmetic operators archive.c: have SP around arithmetic operators alloc.c: have SP around arithmetic operators abspath.c: have SP around arithmetic operators alias: have SP around arithmetic operators C: have space around && and || operators
2 parents 9907d13 + 6b2dd0e commit 0bfc7c1

File tree

11 files changed

+19
-18
lines changed

11 files changed

+19
-18
lines changed

abspath.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static const char *real_path_internal(const char *path, int die_on_error)
110110
else
111111
goto error_out;
112112
}
113-
if (len && !is_dir_sep(buf[len-1]))
113+
if (len && !is_dir_sep(buf[len - 1]))
114114
buf[len++] = '/';
115115
strcpy(buf + len, last_elem);
116116
free(last_elem);
@@ -201,7 +201,7 @@ const char *absolute_path(const char *path)
201201
if (!cwd)
202202
die_errno("Cannot determine the current working directory");
203203
len = strlen(cwd);
204-
fmt = (len > 0 && is_dir_sep(cwd[len-1])) ? "%s%s" : "%s/%s";
204+
fmt = (len > 0 && is_dir_sep(cwd[len - 1])) ? "%s%s" : "%s/%s";
205205
if (snprintf(buf, PATH_MAX, fmt, cwd, path) >= PATH_MAX)
206206
die("Too long path: %.*s", 60, path);
207207
}

alias.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ static char *alias_val;
55

66
static int alias_lookup_cb(const char *k, const char *v, void *cb)
77
{
8-
if (!prefixcmp(k, "alias.") && !strcmp(k+6, alias_key)) {
8+
if (!prefixcmp(k, "alias.") && !strcmp(k + 6, alias_key)) {
99
if (!v)
1010
return config_error_nonbool(k);
1111
alias_val = xstrdup(v);
@@ -34,7 +34,7 @@ int split_cmdline(char *cmdline, const char ***argv)
3434
int src, dst, count = 0, size = 16;
3535
char quoted = 0;
3636

37-
*argv = xmalloc(sizeof(char *) * size);
37+
*argv = xmalloc(sizeof(**argv) * size);
3838

3939
/* split alias_string */
4040
(*argv)[count++] = cmdline;
@@ -45,7 +45,7 @@ int split_cmdline(char *cmdline, const char ***argv)
4545
while (cmdline[++src]
4646
&& isspace(cmdline[src]))
4747
; /* skip */
48-
ALLOC_GROW(*argv, count+1, size);
48+
ALLOC_GROW(*argv, count + 1, size);
4949
(*argv)[count++] = cmdline + dst;
5050
} else if (!quoted && (c == '\'' || c == '"')) {
5151
quoted = c;
@@ -76,12 +76,13 @@ int split_cmdline(char *cmdline, const char ***argv)
7676
return -SPLIT_CMDLINE_UNCLOSED_QUOTE;
7777
}
7878

79-
ALLOC_GROW(*argv, count+1, size);
79+
ALLOC_GROW(*argv, count + 1, size);
8080
(*argv)[count] = NULL;
8181

8282
return count;
8383
}
8484

85-
const char *split_cmdline_strerror(int split_cmdline_errno) {
86-
return split_cmdline_errors[-split_cmdline_errno-1];
85+
const char *split_cmdline_strerror(int split_cmdline_errno)
86+
{
87+
return split_cmdline_errors[-split_cmdline_errno - 1];
8788
}

alloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static void report(const char *name, unsigned int count, size_t size)
5858
}
5959

6060
#define REPORT(name) \
61-
report(#name, name##_allocs, name##_allocs*sizeof(struct name) >> 10)
61+
report(#name, name##_allocs, name##_allocs * sizeof(struct name) >> 10)
6262

6363
void alloc_report(void)
6464
{

archive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ static int match_extension(const char *filename, const char *ext)
440440
* prefix is non-empty (k.e., we don't match .tar.gz with no actual
441441
* filename).
442442
*/
443-
if (prefixlen < 2 || filename[prefixlen-1] != '.')
443+
if (prefixlen < 2 || filename[prefixlen - 1] != '.')
444444
return 0;
445445
return !strcmp(filename + prefixlen, ext);
446446
}

base85.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ int decode_85(char *dst, const char *buffer, int len)
4141
{
4242
prep_base85();
4343

44-
say2("decode 85 <%.*s>", len/4*5, buffer);
44+
say2("decode 85 <%.*s>", len / 4 * 5, buffer);
4545
while (len) {
4646
unsigned acc = 0;
4747
int de, cnt = 4;

block-sha1/sha1.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,10 @@ void blk_SHA1_Final(unsigned char hashout[20], blk_SHA_CTX *ctx)
274274
padlen[1] = htonl((uint32_t)(ctx->size << 3));
275275

276276
i = ctx->size & 63;
277-
blk_SHA1_Update(ctx, pad, 1+ (63 & (55 - i)));
277+
blk_SHA1_Update(ctx, pad, 1 + (63 & (55 - i)));
278278
blk_SHA1_Update(ctx, padlen, 8);
279279

280280
/* Output hash */
281281
for (i = 0; i < 5; i++)
282-
put_be32(hashout + i*4, ctx->H[i]);
282+
put_be32(hashout + i * 4, ctx->H[i]);
283283
}

builtin/read-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
178178

179179
if (1 < opts.index_only + opts.update)
180180
die("-u and -i at the same time makes no sense");
181-
if ((opts.update||opts.index_only) && !opts.merge)
181+
if ((opts.update || opts.index_only) && !opts.merge)
182182
die("%s is meaningless without -m, --reset, or --prefix",
183183
opts.update ? "-u" : "-i");
184184
if ((opts.dir && !opts.update))

builtin/rev-list.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
322322
revs.commit_format = CMIT_FMT_RAW;
323323

324324
if ((!revs.commits &&
325-
(!(revs.tag_objects||revs.tree_objects||revs.blob_objects) &&
325+
(!(revs.tag_objects || revs.tree_objects || revs.blob_objects) &&
326326
!revs.pending.nr)) ||
327327
revs.diff)
328328
usage(rev_list_usage);

builtin/symbolic-ref.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ int cmd_symbolic_ref(int argc, const char **argv, const char *prefix)
4747
git_config(git_default_config, NULL);
4848
argc = parse_options(argc, argv, prefix, options,
4949
git_symbolic_ref_usage, 0);
50-
if (msg &&!*msg)
50+
if (msg && !*msg)
5151
die("Refusing to perform update with empty message");
5252

5353
if (delete) {

compat/regex/regcomp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
339339
p = buf;
340340
*p++ = dfa->nodes[node].opr.c;
341341
while (++node < dfa->nodes_len
342-
&& dfa->nodes[node].type == CHARACTER
342+
&& dfa->nodes[node].type == CHARACTER
343343
&& dfa->nodes[node].mb_partial)
344344
*p++ = dfa->nodes[node].opr.c;
345345
memset (&state, '\0', sizeof (state));

0 commit comments

Comments
 (0)