提交 0bfc7c10 编写于 作者: J Junio C Hamano

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
......@@ -110,7 +110,7 @@ static const char *real_path_internal(const char *path, int die_on_error)
else
goto error_out;
}
if (len && !is_dir_sep(buf[len-1]))
if (len && !is_dir_sep(buf[len - 1]))
buf[len++] = '/';
strcpy(buf + len, last_elem);
free(last_elem);
......@@ -201,7 +201,7 @@ const char *absolute_path(const char *path)
if (!cwd)
die_errno("Cannot determine the current working directory");
len = strlen(cwd);
fmt = (len > 0 && is_dir_sep(cwd[len-1])) ? "%s%s" : "%s/%s";
fmt = (len > 0 && is_dir_sep(cwd[len - 1])) ? "%s%s" : "%s/%s";
if (snprintf(buf, PATH_MAX, fmt, cwd, path) >= PATH_MAX)
die("Too long path: %.*s", 60, path);
}
......
......@@ -5,7 +5,7 @@ static char *alias_val;
static int alias_lookup_cb(const char *k, const char *v, void *cb)
{
if (!prefixcmp(k, "alias.") && !strcmp(k+6, alias_key)) {
if (!prefixcmp(k, "alias.") && !strcmp(k + 6, alias_key)) {
if (!v)
return config_error_nonbool(k);
alias_val = xstrdup(v);
......@@ -34,7 +34,7 @@ int split_cmdline(char *cmdline, const char ***argv)
int src, dst, count = 0, size = 16;
char quoted = 0;
*argv = xmalloc(sizeof(char *) * size);
*argv = xmalloc(sizeof(**argv) * size);
/* split alias_string */
(*argv)[count++] = cmdline;
......@@ -45,7 +45,7 @@ int split_cmdline(char *cmdline, const char ***argv)
while (cmdline[++src]
&& isspace(cmdline[src]))
; /* skip */
ALLOC_GROW(*argv, count+1, size);
ALLOC_GROW(*argv, count + 1, size);
(*argv)[count++] = cmdline + dst;
} else if (!quoted && (c == '\'' || c == '"')) {
quoted = c;
......@@ -76,12 +76,13 @@ int split_cmdline(char *cmdline, const char ***argv)
return -SPLIT_CMDLINE_UNCLOSED_QUOTE;
}
ALLOC_GROW(*argv, count+1, size);
ALLOC_GROW(*argv, count + 1, size);
(*argv)[count] = NULL;
return count;
}
const char *split_cmdline_strerror(int split_cmdline_errno) {
return split_cmdline_errors[-split_cmdline_errno-1];
const char *split_cmdline_strerror(int split_cmdline_errno)
{
return split_cmdline_errors[-split_cmdline_errno - 1];
}
......@@ -58,7 +58,7 @@ static void report(const char *name, unsigned int count, size_t size)
}
#define REPORT(name) \
report(#name, name##_allocs, name##_allocs*sizeof(struct name) >> 10)
report(#name, name##_allocs, name##_allocs * sizeof(struct name) >> 10)
void alloc_report(void)
{
......
......@@ -440,7 +440,7 @@ static int match_extension(const char *filename, const char *ext)
* prefix is non-empty (k.e., we don't match .tar.gz with no actual
* filename).
*/
if (prefixlen < 2 || filename[prefixlen-1] != '.')
if (prefixlen < 2 || filename[prefixlen - 1] != '.')
return 0;
return !strcmp(filename + prefixlen, ext);
}
......
......@@ -41,7 +41,7 @@ int decode_85(char *dst, const char *buffer, int len)
{
prep_base85();
say2("decode 85 <%.*s>", len/4*5, buffer);
say2("decode 85 <%.*s>", len / 4 * 5, buffer);
while (len) {
unsigned acc = 0;
int de, cnt = 4;
......
......@@ -274,10 +274,10 @@ void blk_SHA1_Final(unsigned char hashout[20], blk_SHA_CTX *ctx)
padlen[1] = htonl((uint32_t)(ctx->size << 3));
i = ctx->size & 63;
blk_SHA1_Update(ctx, pad, 1+ (63 & (55 - i)));
blk_SHA1_Update(ctx, pad, 1 + (63 & (55 - i)));
blk_SHA1_Update(ctx, padlen, 8);
/* Output hash */
for (i = 0; i < 5; i++)
put_be32(hashout + i*4, ctx->H[i]);
put_be32(hashout + i * 4, ctx->H[i]);
}
......@@ -178,7 +178,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
if (1 < opts.index_only + opts.update)
die("-u and -i at the same time makes no sense");
if ((opts.update||opts.index_only) && !opts.merge)
if ((opts.update || opts.index_only) && !opts.merge)
die("%s is meaningless without -m, --reset, or --prefix",
opts.update ? "-u" : "-i");
if ((opts.dir && !opts.update))
......
......@@ -322,7 +322,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
revs.commit_format = CMIT_FMT_RAW;
if ((!revs.commits &&
(!(revs.tag_objects||revs.tree_objects||revs.blob_objects) &&
(!(revs.tag_objects || revs.tree_objects || revs.blob_objects) &&
!revs.pending.nr)) ||
revs.diff)
usage(rev_list_usage);
......
......@@ -47,7 +47,7 @@ int cmd_symbolic_ref(int argc, const char **argv, const char *prefix)
git_config(git_default_config, NULL);
argc = parse_options(argc, argv, prefix, options,
git_symbolic_ref_usage, 0);
if (msg &&!*msg)
if (msg && !*msg)
die("Refusing to perform update with empty message");
if (delete) {
......
......@@ -339,7 +339,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
p = buf;
*p++ = dfa->nodes[node].opr.c;
while (++node < dfa->nodes_len
&& dfa->nodes[node].type == CHARACTER
&& dfa->nodes[node].type == CHARACTER
&& dfa->nodes[node].mb_partial)
*p++ = dfa->nodes[node].opr.c;
memset (&state, '\0', sizeof (state));
......
......@@ -108,7 +108,7 @@ static long def_ff(const char *rec, long len, char *buf, long sz, void *priv)
{
if (len > 0 &&
(isalpha((unsigned char)*rec) || /* identifier? */
*rec == '_' || /* also identifier? */
*rec == '_' || /* also identifier? */
*rec == '$')) { /* identifiers from VMS and other esoterico */
if (len > sz)
len = sz;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册