1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Merge commit 'origin/master'

This commit is contained in:
Miciah Dashiel Butler Masters 2007-09-26 16:28:11 +00:00
commit 04f1ecc3b5
8 changed files with 39 additions and 39 deletions

View File

@ -270,6 +270,8 @@ html_skip(struct html_context *html_context, unsigned char *a)
html_top->type = ELEMENT_DONT_KILL; html_top->type = ELEMENT_DONT_KILL;
} }
#define LWS(c) ((c) == ' ' || (c) == ASCII_TAB)
/* Parse meta refresh without URL= in it: /* Parse meta refresh without URL= in it:
* <meta http-equiv="refresh" content="3,http://elinks.or.cz/"> * <meta http-equiv="refresh" content="3,http://elinks.or.cz/">
* <meta http-equiv="refresh" content="3; http://elinks.or.cz/"> * <meta http-equiv="refresh" content="3; http://elinks.or.cz/">
@ -285,18 +287,18 @@ parse_old_meta_refresh(unsigned char *str, unsigned char **ret)
if_assert_failed return; if_assert_failed return;
*ret = NULL; *ret = NULL;
while (*p && (*p == ' ' || *p == ASCII_TAB)) p++; while (*p && LWS(*p)) p++;
if (!*p) return; if (!*p) return;
while (*p && *p >= '0' && *p <= '9') p++; while (*p && *p >= '0' && *p <= '9') p++;
if (!*p) return; if (!*p) return;
while (*p && (*p == ' ' || *p == ASCII_TAB)) p++; while (*p && LWS(*p)) p++;
if (!*p) return; if (!*p) return;
if (*p == ';' || *p == ',') p++; else return; if (*p == ';' || *p == ',') p++; else return;
while (*p && (*p == ' ' || *p == ASCII_TAB)) p++; while (*p && LWS(*p)) p++;
if (!*p) return; if (!*p) return;
len = strlen(p); len = strlen(p);
while (len && (p[len] == ' ' || p[len] == ASCII_TAB)) len--; while (len && LWS(p[len])) len--;
if (len) *ret = memacpy(p, len); if (len) *ret = memacpy(p, len);
} }
@ -321,7 +323,6 @@ parse_old_meta_refresh(unsigned char *str, unsigned char **ret)
static enum parse_header_param static enum parse_header_param
search_for_url_param(unsigned char *str, unsigned char **ret) search_for_url_param(unsigned char *str, unsigned char **ret)
{ {
#define LWS(c) ((c) == ' ' || (c) == ASCII_TAB)
unsigned char *p; unsigned char *p;
int plen = 0; int plen = 0;
@ -372,9 +373,10 @@ search_for_url_param(unsigned char *str, unsigned char **ret)
return HEADER_PARAM_OUT_OF_MEMORY; return HEADER_PARAM_OUT_OF_MEMORY;
} }
return HEADER_PARAM_FOUND; return HEADER_PARAM_FOUND;
#undef LWS
} }
#undef LWS
static void static void
check_head_for_refresh(struct html_context *html_context, unsigned char *head) check_head_for_refresh(struct html_context *html_context, unsigned char *head)
{ {

View File

@ -151,8 +151,9 @@ html_stack_dup(struct html_context *html_context, enum html_element_mortality_ty
if (ep->attr.title) e->attr.title = stracpy(ep->attr.title); if (ep->attr.title) e->attr.title = stracpy(ep->attr.title);
if (ep->attr.select) e->attr.select = stracpy(ep->attr.select); if (ep->attr.select) e->attr.select = stracpy(ep->attr.select);
#ifdef CONFIG_CSS
e->attr.id = e->attr.class = NULL; e->attr.id = e->attr.class = NULL;
#endif
/* We don't want to propagate these. */ /* We don't want to propagate these. */
/* XXX: For sure? --pasky */ /* XXX: For sure? --pasky */
e->attr.onclick = e->attr.ondblclick = e->attr.onmouseover = e->attr.onhover e->attr.onclick = e->attr.ondblclick = e->attr.onmouseover = e->attr.onhover

View File

@ -2064,10 +2064,10 @@ format_html_part(struct html_context *html_context,
{ {
struct part *part; struct part *part;
void *html_state; void *html_state;
int llm = renderer_context.last_link_to_move; struct tag *saved_last_tag_to_move = renderer_context.last_tag_to_move;
struct tag *ltm = renderer_context.last_tag_to_move; int saved_empty_format = renderer_context.empty_format;
int ef = renderer_context.empty_format; int saved_margin = html_context->margin;
int lm = html_context->margin; int saved_last_link_to_move = renderer_context.last_link_to_move;
/* Hash creation if needed. */ /* Hash creation if needed. */
if (!table_cache) { if (!table_cache) {
@ -2163,11 +2163,11 @@ format_html_part(struct html_context *html_context,
} }
ret: ret:
renderer_context.last_link_to_move = llm; renderer_context.last_link_to_move = saved_last_link_to_move;
renderer_context.last_tag_to_move = ltm; renderer_context.last_tag_to_move = saved_last_tag_to_move;
renderer_context.empty_format = ef; renderer_context.empty_format = saved_empty_format;
html_context->margin = lm; html_context->margin = saved_margin;
if (html_context->table_level > 1 && !document if (html_context->table_level > 1 && !document
&& table_cache && table_cache
@ -2176,10 +2176,8 @@ ret:
/* Clear memory to prevent bad key comparaison due to alignment /* Clear memory to prevent bad key comparaison due to alignment
* of key fields. */ * of key fields. */
struct table_cache_entry *tce = mem_calloc(1, sizeof(*tce)); struct table_cache_entry *tce = mem_calloc(1, sizeof(*tce));
/* A goto is used here to prevent a test or code
* redundancy. */
if (!tce) goto end;
if (tce) {
tce->key.start = start; tce->key.start = start;
tce->key.end = end; tce->key.end = end;
tce->key.align = align; tce->key.align = align;
@ -2197,8 +2195,7 @@ ret:
table_cache_entries++; table_cache_entries++;
} }
} }
}
end:
return part; return part;
} }