removed obsolete microoptimization from parser repeat code

http-comm
Ondřej Hruška 7 years ago
parent 692b2c4d11
commit 2ede271c65
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 4
      user/cgi_main.c
  2. 13
      user/screen.c
  3. 2
      user/screen.h

@ -38,11 +38,11 @@ httpd_cgi_state ICACHE_FLASH_ATTR tplScreen(HttpdConnData *connData, char *token
tplSend(connData, buff, -1); tplSend(connData, buff, -1);
} }
else if (streq(token, "default_fg")) { else if (streq(token, "default_fg")) {
sprintf(buff, "0x%08X", termconf->default_fg); sprintf(buff, "%d", termconf->default_fg);
tplSend(connData, buff, -1); tplSend(connData, buff, -1);
} }
else if (streq(token, "default_bg")) { else if (streq(token, "default_bg")) {
sprintf(buff, "0x%08X", termconf->default_bg); sprintf(buff, "%d", termconf->default_bg);
tplSend(connData, buff, -1); tplSend(connData, buff, -1);
} }

@ -1689,18 +1689,7 @@ screenSerializeToBuffer(char *buffer, size_t buf_len, void **data)
i++; i++;
} else { } else {
// last character was repeated repCnt times // last character was repeated repCnt times
int savings = ss->lastCharLen*repCnt; bufput_t_utf8(SEQ_TAG_REPEAT, repCnt);
if (savings > 3) {
// Repeat count
bufput_t_utf8(SEQ_TAG_REPEAT, repCnt);
} else {
// repeat it manually
for(int k = 0; k < repCnt; k++) {
for (int j = 0; j < ss->lastCharLen; j++) {
bufput_c(ss->lastChar[j]);
}
}
}
} }
} }

@ -77,7 +77,7 @@ enum CursorShape {
typedef struct { typedef struct {
u32 width; u32 width;
u32 height; u32 height;
u32 default_bg; // 00-FFh - ANSI colors, (00:00:00-FF:FF:FF)+256 - True Color, 1<<24 + 256 - default from theme u32 default_bg; // 00-FFh - ANSI colors, (00:00:00-FF:FF:FF)+256 - True Color
u32 default_fg; u32 default_fg;
char title[TERM_TITLE_LEN]; char title[TERM_TITLE_LEN];
char btn[TERM_BTN_COUNT][TERM_BTN_LEN]; char btn[TERM_BTN_COUNT][TERM_BTN_LEN];

Loading…
Cancel
Save