Re: [PATCH] Reorganize common code

2005-04-14 Thread Daniel Barkalow
I forgot to include util.c. On my to-do list is something to make this
more obvious.

Signed-Off-By: Daniel Barkalow [EMAIL PROTECTED]

Index: util.c
===
--- /dev/null  (tree:e8194c62bfc68725972a6847fa2c6d529ca64137)
+++ 420a52c504bf712cd898a11746a54ea4349a9386/util.c  (mode:100644 
sha1:d1d497c6709503f71138e816b2599d5105cc4915)
@@ -0,0 +1,37 @@
+#include util.h
+#include stdarg.h
+#include stdio.h
+#include stdlib.h
+
+void usage(const char *err)
+{
+   fprintf(stderr, usage: %s\n, err);
+   exit(1);
+}
+
+static void report(const char *prefix, const char *err, va_list params)
+{
+   fputs(prefix, stderr);
+   vfprintf(stderr, err, params);
+   fputs(\n, stderr);
+}
+
+void die(const char *err, ...)
+{
+   va_list params;
+
+   va_start(params, err);
+   report(fatal: , err, params);
+   va_end(params);
+   exit(1);
+}
+
+int error(const char *err, ...)
+{
+   va_list params;
+
+   va_start(params, err);
+   report(error: , err, params);
+   va_end(params);
+   return -1;
+}

-
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Reorganize common code

2005-04-14 Thread Petr Baudis
Dear diary, on Thu, Apr 14, 2005 at 12:00:25AM CEST, I got a letter
where Daniel Barkalow [EMAIL PROTECTED] told me that...
 This splits read-cache.c into util.c, cache.c, and objects.c, based on
 what the code is used for; similarly, cache.h becomes util.h, cache.h, and
 objects.h. For simplicity, cache.h includes the other two to give the
 previous overall behavior.
 
 Signed-Off-By: Daniel Barkalow [EMAIL PROTECTED]

FYI, given the scale of this change, I'm waiting for Linus to either ack
it, pick it himself or reject it.

-- 
Petr Pasky Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
-
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html