List for cgit developers and users
 help / color / mirror / Atom feed
From: john at keeping.me.uk (John Keeping)
Subject: [PATCH 7/8] ui-tree: use "sane" isgraph()
Date: Thu, 13 Aug 2015 12:14:19 +0100	[thread overview]
Message-ID: <fcada6a44cda4290914672da9886891ede8fe9dc.1439464215.git.john@keeping.me.uk> (raw)
In-Reply-To: <cover.1439464215.git.john@keeping.me.uk>

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 at keeping.me.uk>
---
 cgit.h    | 3 +++
 ui-tree.c | 1 -
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/cgit.h b/cgit.h
index 508179a..f327627 100644
--- a/cgit.h
+++ b/cgit.h
@@ -25,6 +25,9 @@
 #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 c8d24f6..2dbe89e 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -6,7 +6,6 @@
  *   (see COPYING for full license text)
  */
 
-#include <ctype.h>
 #include "cgit.h"
 #include "ui-tree.h"
 #include "html.h"
-- 
2.5.0.466.g9af26fa



  parent reply	other threads:[~2015-08-13 11:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-13 11:14 [PATCH 0/8] Portability fixes john
2015-08-13 11:14 ` [PATCH 1/8] tests: allow shell to be overridden john
2015-08-13 11:14 ` [PATCH 2/8] Makefile: include Git's config.mak.uname john
2015-08-13 11:14 ` [PATCH 3/8] Remove redundant includes john
2015-08-13 13:36   ` Jason
2015-08-13 13:49     ` john
2015-08-20 13:51     ` mathstuf
2015-08-13 11:14 ` [PATCH 4/8] configfile.c: don't include system headers directly john
2015-08-13 11:14 ` [PATCH 5/8] cache.c: fix header order john
2015-08-13 11:14 ` [PATCH 6/8] cgit.h: move stdbool.h from ui-shared.h john
2015-08-13 11:14 ` john [this message]
2015-08-13 11:14 ` [PATCH 8/8] filter: don't use dlsym unnecessarily john
2015-08-13 13:38 ` [PATCH 0/8] Portability fixes Jason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fcada6a44cda4290914672da9886891ede8fe9dc.1439464215.git.john@keeping.me.uk \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).