vt: no need to assign to term->vt.state for *every* input byte

This commit is contained in:
Daniel Eklöf 2019-12-20 22:12:35 +01:00
parent f36752f4d0
commit ee8a9674c4
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

38
vt.c
View file

@ -1100,25 +1100,27 @@ vt_from_slave(struct terminal *term, const uint8_t *data, size_t len)
;
for (size_t i = 0; i < len; i++) {
switch (current_state) {
case STATE_GROUND: term->vt.state = current_state = state_ground_switch(term, data[i]); continue;
case STATE_ESCAPE: term->vt.state = current_state = state_escape_switch(term, data[i]); continue;
case STATE_ESCAPE_INTERMEDIATE: term->vt.state = current_state = state_escape_intermediate_switch(term, data[i]); continue;
case STATE_CSI_ENTRY: term->vt.state = current_state = state_csi_entry_switch(term, data[i]); continue;
case STATE_CSI_PARAM: term->vt.state = current_state = state_csi_param_switch(term, data[i]); continue;
case STATE_CSI_INTERMEDIATE: term->vt.state = current_state = state_csi_intermediate_switch(term, data[i]); continue;
case STATE_CSI_IGNORE: term->vt.state = current_state = state_csi_ignore_switch(term, data[i]); continue;
case STATE_OSC_STRING: term->vt.state = current_state = state_osc_string_switch(term, data[i]); continue;
case STATE_DCS_ENTRY: term->vt.state = current_state = state_dcs_entry_switch(term, data[i]); continue;
case STATE_DCS_PARAM: term->vt.state = current_state = state_dcs_param_switch(term, data[i]); continue;
case STATE_DCS_INTERMEDIATE: term->vt.state = current_state = state_dcs_intermediate_switch(term, data[i]); continue;
case STATE_DCS_IGNORE: term->vt.state = current_state = state_dcs_ignore_switch(term, data[i]); continue;
case STATE_DCS_PASSTHROUGH: term->vt.state = current_state = state_dcs_passthrough_switch(term, data[i]); continue;
case STATE_SOS_PM_APC_STRING: term->vt.state = current_state = state_sos_pm_apc_string_switch(term, data[i]); continue;
case STATE_UTF8_COLLECT_1: term->vt.state = current_state = state_utf8_collect_1_switch(term, data[i]); continue;
case STATE_UTF8_COLLECT_2: term->vt.state = current_state = state_utf8_collect_2_switch(term, data[i]); continue;
case STATE_UTF8_COLLECT_3: term->vt.state = current_state = state_utf8_collect_3_switch(term, data[i]); continue;
case STATE_GROUND: current_state = state_ground_switch(term, data[i]); continue;
case STATE_ESCAPE: current_state = state_escape_switch(term, data[i]); continue;
case STATE_ESCAPE_INTERMEDIATE: current_state = state_escape_intermediate_switch(term, data[i]); continue;
case STATE_CSI_ENTRY: current_state = state_csi_entry_switch(term, data[i]); continue;
case STATE_CSI_PARAM: current_state = state_csi_param_switch(term, data[i]); continue;
case STATE_CSI_INTERMEDIATE: current_state = state_csi_intermediate_switch(term, data[i]); continue;
case STATE_CSI_IGNORE: current_state = state_csi_ignore_switch(term, data[i]); continue;
case STATE_OSC_STRING: current_state = state_osc_string_switch(term, data[i]); continue;
case STATE_DCS_ENTRY: current_state = state_dcs_entry_switch(term, data[i]); continue;
case STATE_DCS_PARAM: current_state = state_dcs_param_switch(term, data[i]); continue;
case STATE_DCS_INTERMEDIATE: current_state = state_dcs_intermediate_switch(term, data[i]); continue;
case STATE_DCS_IGNORE: current_state = state_dcs_ignore_switch(term, data[i]); continue;
case STATE_DCS_PASSTHROUGH: current_state = state_dcs_passthrough_switch(term, data[i]); continue;
case STATE_SOS_PM_APC_STRING: current_state = state_sos_pm_apc_string_switch(term, data[i]); continue;
case STATE_UTF8_COLLECT_1: current_state = state_utf8_collect_1_switch(term, data[i]); continue;
case STATE_UTF8_COLLECT_2: current_state = state_utf8_collect_2_switch(term, data[i]); continue;
case STATE_UTF8_COLLECT_3: current_state = state_utf8_collect_3_switch(term, data[i]); continue;
}
}
term->vt.state = current_state;
}