Less memory allocation
@@ -1609,31 +1609,30 @@ | ||
1609 | 1609 | |
1610 | 1610 | bool print_umask_symbolic(mode_t mode) |
1611 | 1611 | { |
1612 | - xstrbuf_T outputtext; | |
1612 | + char outputtext[19]; | |
1613 | + char *c = outputtext; | |
1613 | 1614 | |
1614 | - sb_initwithmax(&outputtext, 18); | |
1615 | - sb_ccat(&outputtext, 'u'); | |
1616 | - sb_ccat(&outputtext, '='); | |
1617 | - if (!(mode & S_IRUSR)) sb_ccat(&outputtext, 'r'); | |
1618 | - if (!(mode & S_IWUSR)) sb_ccat(&outputtext, 'w'); | |
1619 | - if (!(mode & S_IXUSR)) sb_ccat(&outputtext, 'x'); | |
1620 | - sb_ccat(&outputtext, ','); | |
1621 | - sb_ccat(&outputtext, 'g'); | |
1622 | - sb_ccat(&outputtext, '='); | |
1623 | - if (!(mode & S_IRGRP)) sb_ccat(&outputtext, 'r'); | |
1624 | - if (!(mode & S_IWGRP)) sb_ccat(&outputtext, 'w'); | |
1625 | - if (!(mode & S_IXGRP)) sb_ccat(&outputtext, 'x'); | |
1626 | - sb_ccat(&outputtext, ','); | |
1627 | - sb_ccat(&outputtext, 'o'); | |
1628 | - sb_ccat(&outputtext, '='); | |
1629 | - if (!(mode & S_IROTH)) sb_ccat(&outputtext, 'r'); | |
1630 | - if (!(mode & S_IWOTH)) sb_ccat(&outputtext, 'w'); | |
1631 | - if (!(mode & S_IXOTH)) sb_ccat(&outputtext, 'x'); | |
1632 | - sb_ccat(&outputtext, '\n'); | |
1615 | + *c++ = 'u'; | |
1616 | + *c++ = '='; | |
1617 | + if (!(mode & S_IRUSR)) *c++ = 'r'; | |
1618 | + if (!(mode & S_IWUSR)) *c++ = 'w'; | |
1619 | + if (!(mode & S_IXUSR)) *c++ = 'x'; | |
1620 | + *c++ = ','; | |
1621 | + *c++ = 'g'; | |
1622 | + *c++ = '='; | |
1623 | + if (!(mode & S_IRGRP)) *c++ = 'r'; | |
1624 | + if (!(mode & S_IWGRP)) *c++ = 'w'; | |
1625 | + if (!(mode & S_IXGRP)) *c++ = 'x'; | |
1626 | + *c++ = ','; | |
1627 | + *c++ = 'o'; | |
1628 | + *c++ = '='; | |
1629 | + if (!(mode & S_IROTH)) *c++ = 'r'; | |
1630 | + if (!(mode & S_IWOTH)) *c++ = 'w'; | |
1631 | + if (!(mode & S_IXOTH)) *c++ = 'x'; | |
1632 | + *c++ = '\n'; | |
1633 | + *c++ = '\0'; | |
1633 | 1634 | |
1634 | - bool result = xprintf("%s", outputtext.contents); | |
1635 | - sb_destroy(&outputtext); | |
1636 | - return result; | |
1635 | + return xprintf("%s", outputtext); | |
1637 | 1636 | } |
1638 | 1637 | |
1639 | 1638 | int set_umask(const wchar_t *maskstr) |