Commit 0474080d authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Polishing VMOD JSON handling

parent 892264e0
......@@ -77,7 +77,7 @@ static int
vcc_path_open(void *priv, const char *fn)
{
struct vmod_import *vim;
const char *magic = "VMOD_JSON_SPEC\x03", *p;
const char *magic = "VMOD_JSON_SPEC\x02", *p;
int c;
FILE *f;
......@@ -114,10 +114,10 @@ vcc_path_open(void *priv, const char *fn)
c = getc(f);
if (c == EOF) {
AZ(fclose(f));
vim->err = "No VMOD JSON found";
vim->err = "Truncated VMOD JSON";
return (-1);
}
if (c == '\0')
if (c == '\x03')
break;
VSB_putc(vim->json, c);
}
......@@ -442,7 +442,7 @@ vcc_ParseImport(struct vcc *tl)
"Could not open VMOD %.*s\n", PF(mod));
VSB_printf(tl->sb, "\tFile name: %s\n",
vim->path != NULL ? vim->path : fn);
VSB_printf(tl->sb, "\tdlerror: %s\n", vim->err);
VSB_printf(tl->sb, "\tError: %s\n", vim->err);
}
vcc_ErrWhere(tl, mod);
vcc_vim_destroy(&vim);
......
......@@ -1105,7 +1105,7 @@ class vcc(object):
def json(self, fo, fnx):
fo.write('#define STRINGIFY(arg) #arg\n')
fo.write("\nstatic const char Vmod_Json[] = {\n")
fo.write('\t"VMOD_JSON_SPEC\\x03"\n')
fo.write('\t"VMOD_JSON_SPEC\x02"\n')
for n, i in enumerate(self.iter_json(fnx)):
fo.write('\t"')
......@@ -1121,7 +1121,7 @@ class vcc(object):
fo.write('\t STRINGIFY(%s)\n' % self.vrt_minor)
else:
fo.write('"\n')
fo.write('\t\"\\n\"\n};\n')
fo.write('\t\"\\n\\x03\"\n};\n')
fo.write('#undef STRINGIFY\n')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment