Skip to content

Commit 4175e9e

Browse files
committed
More static
There still are quite a few symbols that ought to be static. Signed-off-by: Junio C Hamano <[email protected]>
1 parent b79d18c commit 4175e9e

File tree

8 files changed

+6
-64
lines changed

8 files changed

+6
-64
lines changed

builtin-revert.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static const char *cherry_pick_usage = "git-cherry-pick [--edit] [-n] [-r] [-x]
2525

2626
static int edit;
2727
static int replay;
28-
enum { REVERT, CHERRY_PICK } action;
28+
static enum { REVERT, CHERRY_PICK } action;
2929
static int no_commit;
3030
static struct commit *commit;
3131
static int needed_deref;
@@ -129,7 +129,7 @@ static char *get_encoding(const char *message)
129129
return NULL;
130130
}
131131

132-
struct lock_file msg_file;
132+
static struct lock_file msg_file;
133133
static int msg_fd;
134134

135135
static void add_to_msg(const char *string)

cache.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,6 @@ extern int move_temp_to_file(const char *tmpfile, const char *filename);
369369

370370
extern int has_sha1_pack(const unsigned char *sha1, const char **ignore);
371371
extern int has_sha1_file(const unsigned char *sha1);
372-
extern void *map_sha1_file(const unsigned char *sha1, unsigned long *);
373372

374373
extern int has_pack_file(const unsigned char *sha1);
375374
extern int has_pack_index(const unsigned char *sha1);

commit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct sort_node
2727

2828
const char *commit_type = "commit";
2929

30-
struct cmt_fmt_map {
30+
static struct cmt_fmt_map {
3131
const char *n;
3232
size_t cmp_len;
3333
enum cmit_fmt v;

csum-file.c

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -73,33 +73,6 @@ int sha1write(struct sha1file *f, void *buf, unsigned int count)
7373
return 0;
7474
}
7575

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-
10376
struct sha1file *sha1fd(int fd, const char *name)
10477
{
10578
struct sha1file *f;
@@ -121,34 +94,6 @@ struct sha1file *sha1fd(int fd, const char *name)
12194
return f;
12295
}
12396

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-
15297
void crc32_begin(struct sha1file *f)
15398
{
15499
f->crc32 = crc32(0, Z_NULL, 0);

csum-file.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ struct sha1file {
1313
};
1414

1515
extern struct sha1file *sha1fd(int fd, const char *name);
16-
extern struct sha1file *sha1create(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
1716
extern int sha1close(struct sha1file *, unsigned char *, int);
1817
extern int sha1write(struct sha1file *, void *, unsigned int);
19-
extern int sha1write_compressed(struct sha1file *, void *, unsigned int, int);
2018
extern void crc32_begin(struct sha1file *);
2119
extern uint32_t crc32_end(struct sha1file *);
2220

generate-cmdlist.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ struct cmdname_help
77
char help[80];
88
};
99
10-
struct cmdname_help common_cmds[] = {"
10+
static struct cmdname_help common_cmds[] = {"
1111

1212
sort <<\EOF |
1313
add

refs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ static struct ref_list *sort_ref_list(struct ref_list *list)
150150
* Future: need to be in "struct repository"
151151
* when doing a full libification.
152152
*/
153-
struct cached_refs {
153+
static struct cached_refs {
154154
char did_loose;
155155
char did_packed;
156156
struct ref_list *loose;

sha1_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,7 @@ int check_sha1_signature(const unsigned char *sha1, void *map, unsigned long siz
959959
return hashcmp(sha1, real_sha1) ? -1 : 0;
960960
}
961961

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)
963963
{
964964
struct stat st;
965965
void *map;

0 commit comments

Comments
 (0)