MCPcopy Index your code
hub / github.com/RsyncProject/rsync / stringDisplayWidth

Function stringDisplayWidth

popt/popthelp.c:118–134  ·  view source on GitHub ↗

* Determine number of display characters in a string. * @param s string * @return no. of display characters. */

Source from the content-addressed store, hash-verified

116 * @return no. of display characters.
117 */
118static inline size_t stringDisplayWidth(const char *s)
119{
120 size_t n = strlen(s);
121#ifdef HAVE_MBSRTOWCS
122 mbstate_t t;
123
124 memset ((void *)&t, 0, sizeof (t)); /* In initial state. */
125 /* Determine number of display characters. */
126 n = mbsrtowcs (NULL, &s, n, &t);
127#else
128 n = 0;
129 for (; *s; s = POPT_next_char(s))
130 n++;
131#endif
132
133 return n;
134}
135
136/**
137 * @param opt option(s)

Callers 3

singleOptionHelpFunction · 0.85
maxArgWidthFunction · 0.85
singleOptionUsageFunction · 0.85

Calls 1

POPT_next_charFunction · 0.85

Tested by

no test coverage detected