Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2009-08-10 20:22:18 +0400
committerJunio C Hamano <gitster@pobox.com>2009-08-11 01:39:39 +0400
commit28e9cf6512cae1b50a2d2003bb59da4392d99e2e (patch)
tree7481792b7321e263437c6fe3650244db607de6ef
parent5dc36a5888a7063ff4536c9ea50eb0557bfef627 (diff)
Expose the has_non_ascii() function
This function is useful outside of log-tree.c, too. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--commit.h1
-rw-r--r--log-tree.c12
-rw-r--r--pretty.c12
3 files changed, 13 insertions, 12 deletions
diff --git a/commit.h b/commit.h
index ba9f63813e..4886544b63 100644
--- a/commit.h
+++ b/commit.h
@@ -64,6 +64,7 @@ enum cmit_fmt {
};
extern int non_ascii(int);
+extern int has_non_ascii(const char *text);
struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */
extern char *reencode_commit_message(const struct commit *commit,
const char **encoding_p);
diff --git a/log-tree.c b/log-tree.c
index 6f73c17d74..a3b4c0692c 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -168,18 +168,6 @@ static unsigned int digits_in_number(unsigned int number)
return result;
}
-static int has_non_ascii(const char *s)
-{
- int ch;
- if (!s)
- return 0;
- while ((ch = *s++) != '\0') {
- if (non_ascii(ch))
- return 1;
- }
- return 0;
-}
-
void get_patch_filename(struct commit *commit, int nr, const char *suffix,
struct strbuf *buf)
{
diff --git a/pretty.c b/pretty.c
index e5328dab5b..3b2ecdd20e 100644
--- a/pretty.c
+++ b/pretty.c
@@ -86,6 +86,18 @@ int non_ascii(int ch)
return !isascii(ch) || ch == '\033';
}
+int has_non_ascii(const char *s)
+{
+ int ch;
+ if (!s)
+ return 0;
+ while ((ch = *s++) != '\0') {
+ if (non_ascii(ch))
+ return 1;
+ }
+ return 0;
+}
+
static int is_rfc2047_special(char ch)
{
return (non_ascii(ch) || (ch == '=') || (ch == '?') || (ch == '_'));