From 9cba13ca5d233a4e1a7068f3f5ed5836a081dcc0 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Wed, 16 Mar 2011 02:08:34 -0500 Subject: [PATCH] standardize brace placement in struct definitions In a struct definitions, unlike functions, the prevailing style is for the opening brace to go on the same line as the struct name, like so: struct foo { int bar; char *baz; }; Indeed, grepping for 'struct [a-z_]* {$' yields about 5 times as many matches as 'struct [a-z_]*$'. Linus sayeth: Heretic people all over the world have claimed that this inconsistency is ... well ... inconsistent, but all right-thinking people know that (a) K&R are _right_ and (b) K&R are right. Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- builtin/add.c | 3 +-- builtin/blame.c | 3 +-- builtin/grep.c | 3 +-- builtin/index-pack.c | 6 ++---- commit.h | 3 +-- config.c | 3 +-- diff.c | 6 ++---- fast-import.c | 42 ++++++++++++++---------------------------- fetch-pack.h | 3 +-- generate-cmdlist.sh | 3 +-- http-push.c | 15 +++++---------- http-walker.c | 6 ++---- http.h | 15 +++++---------- merge-recursive.c | 12 ++++-------- pack-check.c | 3 +-- string-list.h | 3 +-- transport-helper.c | 3 +-- 17 files changed, 44 insertions(+), 88 deletions(-) diff --git a/builtin/add.c b/builtin/add.c index 42c906ea06..1d74763f58 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -21,8 +21,7 @@ static const char * const builtin_add_usage[] = { static int patch_interactive, add_interactive, edit_interactive; static int take_worktree_changes; -struct update_callback_data -{ +struct update_callback_data { int flags; int add_errors; }; diff --git a/builtin/blame.c b/builtin/blame.c index aa30ec5269..f6b03f750a 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -1312,8 +1312,7 @@ static void pass_blame(struct scoreboard *sb, struct origin *origin, int opt) /* * Information on commits, used for output. */ -struct commit_info -{ +struct commit_info { const char *author; const char *author_mail; unsigned long author_time; diff --git a/builtin/grep.c b/builtin/grep.c index fdf7131efd..34f9ae0304 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -40,8 +40,7 @@ enum work_type {WORK_SHA1, WORK_FILE}; * threads. The producer adds struct work_items to 'todo' and the * consumers pick work items from the same array. */ -struct work_item -{ +struct work_item { enum work_type type; char *name; diff --git a/builtin/index-pack.c b/builtin/index-pack.c index 8dc5c0b541..c7e600db47 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -13,8 +13,7 @@ static const char index_pack_usage[] = "git index-pack [-v] [-o ] [ --keep | --keep= ] [--strict] ( | --stdin [--fix-thin] [])"; -struct object_entry -{ +struct object_entry { struct pack_idx_entry idx; unsigned long size; unsigned int hdr_size; @@ -44,8 +43,7 @@ struct base_data { #define FLAG_LINK (1u<<20) #define FLAG_CHECKED (1u<<21) -struct delta_entry -{ +struct delta_entry { union delta_base base; int obj_no; }; diff --git a/commit.h b/commit.h index 659c87c3ee..41985130d1 100644 --- a/commit.h +++ b/commit.h @@ -68,8 +68,7 @@ enum cmit_fmt { CMIT_FMT_UNSPECIFIED }; -struct pretty_print_context -{ +struct pretty_print_context { int abbrev; const char *subject; const char *after_subject; diff --git a/config.c b/config.c index 47e6ba5a3b..3dd55d507b 100644 --- a/config.c +++ b/config.c @@ -20,8 +20,7 @@ static int zlib_compression_seen; const char *config_exclusive_filename = NULL; -struct config_item -{ +struct config_item { struct config_item *next; char *name; char *value; diff --git a/diff.c b/diff.c index 5422c43882..2f2ab87d96 100644 --- a/diff.c +++ b/diff.c @@ -606,16 +606,14 @@ static void diff_words_append(char *line, unsigned long len, buffer->text.ptr[buffer->text.size] = '\0'; } -struct diff_words_style_elem -{ +struct diff_words_style_elem { const char *prefix; const char *suffix; const char *color; /* NULL; filled in by the setup code if * color is enabled */ }; -struct diff_words_style -{ +struct diff_words_style { enum diff_words_type type; struct diff_words_style_elem new, old, ctx; const char *newline; diff --git a/fast-import.c b/fast-import.c index 970d8470ed..87f36b36c3 100644 --- a/fast-import.c +++ b/fast-import.c @@ -166,8 +166,7 @@ Format of STDIN stream: #define DEPTH_BITS 13 #define MAX_DEPTH ((1<