Improve Python tree-shaking

This commit is contained in:
Justine Tunney 2021-09-06 19:24:10 -07:00
parent 5bb2275788
commit 4f41f2184d
169 changed files with 4182 additions and 2411 deletions

View file

@ -36,21 +36,29 @@
*/
char *(xstrcat)(const char *s, ...) {
va_list va;
size_t n, m;
intptr_t q;
char *p, b[2];
p = NULL;
size_t n, m, c;
n = 0;
c = 32;
p = xmalloc(c);
va_start(va, s);
do {
if ((intptr_t)s > 0 && (intptr_t)s <= 255) {
b[0] = (unsigned char)(intptr_t)s;
q = (intptr_t)s;
if (q > 0 && q <= 255) {
b[0] = q;
b[1] = '\0';
s = b;
m = 1;
} else {
m = strlen(s);
}
p = xrealloc(p, n + m + 1);
if (n + m + 1 > c) {
do {
c += c >> 1;
} while (n + m + 1 > c);
p = xrealloc(p, c);
}
memcpy(p + n, s, m + 1);
n += m;
} while ((s = va_arg(va, const char *)));