From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonathan Nieder Subject: [PATCH 5/8] standardize brace placement in struct definitions Date: Wed, 16 Mar 2011 02:08:34 -0500 Message-ID: <20110316070834.GF5988@elie> References: <20110316024959.GA24932@elie> <20110316065256.GA5988@elie> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Junio C Hamano , "Shawn O. Pearce" To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Wed Mar 16 08:08:50 2011 Return-path: Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Pzkqf-0007qm-UV for gcvg-git-2@lo.gmane.org; Wed, 16 Mar 2011 08:08:50 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751771Ab1CPHIo (ORCPT ); Wed, 16 Mar 2011 03:08:44 -0400 Received: from mail-yi0-f46.google.com ([209.85.218.46]:52915 "EHLO mail-yi0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751852Ab1CPHIl (ORCPT ); Wed, 16 Mar 2011 03:08:41 -0400 Received: by yia27 with SMTP id 27so543728yia.19 for ; Wed, 16 Mar 2011 00:08:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=vsyG6DNZcm2QStPLQJuLSXhiGxGb/CzhOS13SW5a070=; b=A6yLbDlSomjgFh+NhTTskzseNm4PXb0XZKPYRec7wnm8pe7JddYsyAJkkbI/2J3Uvz J0GSv5NGONDbpVbOq1uLMFAtkA8m62yGOA8oNV5HKQpnY8C8eifMyqGYHIvxXkxD+RH6 Ty2dt+YdBQ8Y4N5YIi+Jji3fbX5E2xYS/jUp8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=eUwI5DHNJT3XkN8o8xFt+kvYUXjxEBTDzxxblgIVEMyOyn3YX2eDg2O8Wuknuzkoqz m1bVMyMj96YHms8WLKS4UxZixGsn5ali0VwflH7rOAGMU5OJFkmryi6wGkJXh8ZqSZL+ MKOvBpHceXyMAKDjnwybWIH4sHL2GcvC2gOa8= Received: by 10.150.160.19 with SMTP id i19mr1019889ybe.111.1300259319106; Wed, 16 Mar 2011 00:08:39 -0700 (PDT) Received: from elie (adsl-69-209-56-53.dsl.chcgil.sbcglobal.net [69.209.56.53]) by mx.google.com with ESMTPS id v35sm3375387yba.16.2011.03.16.00.08.37 (version=SSLv3 cipher=OTHER); Wed, 16 Mar 2011 00:08:38 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20110316065256.GA5988@elie> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: 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 --- The real reason: when I read through fast-import I end up wishing I could fit more struct definitions in my 31-line terminal. 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 f7a17e4..e127d5a 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 aa30ec5..f6b03f7 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 5afee2f..eaf8560 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 8dc5c0b..c7e600d 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 659c87c..4198513 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 b94de8f..fa740a6 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 6640857..3fd9e0c 100644 --- a/diff.c +++ b/diff.c @@ -615,16 +615,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 e24ee2c..d9f9a3f 100644 --- a/fast-import.c +++ b/fast-import.c @@ -170,8 +170,7 @@ Format of STDIN stream: #define DEPTH_BITS 13 #define MAX_DEPTH ((1<