mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 08:18:30 +00:00
Improve Python tree-shaking
This commit is contained in:
parent
5bb2275788
commit
4f41f2184d
169 changed files with 4182 additions and 2411 deletions
|
@ -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 *)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue