cleanup, error pages
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user