MCPcopy Index your code
hub / github.com/F-Stack/f-stack / str_flags

Function str_flags

tools/libutil/tests/humanize_number_test.c:454–474  ·  view source on GitHub ↗

Format flags parameter for meaningful display */

Source from the content-addressed store, hash-verified

452
453/* Format flags parameter for meaningful display */
454static char *
455str_flags(int hn_flags, char *noFlags) {
456 size_t i;
457 char * result;
458
459 result = malloc(MAX_STR_FLAGS_RESULT);
460 result[0] = '\0';
461
462 for (i = 0; i < sizeof flags / sizeof *flags; i++) {
463 if (hn_flags & flags[i].value) {
464 if (*result != 0)
465 strlcat(result, separator,
466 MAX_STR_FLAGS_RESULT);
467 strlcat(result, flags[i].name, MAX_STR_FLAGS_RESULT);
468 }
469 }
470
471 if (strlen(result) == 0)
472 strlcat(result, noFlags, MAX_STR_FLAGS_RESULT);
473 return result;
474}
475
476
477/* Format scale parameter for meaningful display */

Callers 2

str_scaleFunction · 0.85
mainFunction · 0.85

Calls 2

mallocFunction · 0.85
strlcatFunction · 0.50

Tested by

no test coverage detected