MCPcopy Index your code
hub / github.com/git/git / utf8_ish_width

Function utf8_ish_width

diff.c:2942–2951  ·  view source on GitHub ↗

* Like utf8_width(), but guaranteed safe for use in loops that subtract * per-character widths: * * - utf8_width() sets *start to NULL on invalid UTF-8 and returns 0; * we restore the pointer and advance by one byte, returning width 1 * (matching the strlen()-based fallback in utf8_strwidth()). * * - utf8_width() returns -1 for control characters; we return 0 * (matching ut

Source from the content-addressed store, hash-verified

2940 * (matching utf8_strnwidth() which skips them).
2941 */
2942static int utf8_ish_width(const char **start)
2943{
2944 const char *old = *start;
2945 int w = utf8_width(start, NULL);
2946 if (!*start) {
2947 *start = old + 1;
2948 return 1;
2949 }
2950 return (w < 0) ? 0 : w;
2951}
2952
2953static void show_stats(struct diffstat_t *data, struct diff_options *options)
2954{

Callers 1

show_statsFunction · 0.85

Calls 1

utf8_widthFunction · 0.85

Tested by

no test coverage detected