-void Run(int client, const char *data, size_t size, FILE *fout = NULL, bool expand = false) {
- CYPool pool;
- CYUTF8String json(Run(pool, client, CYUTF8String(data, size)));
-
- data = json.data;
- size = json.size;
-
- if (data != NULL && fout != NULL) {
- if (!expand || data[0] != '"' && data[0] != '\'')
- fputs(data, fout);
- else for (size_t i(0); i != size; ++i)
- if (data[i] != '\\')
- fputc(data[i], fout);
- else switch(data[++i]) {
- case '\0': goto done;
- case '\\': fputc('\\', fout); break;
- case '\'': fputc('\'', fout); break;
- case '"': fputc('"', fout); break;
- case 'b': fputc('\b', fout); break;
- case 'f': fputc('\f', fout); break;
- case 'n': fputc('\n', fout); break;
- case 'r': fputc('\r', fout); break;
- case 't': fputc('\t', fout); break;
- case 'v': fputc('\v', fout); break;
- default: fputc('\\', fout); --i; break;
- }
+FILE *fout_;
+
+static void Output(CYUTF8String json, FILE *fout, bool expand = false) {
+ const char *data(json.data);
+ size_t size(json.size);
+
+ if (data == NULL || fout == NULL)
+ return;
+
+ if (!expand || data[0] != '"' && data[0] != '\'')
+ fputs(data, fout);
+ else for (size_t i(0); i != size; ++i)
+ if (data[i] != '\\')
+ fputc(data[i], fout);
+ else switch(data[++i]) {
+ case '\0': goto done;
+ case '\\': fputc('\\', fout); break;
+ case '\'': fputc('\'', fout); break;
+ case '"': fputc('"', fout); break;
+ case 'b': fputc('\b', fout); break;
+ case 'f': fputc('\f', fout); break;
+ case 'n': fputc('\n', fout); break;
+ case 'r': fputc('\r', fout); break;
+ case 't': fputc('\t', fout); break;
+ case 'v': fputc('\v', fout); break;
+ default: fputc('\\', fout); --i; break;
+ }