More static
There still are quite a few symbols that ought to be static. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jun 13, 2007 at 01:42 UTC
4175e9e3a8734be1e96e385b0fa2428b86ed5809
8 files changed
+6
-64
builtin-revert.c
+2
-2
@@ -25,7 +25,7 @@ static const char *cherry_pick_usage = "git-cherry-pick [--edit] [-n] [-r] [-x]
25
26
static int edit;
27
static int replay;
28
-enum { REVERT, CHERRY_PICK } action;
28
+static enum { REVERT, CHERRY_PICK } action;
29
static int no_commit;
30
static struct commit *commit;
31
static int needed_deref;
@@ -129,7 +129,7 @@ static char *get_encoding(const char *message)
129
return NULL;
130
}
131
132
-struct lock_file msg_file;
132
+static struct lock_file msg_file;
133
static int msg_fd;
134
135
static void add_to_msg(const char *string)
cache.h
-1
@@ -369,7 +369,6 @@ extern int move_temp_to_file(const char *tmpfile, const char *filename);
369
370
extern int has_sha1_pack(const unsigned char *sha1, const char **ignore);
371
extern int has_sha1_file(const unsigned char *sha1);
372
-extern void *map_sha1_file(const unsigned char *sha1, unsigned long *);
372
373
extern int has_pack_file(const unsigned char *sha1);
374
extern int has_pack_index(const unsigned char *sha1);
commit.c
+1
-1
@@ -27,7 +27,7 @@ struct sort_node
27
28
const char *commit_type = "commit";
29
30
-struct cmt_fmt_map {
30
+static struct cmt_fmt_map {
31
const char *n;
32
size_t cmp_len;
33
enum cmit_fmt v;
csum-file.c
-55
@@ -73,33 +73,6 @@ int sha1write(struct sha1file *f, void *buf, unsigned int count)
73
return 0;
74
}
75
76
-struct sha1file *sha1create(const char *fmt, ...)
77
-{
78
- struct sha1file *f;
79
- unsigned len;
80
- va_list arg;
81
- int fd;
82
-
83
- f = xmalloc(sizeof(*f));
84
-
85
- va_start(arg, fmt);
86
- len = vsnprintf(f->name, sizeof(f->name), fmt, arg);
87
- va_end(arg);
88
- if (len >= PATH_MAX)
89
- die("you wascally wabbit, you");
90
- f->namelen = len;
91
-
92
- fd = open(f->name, O_CREAT | O_EXCL | O_WRONLY, 0666);
93
- if (fd < 0)
94
- die("unable to open %s (%s)", f->name, strerror(errno));
95
- f->fd = fd;
96
- f->error = 0;
97
- f->offset = 0;
98
- f->do_crc = 0;
99
- SHA1_Init(&f->ctx);
100
- return f;
101
-}
102
-
76
struct sha1file *sha1fd(int fd, const char *name)
77
{
78
struct sha1file *f;
@@ -121,34 +94,6 @@ struct sha1file *sha1fd(int fd, const char *name)
94
return f;
95
}
96
124
-int sha1write_compressed(struct sha1file *f, void *in, unsigned int size, int level)
125
-{
126
- z_stream stream;
127
- unsigned long maxsize;
128
- void *out;
129
-
130
- memset(&stream, 0, sizeof(stream));
131
- deflateInit(&stream, level);
132
- maxsize = deflateBound(&stream, size);
133
- out = xmalloc(maxsize);
134
-
135
- /* Compress it */
136
- stream.next_in = in;
137
- stream.avail_in = size;
138
-
139
- stream.next_out = out;
140
- stream.avail_out = maxsize;
141
-
142
- while (deflate(&stream, Z_FINISH) == Z_OK)
143
- /* nothing */;
144
- deflateEnd(&stream);
145
-
146
- size = stream.total_out;
147
- sha1write(f, out, size);
148
- free(out);
149
- return size;
150
-}
151
-
97
void crc32_begin(struct sha1file *f)
98
{
99
f->crc32 = crc32(0, Z_NULL, 0);
csum-file.h
-2
@@ -13,10 +13,8 @@ struct sha1file {
13
};
14
15
extern struct sha1file *sha1fd(int fd, const char *name);
16
-extern struct sha1file *sha1create(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
16
extern int sha1close(struct sha1file *, unsigned char *, int);
17
extern int sha1write(struct sha1file *, void *, unsigned int);
19
-extern int sha1write_compressed(struct sha1file *, void *, unsigned int, int);
18
extern void crc32_begin(struct sha1file *);
19
extern uint32_t crc32_end(struct sha1file *);
20
generate-cmdlist.sh
+1
-1
@@ -7,7 +7,7 @@ struct cmdname_help
7
char help[80];
8
};
9
10
-struct cmdname_help common_cmds[] = {"
10
+static struct cmdname_help common_cmds[] = {"
11
12
sort <<\EOF |
13
add
refs.c
+1
-1
@@ -150,7 +150,7 @@ static struct ref_list *sort_ref_list(struct ref_list *list)
150
* Future: need to be in "struct repository"
151
* when doing a full libification.
152
*/
153
-struct cached_refs {
153
+static struct cached_refs {
154
char did_loose;
155
char did_packed;
156
struct ref_list *loose;
sha1_file.c
+1
-1
@@ -959,7 +959,7 @@ int check_sha1_signature(const unsigned char *sha1, void *map, unsigned long siz
959
return hashcmp(sha1, real_sha1) ? -1 : 0;
960
}
961
962
-void *map_sha1_file(const unsigned char *sha1, unsigned long *size)
962
+static void *map_sha1_file(const unsigned char *sha1, unsigned long *size)
963
{
964
struct stat st;
965
void *map;