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>
Johannes Schindelin committed
Aug 10, 2009 at 18:22 UTC
28e9cf6512cae1b50a2d2003bb59da4392d99e2e
3 files changed
+13
-12
commit.h
+1
@@ -64,6 +64,7 @@ enum cmit_fmt {
64
};
65
66
extern int non_ascii(int);
67
+extern int has_non_ascii(const char *text);
68
struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */
69
extern char *reencode_commit_message(const struct commit *commit,
70
const char **encoding_p);
log-tree.c
-12
@@ -168,18 +168,6 @@ static unsigned int digits_in_number(unsigned int number)
168
return result;
169
}
170
171
-static int has_non_ascii(const char *s)
172
-{
173
- int ch;
174
- if (!s)
175
- return 0;
176
- while ((ch = *s++) != '\0') {
177
- if (non_ascii(ch))
178
- return 1;
179
- }
180
- return 0;
181
-}
182
-
171
void get_patch_filename(struct commit *commit, int nr, const char *suffix,
172
struct strbuf *buf)
173
{
pretty.c
+12
@@ -86,6 +86,18 @@ int non_ascii(int ch)
86
return !isascii(ch) || ch == '\033';
87
}
88
89
+int has_non_ascii(const char *s)
90
+{
91
+ int ch;
92
+ if (!s)
93
+ return 0;
94
+ while ((ch = *s++) != '\0') {
95
+ if (non_ascii(ch))
96
+ return 1;
97
+ }
98
+ return 0;
99
+}
100
+
101
static int is_rfc2047_special(char ch)
102
{
103
return (non_ascii(ch) || (ch == '=') || (ch == '?') || (ch == '_'));