cleanup, error pages

This commit is contained in:
root
2026-06-16 08:46:54 +00:00
parent f2a3503ac3
commit dff1959341
6 changed files with 35 additions and 62 deletions
-47
View File
@@ -497,35 +497,6 @@ void compiler_record_compile_result(SharedUnit* su, f64 duration, bool success,
}
}
void compiler_begin_render_result(SharedUnit* su, bool count_request)
{
su->invoke_count += 1;
if(count_request)
su->request_count += 1;
su->last_rendered = time();
}
void compiler_record_render_result(SharedUnit* su, f64 duration, bool success, String error_status = "")
{
su->last_render_duration = duration;
su->total_render_duration += duration;
if(su->best_render_duration == 0 || duration < su->best_render_duration)
su->best_render_duration = duration;
if(duration > su->worst_render_duration)
su->worst_render_duration = duration;
if(success)
{
su->runtime_error_status = "";
}
else
{
su->runtime_error_count += 1;
su->runtime_error_status = error_status;
su->last_error = time();
}
}
String compiler_error_status(SharedUnit* su)
{
if(!su)
@@ -591,24 +562,6 @@ void compiler_tree_set_bool(DValue& tree, String key, bool value)
tree[key].set_bool(value);
}
bool compiler_is_request_entry_unit(Request* context, SharedUnit* su)
{
if(!context || !su)
return(false);
auto request_file = compiler_normalize_unit_path(context, context->params["SCRIPT_FILENAME"]);
return(request_file != "" && request_file == su->file_name);
}
bool compiler_can_write_response(Request* context)
{
return(
context &&
context->params["REQUEST_METHOD"] != "" &&
context->ob &&
context->ob_stack.size() > 0
);
}
}
String preprocess_shared_unit(Request* context, SharedUnit* su)
+2 -2
View File
@@ -625,7 +625,7 @@ String trim(String raw)
s64 len = raw.length();
s64 start_pos = 0;
s64 end_pos = len - 1;
if(len == 0 || (len == 1 && isspace((unsigned char)raw[0])))
if(len == 0)
return("");
while(start_pos < len && isspace((unsigned char)raw[start_pos]))
start_pos++;
@@ -2308,7 +2308,7 @@ String json_decode_String(String s, u32& i, char termination_char)
result.append(1, '\'');
break;
case('u'):
if(i <= s.length() && s.length() - i >= 5 && json_decode_unicode_escape(s, i, result))
if(s.length() - i >= 5 && json_decode_unicode_escape(s, i, result))
break;
return(result);
default: