{"thread":{"id":"408","subject":"git compatibility patches","startedAt":"2005-04-30T11:40:20Z","lastAt":"2005-04-30T11:40:20Z","messageCount":1,"participants":["Edgar Toernig"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"2249","messageId":"20050430134020.7fc926ae.froese@gmx.de","threadId":"408","inReplyTo":null,"subject":"git compatibility patches","fromName":"Edgar Toernig","fromEmail":"froese@gmx.de","sentAt":"2005-04-30T11:40:20Z","receivedAt":"2005-04-30T11:40:20Z","isPatch":false,"sender":{"key":"froese@gmx.de","avatar":null},"body":"With these fourc patches and the previous date patch git compiles\nand works on my good old gcc2.7/libc5/2.0-kernel system.\n\nThe first one: support for pre-1.2 zlib:\n\n--- k/cache.h  (mode:100644)\n+++ l/cache.h  (mode:100644)\n@@ -17,6 +17,10 @@\n #include SHA1_HEADER\n #include <zlib.h>\n \n+#if ZLIB_VERNUM < 0x1200\n+#define deflateBound(c,s)  ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11)\n+#endif\n+\n /*\n  * Basic data structures for the directory cache\n  *\n\n\n\n\nThe second one: missing dirent.d_type field\n\n--- k/cache.h  (mode:100644)\n+++ l/cache.h  (mode:100644)\n@@ -21,6 +21,15 @@\n #define deflateBound(c,s)  ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11)\n #endif\n \n+#ifdef DT_UNKNOWN\n+#define DTYPE(de)\t((de)->d_type)\n+#else\n+#define DT_UNKNOWN\t0\n+#define DT_DIR\t\t1\n+#define DT_REG\t\t2\n+#define DTYPE(de)\tDT_UNKNOWN\n+#endif\n+\n /*\n  * Basic data structures for the directory cache\n  *\n--- k/show-files.c  (mode:100644)\n+++ l/show-files.c  (mode:100644)\n@@ -129,7 +129,7 @@ static void read_directory(const char *p\n \t\t\tlen = strlen(de->d_name);\n \t\t\tmemcpy(fullname + baselen, de->d_name, len+1);\n \n-\t\t\tswitch (de->d_type) {\n+\t\t\tswitch (DTYPE(de)) {\n \t\t\tstruct stat st;\n \t\t\tdefault:\n \t\t\t\tcontinue;\n\n\n\nThe third one: replace AF_LOCAL with AF_UNIX (there's no AF_LOCAL in POSIX).\n\n--- k/rsh.c  (mode:100644)\n+++ l/rsh.c  (mode:100644)\n@@ -48,7 +48,7 @@ int setup_connection(int *fd_in, int *fd\n \t\t}\n \t}\n \tstrcpy(posn, \" -\");\n-\tif (socketpair(AF_LOCAL, SOCK_STREAM, 0, sv)) {\n+\tif (socketpair(AF_UNIX, SOCK_STREAM, 0, sv)) {\n \t\treturn error(\"Couldn't create socket\");\n \t}\n \tif (!fork()) {\n\n\nAnd the last one: move variable declarations to the start of the function.\n\n--- k/tag.c  (mode:100644)\n+++ l/tag.c  (mode:100644)\n@@ -26,6 +26,10 @@ int parse_tag(struct tag *item)\n         char type[20];\n         void *data, *bufptr;\n         unsigned long size;\n+\tint typelen, taglen;\n+\tunsigned char object[20];\n+\tconst char *type_line, *tag_line, *sig_line;\n+\n         if (item->object.parsed)\n                 return 0;\n         item->object.parsed = 1;\n@@ -36,10 +40,6 @@ int parse_tag(struct tag *item)\n         if (strcmp(type, tag_type))\n                 return error(\"Object %s not a tag\",\n                              sha1_to_hex(item->object.sha1));\n-\n-\tint typelen, taglen;\n-\tunsigned char object[20];\n-\tconst char *type_line, *tag_line, *sig_line;\n \n \tif (size < 64)\n \t\treturn -1;\n\nCiao, ET.\n"}]}