From bf8675d314ffb0289779a954fdf6ae22f3322d0d Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sun, 5 Nov 2006 02:27:07 -0500 Subject: Use ULONG_MAX rather than implicit cast of -1. At least one (older) version of the Solaris C compiler won't allow 'unsigned long x = -1' without explicitly casting -1 to a type of unsigned long. So instead use ULONG_MAX, which is really the correct constant anyway. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano diff --git a/builtin-apply.c b/builtin-apply.c index f70ee98..6ec22b8 100644 --- a/builtin-apply.c +++ b/builtin-apply.c @@ -43,7 +43,7 @@ static int apply_verbosely; static int no_add; static int show_index_info; static int line_termination = '\n'; -static unsigned long p_context = -1; +static unsigned long p_context = ULONG_MAX; static const char apply_usage[] = "git-apply [--stat] [--numstat] [--summary] [--check] [--index] [--cached] [--apply] [--no-add] [--index-info] [--allow-binary-replacement] [--reverse] [--reject] [--verbose] [-z] [-pNUM] [-CNUM] [--whitespace=] ..."; -- cgit v0.10.2-6-g49f6 From af8ffbed0fc016e066765706738c45c65493f392 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sun, 5 Nov 2006 02:28:25 -0500 Subject: Remove SIMPLE_PROGRAMS and make git-daemon a normal program. Some platforms (Solaris in particular) appear to require -lz as part of the link line for git-daemon, due to it linking against sha1_file.o and that module requiring inflate/deflate support. So its time to retire SIMPLE_PROGRAMS and move its last remaining member into the standard PROGRAMS list, allowing it to link against all libraries used by the rest of Git. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano diff --git a/Makefile b/Makefile index 66c8b4b..b52dd57 100644 --- a/Makefile +++ b/Makefile @@ -185,15 +185,12 @@ SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \ $(patsubst %.py,%,$(SCRIPT_PYTHON)) \ git-cherry-pick git-status git-instaweb -# The ones that do not have to link with lcrypto, lz nor xdiff. -SIMPLE_PROGRAMS = \ - git-daemon$X - # ... and all the rest that could be moved out of bindir to gitexecdir PROGRAMS = \ git-convert-objects$X git-fetch-pack$X git-fsck-objects$X \ git-hash-object$X git-index-pack$X git-local-fetch$X \ git-merge-base$X \ + git-daemon$X \ git-merge-index$X git-mktag$X git-mktree$X git-patch-id$X \ git-peek-remote$X git-receive-pack$X \ git-send-pack$X git-shell$X \ @@ -215,7 +212,7 @@ BUILT_INS = \ $(patsubst builtin-%.o,git-%$X,$(BUILTIN_OBJS)) # what 'all' will build and 'install' will install, in gitexecdir -ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS) \ +ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS) \ git-merge-recur$X # Backward compatibility -- to be removed after 1.0 @@ -479,11 +476,9 @@ ifdef NEEDS_LIBICONV endif ifdef NEEDS_SOCKET EXTLIBS += -lsocket - SIMPLE_LIB += -lsocket endif ifdef NEEDS_NSL EXTLIBS += -lnsl - SIMPLE_LIB += -lnsl endif ifdef NO_D_TYPE_IN_DIRENT BASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT @@ -728,11 +723,6 @@ endif git-%$X: %.o $(GITLIBS) $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) -$(SIMPLE_PROGRAMS) : $(LIB_FILE) -$(SIMPLE_PROGRAMS) : git-%$X : %.o - $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ - $(LIB_FILE) $(SIMPLE_LIB) - ssh-pull.o: ssh-fetch.c ssh-push.o: ssh-upload.c git-local-fetch$X: fetch.o -- cgit v0.10.2-6-g49f6 From 6c2f207b2316149ee8dfaf026e4a869ff9ab42f7 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sun, 5 Nov 2006 00:37:23 -0500 Subject: Remove unsupported C99 style struct initializers in git-archive. At least one older version of the Solaris C compiler doesn't support the newer C99 style struct initializers. To allow Git to compile on those systems use an archive description struct which is easier to initialize without the C99 struct initializer syntax. Also since the archives array is not used by anyone other than archive.c we can make it static. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano diff --git a/archive.h b/archive.h index 16dcdb8..6838dc7 100644 --- a/archive.h +++ b/archive.h @@ -25,8 +25,6 @@ struct archiver { parse_extra_args_fn_t parse_extra; }; -extern struct archiver archivers[]; - extern int parse_archive_args(int argc, const char **argv, struct archiver *ar); diff --git a/builtin-archive.c b/builtin-archive.c index 9177379..2df1a84 100644 --- a/builtin-archive.c +++ b/builtin-archive.c @@ -15,16 +15,14 @@ static const char archive_usage[] = \ "git-archive --format= [--prefix=/] [--verbose] [] [path...]"; -struct archiver archivers[] = { - { - .name = "tar", - .write_archive = write_tar_archive, - }, - { - .name = "zip", - .write_archive = write_zip_archive, - .parse_extra = parse_extra_zip_args, - }, +static struct archiver_desc +{ + const char *name; + write_archive_fn_t write_archive; + parse_extra_args_fn_t parse_extra; +} archivers[] = { + { "tar", write_tar_archive, NULL }, + { "zip", write_zip_archive, parse_extra_zip_args }, }; static int run_remote_archiver(const char *remote, int argc, @@ -88,7 +86,10 @@ static int init_archiver(const char *name, struct archiver *ar) for (i = 0; i < ARRAY_SIZE(archivers); i++) { if (!strcmp(name, archivers[i].name)) { - memcpy(ar, &archivers[i], sizeof(struct archiver)); + memset(ar, 0, sizeof(*ar)); + ar->name = archivers[i].name; + ar->write_archive = archivers[i].write_archive; + ar->parse_extra = archivers[i].parse_extra; rv = 0; break; } -- cgit v0.10.2-6-g49f6