MIRROR: javascript for ๐Ÿœ's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

add stdin input printing option

+6 -2
+6 -2
src/main.c
··· 100 100 size_t n; 101 101 while ((n = fread(buf + *len, 1, cap - *len, stdin)) > 0) { 102 102 *len += n; 103 - if (*len == cap) { cap *= 2; buf = realloc(buf, cap); if (!buf) return NULL; } 103 + if (*len == cap) { 104 + cap *= 2; char *next = realloc(buf, cap); 105 + if (!next) { free(buf); return NULL; } 106 + buf = next; 107 + } 104 108 } 105 109 buf[*len] = '\0'; 106 110 return buf; ··· 391 395 fprintf(stderr, "Error: Out of memory\n"); 392 396 js_result = EXIT_FAILURE; goto cleanup; 393 397 } 394 - eval_code(js, buf, len, "[stdin]", false); free(buf); 398 + eval_code(js, buf, len, "[stdin]", print->count > 0); free(buf); 395 399 } 396 400 397 401 else {