stage1 整理代码 修复错误
This commit is contained in:
@@ -67,17 +67,10 @@ void spl_comp_reset(spl_comp_t *ctx) {
|
||||
}
|
||||
|
||||
void spl_comp_error(spl_comp_t *ctx, const char *fmt, ...) {
|
||||
const char *loc = spl_tok_loc_str(ctx);
|
||||
int loc_len = (int)strlen(loc);
|
||||
memcpy(ctx->error_msg, loc, loc_len);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
int n = vsnprintf(ctx->error_msg + loc_len, COMP_ERROR_MAX - loc_len - 1, fmt, args);
|
||||
vsnprintf(ctx->error_msg, COMP_ERROR_MAX - 1, fmt, args);
|
||||
va_end(args);
|
||||
if (n >= 0 && loc_len + n < COMP_ERROR_MAX - 2) {
|
||||
ctx->error_msg[loc_len + n] = '\n';
|
||||
ctx->error_msg[loc_len + n + 1] = '\0';
|
||||
}
|
||||
ctx->has_error = 1;
|
||||
}
|
||||
|
||||
@@ -216,8 +209,6 @@ int spl_add_global_data(spl_comp_t *ctx, void *data, usize size) {
|
||||
return spl_prog_add_data(&ctx->prog, data, size);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ---- Register runtime natives ---- */
|
||||
|
||||
void spl_comp_register(spl_prog_t *prog) { (void)prog; }
|
||||
|
||||
Reference in New Issue
Block a user