add 'make swap' cmd
parent
ab06ce0192
commit
32d4aa8d02
|
@ -350134,6 +350134,10 @@ void (set_free)(set* m) {
|
||||||
#line 1 "v4k_string.c"
|
#line 1 "v4k_string.c"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#ifndef STACK_ALLOC_SIZE
|
||||||
|
#define STACK_ALLOC_SIZE (512*1024)
|
||||||
|
#endif
|
||||||
|
|
||||||
char* tempvl(const char *fmt, va_list vl) {
|
char* tempvl(const char *fmt, va_list vl) {
|
||||||
va_list copy;
|
va_list copy;
|
||||||
va_copy(copy, vl);
|
va_copy(copy, vl);
|
||||||
|
@ -350147,7 +350151,7 @@ char* tempvl(const char *fmt, va_list vl) {
|
||||||
static __thread char buf[STACK_ALLOC];
|
static __thread char buf[STACK_ALLOC];
|
||||||
#else
|
#else
|
||||||
int heap = 1;
|
int heap = 1;
|
||||||
static __thread int STACK_ALLOC = 512*1024;
|
static __thread int STACK_ALLOC = STACK_ALLOC_SIZE;
|
||||||
static __thread char *buf = 0; if(!buf) buf = REALLOC(0, STACK_ALLOC); // @leak
|
static __thread char *buf = 0; if(!buf) buf = REALLOC(0, STACK_ALLOC); // @leak
|
||||||
#endif
|
#endif
|
||||||
static __thread int cur = 0; //printf("string stack %d/%d\n", cur, STACK_ALLOC);
|
static __thread int cur = 0; //printf("string stack %d/%d\n", cur, STACK_ALLOC);
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#ifndef STACK_ALLOC_SIZE
|
||||||
|
#define STACK_ALLOC_SIZE (512*1024)
|
||||||
|
#endif
|
||||||
|
|
||||||
char* tempvl(const char *fmt, va_list vl) {
|
char* tempvl(const char *fmt, va_list vl) {
|
||||||
va_list copy;
|
va_list copy;
|
||||||
va_copy(copy, vl);
|
va_copy(copy, vl);
|
||||||
|
@ -13,7 +17,7 @@ char* tempvl(const char *fmt, va_list vl) {
|
||||||
static __thread char buf[STACK_ALLOC];
|
static __thread char buf[STACK_ALLOC];
|
||||||
#else
|
#else
|
||||||
int heap = 1;
|
int heap = 1;
|
||||||
static __thread int STACK_ALLOC = 512*1024;
|
static __thread int STACK_ALLOC = STACK_ALLOC_SIZE;
|
||||||
static __thread char *buf = 0; if(!buf) buf = REALLOC(0, STACK_ALLOC); // @leak
|
static __thread char *buf = 0; if(!buf) buf = REALLOC(0, STACK_ALLOC); // @leak
|
||||||
#endif
|
#endif
|
||||||
static __thread int cur = 0; //printf("string stack %d/%d\n", cur, STACK_ALLOC);
|
static __thread int cur = 0; //printf("string stack %d/%d\n", cur, STACK_ALLOC);
|
||||||
|
|
|
@ -503,6 +503,10 @@ void (set_free)(set* m) {
|
||||||
#line 1 "v4k_string.c"
|
#line 1 "v4k_string.c"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#ifndef STACK_ALLOC_SIZE
|
||||||
|
#define STACK_ALLOC_SIZE (512*1024)
|
||||||
|
#endif
|
||||||
|
|
||||||
char* tempvl(const char *fmt, va_list vl) {
|
char* tempvl(const char *fmt, va_list vl) {
|
||||||
va_list copy;
|
va_list copy;
|
||||||
va_copy(copy, vl);
|
va_copy(copy, vl);
|
||||||
|
@ -516,7 +520,7 @@ char* tempvl(const char *fmt, va_list vl) {
|
||||||
static __thread char buf[STACK_ALLOC];
|
static __thread char buf[STACK_ALLOC];
|
||||||
#else
|
#else
|
||||||
int heap = 1;
|
int heap = 1;
|
||||||
static __thread int STACK_ALLOC = 512*1024;
|
static __thread int STACK_ALLOC = STACK_ALLOC_SIZE;
|
||||||
static __thread char *buf = 0; if(!buf) buf = REALLOC(0, STACK_ALLOC); // @leak
|
static __thread char *buf = 0; if(!buf) buf = REALLOC(0, STACK_ALLOC); // @leak
|
||||||
#endif
|
#endif
|
||||||
static __thread int cur = 0; //printf("string stack %d/%d\n", cur, STACK_ALLOC);
|
static __thread int cur = 0; //printf("string stack %d/%d\n", cur, STACK_ALLOC);
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#define STACK_ALLOC_SIZE (128*1024*1024)
|
||||||
#include "v4k.c"
|
#include "v4k.c"
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
@ -18,16 +19,17 @@ int main(int argc, char **argv) {
|
||||||
char mode = strstri(buf, "//@#line 1 \"") == NULL;
|
char mode = strstri(buf, "//@#line 1 \"") == NULL;
|
||||||
char **lines = strsplit(buf, "\n");
|
char **lines = strsplit(buf, "\n");
|
||||||
|
|
||||||
|
printf("Switching #line %s\n", mode?"ON":"OFF");
|
||||||
|
|
||||||
for (int i = 0; i < array_count(lines); i++) {
|
for (int i = 0; i < array_count(lines); i++) {
|
||||||
char *line = STRDUP(lines[i]);
|
char *line = STRDUP(lines[i]); //@leak
|
||||||
if (!mode) {
|
if (!mode) {
|
||||||
strrepl(&line, "//@#line 1 \"", "#line 1 \"");
|
strrepl(&line, "//@#line 1 \"", "#line 1 \"");
|
||||||
} else {
|
} else {
|
||||||
strrepl(&line, "#line 1 \"", "//@#line 1 \"");
|
strrepl(&line, "#line 1 \"", "//@#line 1 \"");
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf("%s\n", line);
|
file_append(argv[1], va("%s\n", line), strlen(line)+1);
|
||||||
file_append(argv[1], line, strlen(line));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue