Linus Torvalds <torvalds@linux-foundation.org> writes:Ok. How about adding BS and FF to the Ok set, and checking if bad ones are less than 1% of the good ones? diff --git a/convert.c b/convert.c index b6b7c66..b0c7641 100644 --- a/convert.c +++ b/convert.c @@ -34,11 +34,22 @@ static void gather_stats(const char *buf, unsigned long size, struct text_stat * stats->lf++; continue; } - if ((c < 32) && (c != '\t' && c != '\033')) { + if (c == 127) + /* DEL */ stats->nonprintable++; - continue; + else if (c < 32) { + switch (c) { + /* BS, HT, ESC and FF */ + case '\b': case '\t': case '\033': case '\014': + stats->printable++; + break; + default: + stats->nonprintable++; + } + } - stats->printable++; + else + stats->printable++; } } @@ -48,7 +59,7 @@ static void gather_stats(const char *buf, unsigned long size, struct text_stat * static int is_binary(unsigned long size, struct text_stat *stats) { - if (stats->nonprintable) + if ((stats->printable >> 7) < stats->nonprintable) return 1; /* * Other heuristics? Average line length might be relevant, - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
| David Woodhouse | Re: [GIT *] Allow request_firmware() to be satisfied from in-kernel, use it in mor... |
| Stefan Richter | Re: 2.6.22 -mm merge plans |
| david | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Dave Hansen | Re: [RFC/PATCH] Documentation of kernel messages |
git: | |
| Johannes Schindelin | Re: git on MacOSX and files with decomposed utf-8 file names |
| Martin Waitz | comparing file contents in is_exact_match? |
| Jon Smirl | Change set based shallow clone |
| Andreas Hildebrandt | CVS-$Id:$ replacement in git? |
| Jon Morby | IPv6 and OpenBGPD - Protocol not available |
| Alex Thurlow | Router performance on OpenBSD and OpenBGPD |
| Denis Doroshenko | Re: This is what Linus Torvalds calls openBSD crowd |
| Edd Barrett | Re: OpenBSD in the webcomic XKCD |
| Linux Kernel Mailing List | ssb: Fix watchdog access for devices without a chipcommon |
| Linux Kernel Mailing List | USB Serial Sierra: clean-up |
| Linux Kernel Mailing List | [ALSA] hda - Fix ALC262 fujitsu model |
| Linux Kernel Mailing List | USB Serial Sierra: Dynamic interface detection |
