summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c6c8d0b)
raw | patch | inline | side by side (parent: c6c8d0b)
author | Jonathan Nieder <jrnieder@gmail.com> | |
Wed, 16 Mar 2011 07:08:34 +0000 (02:08 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 16 Mar 2011 19:49:02 +0000 (12:49 -0700) |
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>
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>
17 files changed:
builtin/add.c | patch | blob | history | |
builtin/blame.c | patch | blob | history | |
builtin/grep.c | patch | blob | history | |
builtin/index-pack.c | patch | blob | history | |
commit.h | patch | blob | history | |
config.c | patch | blob | history | |
diff.c | patch | blob | history | |
fast-import.c | patch | blob | history | |
fetch-pack.h | patch | blob | history | |
generate-cmdlist.sh | patch | blob | history | |
http-push.c | patch | blob | history | |
http-walker.c | patch | blob | history | |
http.h | patch | blob | history | |
merge-recursive.c | patch | blob | history | |
pack-check.c | patch | blob | history | |
string-list.h | patch | blob | history | |
transport-helper.c | patch | blob | history |
diff --git a/builtin/add.c b/builtin/add.c
index 42c906ea06b3d20d88ed6ba1c83d894d4e24f163..1d74763f58d893619501427bcee0cc04c2878a02 100644 (file)
--- a/builtin/add.c
+++ b/builtin/add.c
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 aa30ec52692558b0d8ed3dc3b6d671185682026e..f6b03f750a0b69ef835caa0a2e4988f9a08abb85 100644 (file)
--- a/builtin/blame.c
+++ b/builtin/blame.c
/*
* 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 fdf7131efd25618250f382dff178ca38f9b42c77..34f9ae03044f8f4c1bf36c41791020fe5b125b2c 100644 (file)
--- a/builtin/grep.c
+++ b/builtin/grep.c
* 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 8dc5c0b5410d4bb57607bab690126f22d954dd7a..c7e600db4745c80fddcb14986bc192d80630aa51 100644 (file)
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
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;
#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 659c87c3ee90c23064f617e3bcf3ace12e32ea04..41985130d1473573af2cfd4ca97a579e999b0c0b 100644 (file)
--- a/commit.h
+++ b/commit.h
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 47e6ba5a3b5820a2837aca3f140bf1b8738821e2..3dd55d507b5e3551e2ec315dda3fc37d2a74ad5a 100644 (file)
--- a/config.c
+++ b/config.c
const char *config_exclusive_filename = NULL;
-struct config_item
-{
+struct config_item {
struct config_item *next;
char *name;
char *value;
index 5422c438826254f36d1e00af0e8b882690661276..2f2ab87d96324df35cb56c07d8c416f029ba9f56 100644 (file)
--- a/diff.c
+++ b/diff.c
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 970d8470ed7c350337f28570fd2c111186a7941d..87f36b36c3de8c90c7bea770208cd17f3fedab25 100644 (file)
--- a/fast-import.c
+++ b/fast-import.c
#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,
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];
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;
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];
};
WHENSPEC_NOW
} whenspec_type;
-struct recent_command
-{
+struct recent_command {
struct recent_command *prev;
struct recent_command *next;
char *buf;
diff --git a/fetch-pack.h b/fetch-pack.h
index fbe85ac05fd2d945d645365dc086460003fa7f27..0608edae3fe7b07b852b30281fea978806798c99 100644 (file)
--- a/fetch-pack.h
+++ b/fetch-pack.h
#ifndef FETCH_PACK_H
#define FETCH_PACK_H
-struct fetch_pack_args
-{
+struct fetch_pack_args {
const char *uploadpack;
int unpacklimit;
int depth;
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
index 75c68d948fd3105272f893ff2f901007519f62f5..3ef4861d04ed5fed14d31b92e047a03cf5362970 100755 (executable)
--- a/generate-cmdlist.sh
+++ b/generate-cmdlist.sh
#!/bin/sh
echo "/* Automatically generated by $0 */
-struct cmdname_help
-{
+struct cmdname_help {
char name[16];
char help[80];
};
diff --git a/http-push.c b/http-push.c
index ff41a0e183dd3a449f5136c6d1488a31b4a8960b..d18346c0f5c9ce73f3fe9a1efc7b1b63e7380bb8 100644 (file)
--- a/http-push.c
+++ b/http-push.c
static struct object_list *objects;
-struct repo
-{
+struct repo {
char *url;
char *path;
int path_len;
COMPLETE
};
-struct transfer_request
-{
+struct transfer_request {
struct object *obj;
char *url;
char *dest;
static struct transfer_request *request_queue_head;
-struct xml_ctx
-{
+struct xml_ctx {
char *name;
int len;
char *cdata;
void *userData;
};
-struct remote_lock
-{
+struct remote_lock {
char *url;
char *owner;
char *token;
/* 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;
diff --git a/http-walker.c b/http-walker.c
index 18bd6504beb99ab68f360c4fa93011efae42fdfb..9bc8114c3bb2f6f87f7f61962a64c4e5b012dcf8 100644 (file)
--- a/http-walker.c
+++ b/http-walker.c
#include "walker.h"
#include "http.h"
-struct alt_base
-{
+struct alt_base {
char *base;
int got_indices;
struct packed_git *packs;
COMPLETE
};
-struct object_request
-{
+struct object_request {
struct walker *walker;
unsigned char sha1[20];
struct alt_base *repo;
index 5c6e243dde3c654a3c0a705146fb15395c27fb95..e9ed3c2e8272e43208e75459ec29fd8b6548ae4d 100644 (file)
--- a/http.h
+++ b/http.h
#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;
struct active_request_slot *next;
};
-struct buffer
-{
+struct buffer {
struct strbuf buf;
size_t posn;
};
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;
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;
diff --git a/merge-recursive.c b/merge-recursive.c
index 16c2dbeab95a0f4099e3de8badf688bb4dee8189..42d52cb5bc17e9bb289a6b6c3e90c97d241660a2 100644 (file)
--- a/merge-recursive.c
+++ b/merge-recursive.c
* 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];
}
}
-struct rename
-{
+struct rename {
struct diff_filepair *pair;
struct stage_data *src_entry;
struct stage_data *dst_entry;
/* Low level file merging, update and removal */
-struct merge_file_info
-{
+struct merge_file_info {
unsigned char sha[20];
unsigned mode;
unsigned clean:1,
diff --git a/pack-check.c b/pack-check.c
index 9d0cb9a114cb3e5b0a4a4a132b9289ef18d8ae21..c3bf21dbcb4b79fdc815ef80ae5c970aafd02bbf 100644 (file)
--- a/pack-check.c
+++ b/pack-check.c
#include "pack.h"
#include "pack-revindex.h"
-struct idx_entry
-{
+struct idx_entry {
off_t offset;
const unsigned char *sha1;
unsigned int nr;
diff --git a/string-list.h b/string-list.h
index 494693898b89fe2f8145b483ea7e366e9b1192c1..bda69839832d2030c15bbd86c4d8d79aa3cc4785 100644 (file)
--- a/string-list.h
+++ b/string-list.h
char *string;
void *util;
};
-struct string_list
-{
+struct string_list {
struct string_list_item *items;
unsigned int nr, alloc;
unsigned int strdup_strings:1;
diff --git a/transport-helper.c b/transport-helper.c
index 4e4754c32bd53f28f9335c2a4529f5804f3086f2..8866adf08898f5855dd1dea1db4286021ffb880c 100644 (file)
--- a/transport-helper.c
+++ b/transport-helper.c
static int debug;
-struct helper_data
-{
+struct helper_data {
const char *name;
struct child_process *helper;
FILE *out;