Skip to content
This repository was archived by the owner on Jul 2, 2019. It is now read-only.

Commit 82cc8d8

Browse files
author
Junio C Hamano
committed
Merge branch 'maint'
* maint: Remove unsupported C99 style struct initializers in git-archive. Remove SIMPLE_PROGRAMS and make git-daemon a normal program. Use ULONG_MAX rather than implicit cast of -1.
2 parents b2e2ddf + 6c2f207 commit 82cc8d8

File tree

4 files changed

+15
-26
lines changed

4 files changed

+15
-26
lines changed

Makefile

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,12 @@ SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
187187
$(patsubst %.py,%,$(SCRIPT_PYTHON)) \
188188
git-cherry-pick git-status git-instaweb
189189

190-
# The ones that do not have to link with lcrypto, lz nor xdiff.
191-
SIMPLE_PROGRAMS = \
192-
git-daemon$X
193-
194190
# ... and all the rest that could be moved out of bindir to gitexecdir
195191
PROGRAMS = \
196192
git-convert-objects$X git-fetch-pack$X git-fsck-objects$X \
197193
git-hash-object$X git-index-pack$X git-local-fetch$X \
198194
git-merge-base$X \
195+
git-daemon$X \
199196
git-merge-index$X git-mktag$X git-mktree$X git-patch-id$X \
200197
git-peek-remote$X git-receive-pack$X \
201198
git-send-pack$X git-shell$X \
@@ -217,7 +214,7 @@ BUILT_INS = \
217214
$(patsubst builtin-%.o,git-%$X,$(BUILTIN_OBJS))
218215

219216
# what 'all' will build and 'install' will install, in gitexecdir
220-
ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS) \
217+
ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS) \
221218
git-merge-recur$X
222219

223220
# Backward compatibility -- to be removed after 1.0
@@ -486,11 +483,9 @@ ifdef NEEDS_LIBICONV
486483
endif
487484
ifdef NEEDS_SOCKET
488485
EXTLIBS += -lsocket
489-
SIMPLE_LIB += -lsocket
490486
endif
491487
ifdef NEEDS_NSL
492488
EXTLIBS += -lnsl
493-
SIMPLE_LIB += -lnsl
494489
endif
495490
ifdef NO_D_TYPE_IN_DIRENT
496491
BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT
@@ -737,11 +732,6 @@ endif
737732
git-%$X: %.o $(GITLIBS)
738733
$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
739734

740-
$(SIMPLE_PROGRAMS) : $(LIB_FILE)
741-
$(SIMPLE_PROGRAMS) : git-%$X : %.o
742-
$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
743-
$(LIB_FILE) $(SIMPLE_LIB)
744-
745735
ssh-pull.o: ssh-fetch.c
746736
ssh-push.o: ssh-upload.c
747737
git-local-fetch$X: fetch.o

archive.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ struct archiver {
2525
parse_extra_args_fn_t parse_extra;
2626
};
2727

28-
extern struct archiver archivers[];
29-
3028
extern int parse_archive_args(int argc,
3129
const char **argv,
3230
struct archiver *ar);

builtin-apply.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static int apply_verbosely;
4343
static int no_add;
4444
static int show_index_info;
4545
static int line_termination = '\n';
46-
static unsigned long p_context = -1;
46+
static unsigned long p_context = ULONG_MAX;
4747
static const char apply_usage[] =
4848
"git-apply [--stat] [--numstat] [--summary] [--check] [--index] [--cached] [--apply] [--no-add] [--index-info] [--allow-binary-replacement] [--reverse] [--reject] [--verbose] [-z] [-pNUM] [-CNUM] [--whitespace=<nowarn|warn|error|error-all|strip>] <patch>...";
4949

builtin-archive.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,14 @@
1515
static const char archive_usage[] = \
1616
"git-archive --format=<fmt> [--prefix=<prefix>/] [--verbose] [<extra>] <tree-ish> [path...]";
1717

18-
struct archiver archivers[] = {
19-
{
20-
.name = "tar",
21-
.write_archive = write_tar_archive,
22-
},
23-
{
24-
.name = "zip",
25-
.write_archive = write_zip_archive,
26-
.parse_extra = parse_extra_zip_args,
27-
},
18+
static struct archiver_desc
19+
{
20+
const char *name;
21+
write_archive_fn_t write_archive;
22+
parse_extra_args_fn_t parse_extra;
23+
} archivers[] = {
24+
{ "tar", write_tar_archive, NULL },
25+
{ "zip", write_zip_archive, parse_extra_zip_args },
2826
};
2927

3028
static int run_remote_archiver(const char *remote, int argc,
@@ -88,7 +86,10 @@ static int init_archiver(const char *name, struct archiver *ar)
8886

8987
for (i = 0; i < ARRAY_SIZE(archivers); i++) {
9088
if (!strcmp(name, archivers[i].name)) {
91-
memcpy(ar, &archivers[i], sizeof(struct archiver));
89+
memset(ar, 0, sizeof(*ar));
90+
ar->name = archivers[i].name;
91+
ar->write_archive = archivers[i].write_archive;
92+
ar->parse_extra = archivers[i].parse_extra;
9293
rv = 0;
9394
break;
9495
}

0 commit comments

Comments
 (0)