diff --git a/htmlsrc.c b/htmlsrc.c
index 185d9fc..09f7310 100644
--- a/htmlsrc.c
+++ b/htmlsrc.c
@@ -66,8 +66,8 @@ enum {
HTML_SCRIPT = 0x80, /* */
};
-static void htmlsrc_colorize_line(unsigned int *buf, int len,
- int *colorize_state_ptr, int state_only)
+void htmlsrc_colorize_line(unsigned int *buf, int len,
+ int *colorize_state_ptr, int state_only)
{
int c, state, js_state, l;
unsigned int *p, *p_start, *p_end;
diff --git a/qe.c b/qe.c
index f891e0b..fdf2c7d 100644
--- a/qe.c
+++ b/qe.c
@@ -3246,8 +3246,10 @@ int generic_get_colorized_line(EditState *s, unsigned int *buf, int buf_size,
/* realloc line buffer if needed */
if ((line_num + 2) > s->colorize_nb_lines) {
s->colorize_nb_lines = line_num + 2 + COLORIZED_LINE_PREALLOC_SIZE;
- if (!qe_realloc(&s->colorize_states, s->colorize_nb_lines))
+ if (!qe_realloc(&s->colorize_states,
+ s->colorize_nb_lines * sizeof(*s->colorize_states))) {
return 0;
+ }
}
/* propagate state if needed */
diff --git a/qe.h b/qe.h
index 58a3ba5..76a5a6e 100644
--- a/qe.h
+++ b/qe.h
@@ -1083,7 +1083,7 @@ struct EditState {
EditBuffer *b;
/* state before line n, one byte per line */
- unsigned char *colorize_states;
+ unsigned short *colorize_states;
int colorize_nb_lines;
int colorize_nb_valid_lines;
/* maximum valid offset, INT_MAX if not modified. Needed to invalide
@@ -1905,6 +1905,11 @@ void c_colorize_line(unsigned int *buf, int len,
extern ModeDef xml_mode;
+/* htmlsrc.c */
+
+void htmlsrc_colorize_line(unsigned int *buf, int len,
+ int *colorize_state_ptr, int state_only);
+
/* html.c */
extern ModeDef html_mode;