1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-08 10:56:08 +02:00

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 <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jonathan Nieder 2011-03-16 02:08:34 -05:00 committed by Junio C Hamano
parent c6c8d0b797
commit 9cba13ca5d
17 changed files with 44 additions and 88 deletions

View File

@ -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;
};

View File

@ -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;

View File

@ -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;

View File

@ -13,8 +13,7 @@
static const char index_pack_usage[] =
"git index-pack [-v] [-o <index-file>] [ --keep | --keep=<msg> ] [--strict] (<pack-file> | --stdin [--fix-thin] [<pack-file>])";
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;
};

View File

@ -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;

View File

@ -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;

6
diff.c
View File

@ -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;

View File

@ -166,8 +166,7 @@ Format of STDIN stream:
#define DEPTH_BITS 13
#define MAX_DEPTH ((1<<DEPTH_BITS)-1)
struct object_entry
{
struct object_entry {
struct pack_idx_entry idx;
struct object_entry *next;
uint32_t type : TYPE_BITS,
@ -175,16 +174,14 @@ struct object_entry
depth : DEPTH_BITS;
};
struct object_entry_pool
{
struct object_entry_pool {
struct object_entry_pool *next_pool;
struct object_entry *next_free;
struct object_entry *end;
struct object_entry entries[FLEX_ARRAY]; /* more */
};
struct mark_set
{
struct mark_set {
union {
struct object_entry *marked[1024];
struct mark_set *sets[1024];
@ -192,57 +189,49 @@ struct mark_set
unsigned int shift;
};
struct last_object
{
struct last_object {
struct strbuf data;
off_t offset;
unsigned int depth;
unsigned no_swap : 1;
};
struct mem_pool
{
struct mem_pool {
struct mem_pool *next_pool;
char *next_free;
char *end;
uintmax_t space[FLEX_ARRAY]; /* more */
};
struct atom_str
{
struct atom_str {
struct atom_str *next_atom;
unsigned short str_len;
char str_dat[FLEX_ARRAY]; /* more */
};
struct tree_content;
struct tree_entry
{
struct tree_entry {
struct tree_content *tree;
struct atom_str *name;
struct tree_entry_ms
{
struct tree_entry_ms {
uint16_t mode;
unsigned char sha1[20];
} versions[2];
};
struct tree_content
{
struct tree_content {
unsigned int entry_capacity; /* must match avail_tree_content */
unsigned int entry_count;
unsigned int delta_depth;
struct tree_entry *entries[FLEX_ARRAY]; /* more */
};
struct avail_tree_content
{
struct avail_tree_content {
unsigned int entry_capacity; /* must match tree_content */
struct avail_tree_content *next_avail;
};
struct branch
{
struct branch {
struct branch *table_next_branch;
struct branch *active_next_branch;
const char *name;
@ -254,16 +243,14 @@ struct branch
unsigned char sha1[20];
};
struct tag
{
struct tag {
struct tag *next_tag;
const char *name;
unsigned int pack_id;
unsigned char sha1[20];
};
struct hash_list
{
struct hash_list {
struct hash_list *next;
unsigned char sha1[20];
};
@ -274,8 +261,7 @@ typedef enum {
WHENSPEC_NOW
} whenspec_type;
struct recent_command
{
struct recent_command {
struct recent_command *prev;
struct recent_command *next;
char *buf;

View File

@ -1,8 +1,7 @@
#ifndef FETCH_PACK_H
#define FETCH_PACK_H
struct fetch_pack_args
{
struct fetch_pack_args {
const char *uploadpack;
int unpacklimit;
int depth;

View File

@ -1,8 +1,7 @@
#!/bin/sh
echo "/* Automatically generated by $0 */
struct cmdname_help
{
struct cmdname_help {
char name[16];
char help[80];
};

View File

@ -82,8 +82,7 @@ static int helper_status;
static struct object_list *objects;
struct repo
{
struct repo {
char *url;
char *path;
int path_len;
@ -108,8 +107,7 @@ enum transfer_state {
COMPLETE
};
struct transfer_request
{
struct transfer_request {
struct object *obj;
char *url;
char *dest;
@ -127,8 +125,7 @@ struct transfer_request
static struct transfer_request *request_queue_head;
struct xml_ctx
{
struct xml_ctx {
char *name;
int len;
char *cdata;
@ -136,8 +133,7 @@ struct xml_ctx
void *userData;
};
struct remote_lock
{
struct remote_lock {
char *url;
char *owner;
char *token;
@ -156,8 +152,7 @@ struct remote_lock
/* Flags that remote_ls passes to callback functions */
#define IS_DIR (1u << 0)
struct remote_ls_ctx
{
struct remote_ls_ctx {
char *path;
void (*userFunc)(struct remote_ls_ctx *ls);
void *userData;

View File

@ -3,8 +3,7 @@
#include "walker.h"
#include "http.h"
struct alt_base
{
struct alt_base {
char *base;
int got_indices;
struct packed_git *packs;
@ -18,8 +17,7 @@ enum object_request_state {
COMPLETE
};
struct object_request
{
struct object_request {
struct walker *walker;
unsigned char sha1[20];
struct alt_base *repo;

15
http.h
View File

@ -42,14 +42,12 @@
#define NO_CURL_IOCTL
#endif
struct slot_results
{
struct slot_results {
CURLcode curl_result;
long http_code;
};
struct active_request_slot
{
struct active_request_slot {
CURL *curl;
FILE *local;
int in_use;
@ -62,8 +60,7 @@ struct active_request_slot
struct active_request_slot *next;
};
struct buffer
{
struct buffer {
struct strbuf buf;
size_t posn;
};
@ -149,8 +146,7 @@ extern int http_fetch_ref(const char *base, struct ref *ref);
extern int http_get_info_packs(const char *base_url,
struct packed_git **packs_head);
struct http_pack_request
{
struct http_pack_request {
char *url;
struct packed_git *target;
struct packed_git **lst;
@ -166,8 +162,7 @@ extern int finish_http_pack_request(struct http_pack_request *preq);
extern void release_http_pack_request(struct http_pack_request *preq);
/* Helpers for fetching object */
struct http_object_request
{
struct http_object_request {
char *url;
char tmpfile[PATH_MAX];
int localfile;

View File

@ -83,10 +83,8 @@ struct rename_df_conflict_info {
* Since we want to write the index eventually, we cannot reuse the index
* for these (temporary) data.
*/
struct stage_data
{
struct
{
struct stage_data {
struct {
unsigned mode;
unsigned char sha[20];
} stages[4];
@ -403,8 +401,7 @@ static void make_room_for_directories_of_df_conflicts(struct merge_options *o,
}
}
struct rename
{
struct rename {
struct diff_filepair *pair;
struct stage_data *src_entry;
struct stage_data *dst_entry;
@ -717,8 +714,7 @@ static void update_file(struct merge_options *o,
/* Low level file merging, update and removal */
struct merge_file_info
{
struct merge_file_info {
unsigned char sha[20];
unsigned mode;
unsigned clean:1,

View File

@ -2,8 +2,7 @@
#include "pack.h"
#include "pack-revindex.h"
struct idx_entry
{
struct idx_entry {
off_t offset;
const unsigned char *sha1;
unsigned int nr;

View File

@ -5,8 +5,7 @@ struct string_list_item {
char *string;
void *util;
};
struct string_list
{
struct string_list {
struct string_list_item *items;
unsigned int nr, alloc;
unsigned int strdup_strings:1;

View File

@ -12,8 +12,7 @@
static int debug;
struct helper_data
{
struct helper_data {
const char *name;
struct child_process *helper;
FILE *out;