MCPcopy Create free account
hub / github.com/apache/impala / strcount

Function strcount

be/src/gutil/strings/util.h:220–229  ·  view source on GitHub ↗

Returns the number of times a character occurs in a string for a null terminated string.

Source from the content-addressed store, hash-verified

218// Returns the number of times a character occurs in a string for a null
219// terminated string.
220inline ptrdiff_t strcount(const char* buf, char c) {
221 if (buf == NULL)
222 return 0;
223 ptrdiff_t num = 0;
224 for (const char* bp = buf; *bp != '\0'; bp++) {
225 if (*bp == c)
226 num++;
227 }
228 return num;
229}
230// Returns the number of times a character occurs in a string for a string
231// defined by a pointer to the first character and a pointer just past the last
232// character.

Callers 1

ParseStringMethod · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected