cgit

commit 7105a78b17b118866aee77735e26cffcd1fd08fd

Author: John Keeping <john@keeping.me.uk>

ui-tree: use "sane" isgraph()

Git's git-compat-util.h defines a "sane ctype" that does not use locale
information and works with signed chars, but it does not include
isgraph() so we have included ctype.h ourselves.

However, this means we have to include a system header before
git-compat-util.h which may lead to the system defining some macros
(e.g. _FILE_OFFSET_BITS on Solaris) before git-compat-util.h redefines
them with a different value.  We cannot include ctype.h after
git-compat-util.h because we have defined many of its functions as
macros which causes a stream of compilation errors.

Defining our own "sane" isgraph() using Git's sane isprint() and
isspace() avoids all of these problems.

Signed-off-by: John Keeping <john@keeping.me.uk>

 cgit.h | 3 +++
 ui-tree.c | 1 -


diff --git a/cgit.h b/cgit.h
index 508179a7fccad8f26027a51b27ed5f2541a2e68a..f3276276fe2c258ae802d8c0351422affb1f468d 100644
--- a/cgit.h
+++ b/cgit.h
@@ -25,6 +25,9 @@ #include 
 #include <notes.h>
 #include <graph.h>
 
+/* Add isgraph(x) to Git's sane ctype support (see git-compat-util.h) */
+#undef isgraph
+#define isgraph(x) (isprint((x)) && !isspace((x)))
 
 /*
  * Dateformats used on misc. pages




diff --git a/ui-tree.c b/ui-tree.c
index c8d24f653553c4116f5759dabb94b06710de4f06..2dbe89ea4faef6b3ac35b9fa6d8aa9d30678f328 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -6,7 +6,6 @@  * Licensed under GNU General Public License v2
  *   (see COPYING for full license text)
  */
 
-#include <ctype.h>
 #include "cgit.h"
 #include "ui-tree.h"
 #include "html.h"