MCPcopy Create free account
hub / github.com/apache/cloudberry / mb_utf_validate

Function mb_utf_validate

src/fe_utils/mbprint.c:135–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133
134
135static void
136mb_utf_validate(unsigned char *pwcs)
137{
138 unsigned char *p = pwcs;
139
140 while (*pwcs)
141 {
142 int len;
143
144 if ((len = utf_charcheck(pwcs)) > 0)
145 {
146 if (p != pwcs)
147 {
148 int i;
149
150 for (i = 0; i < len; i++)
151 *p++ = *pwcs++;
152 }
153 else
154 {
155 pwcs += len;
156 p += len;
157 }
158 }
159 else
160 /* we skip the char */
161 pwcs++;
162 }
163 if (p != pwcs)
164 *p = '\0';
165}
166
167/*
168 * public functions : wcswidth and mbvalidate

Callers 1

mbvalidateFunction · 0.85

Calls 1

utf_charcheckFunction · 0.85

Tested by

no test coverage detected