git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git compatibility patches
@ 2005-04-30 11:40 Edgar Toernig
  0 siblings, 0 replies; only message in thread
From: Edgar Toernig @ 2005-04-30 11:40 UTC (permalink / raw
  To: Linus Torvalds; +Cc: git

With these fourc patches and the previous date patch git compiles
and works on my good old gcc2.7/libc5/2.0-kernel system.

The first one: support for pre-1.2 zlib:

--- k/cache.h  (mode:100644)
+++ l/cache.h  (mode:100644)
@@ -17,6 +17,10 @@
 #include SHA1_HEADER
 #include <zlib.h>
 
+#if ZLIB_VERNUM < 0x1200
+#define deflateBound(c,s)  ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11)
+#endif
+
 /*
  * Basic data structures for the directory cache
  *




The second one: missing dirent.d_type field

--- k/cache.h  (mode:100644)
+++ l/cache.h  (mode:100644)
@@ -21,6 +21,15 @@
 #define deflateBound(c,s)  ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11)
 #endif
 
+#ifdef DT_UNKNOWN
+#define DTYPE(de)	((de)->d_type)
+#else
+#define DT_UNKNOWN	0
+#define DT_DIR		1
+#define DT_REG		2
+#define DTYPE(de)	DT_UNKNOWN
+#endif
+
 /*
  * Basic data structures for the directory cache
  *
--- k/show-files.c  (mode:100644)
+++ l/show-files.c  (mode:100644)
@@ -129,7 +129,7 @@ static void read_directory(const char *p
 			len = strlen(de->d_name);
 			memcpy(fullname + baselen, de->d_name, len+1);
 
-			switch (de->d_type) {
+			switch (DTYPE(de)) {
 			struct stat st;
 			default:
 				continue;



The third one: replace AF_LOCAL with AF_UNIX (there's no AF_LOCAL in POSIX).

--- k/rsh.c  (mode:100644)
+++ l/rsh.c  (mode:100644)
@@ -48,7 +48,7 @@ int setup_connection(int *fd_in, int *fd
 		}
 	}
 	strcpy(posn, " -");
-	if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sv)) {
+	if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv)) {
 		return error("Couldn't create socket");
 	}
 	if (!fork()) {


And the last one: move variable declarations to the start of the function.

--- k/tag.c  (mode:100644)
+++ l/tag.c  (mode:100644)
@@ -26,6 +26,10 @@ int parse_tag(struct tag *item)
         char type[20];
         void *data, *bufptr;
         unsigned long size;
+	int typelen, taglen;
+	unsigned char object[20];
+	const char *type_line, *tag_line, *sig_line;
+
         if (item->object.parsed)
                 return 0;
         item->object.parsed = 1;
@@ -36,10 +40,6 @@ int parse_tag(struct tag *item)
         if (strcmp(type, tag_type))
                 return error("Object %s not a tag",
                              sha1_to_hex(item->object.sha1));
-
-	int typelen, taglen;
-	unsigned char object[20];
-	const char *type_line, *tag_line, *sig_line;
 
 	if (size < 64)
 		return -1;

Ciao, ET.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-04-30 11:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-30 11:40 git compatibility patches Edgar Toernig

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).