summaryrefslogtreecommitdiff
path: root/render/box.c
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2003-04-11 21:06:51 +0000
committerJames Bursa <james@netsurf-browser.org>2003-04-11 21:06:51 +0000
commit02674693069358fc9f59700ea150d3811281f296 (patch)
tree7b51c457a0a3efbdc84fb00509bea02a6413d9ee /render/box.c
parent7c94cf8be972d6853cc15f3971bf36fe64b04d92 (diff)
downloadnetsurf-02674693069358fc9f59700ea150d3811281f296.tar.gz
netsurf-02674693069358fc9f59700ea150d3811281f296.tar.bz2
[project @ 2003-04-11 21:06:51 by bursa]
Memory usage and CSS fixes. svn path=/import/netsurf/; revision=122
Diffstat (limited to 'render/box.c')
-rw-r--r--render/box.c31
1 files changed, 4 insertions, 27 deletions
diff --git a/render/box.c b/render/box.c
index ad139f7c2..a94088fa6 100644
--- a/render/box.c
+++ b/render/box.c
@@ -1,5 +1,5 @@
/**
- * $Id: box.c,v 1.39 2003/04/10 21:44:45 bursa Exp $
+ * $Id: box.c,v 1.40 2003/04/11 21:06:51 bursa Exp $
*/
#include <assert.h>
@@ -24,7 +24,6 @@
static void box_add_child(struct box * parent, struct box * child);
static struct box * box_create(box_type type, struct css_style * style,
char *href);
-static char * tolat1(xmlChar * s);
static struct box * convert_xml_to_box(xmlNode * n, struct css_style * parent_style,
struct content ** stylesheet, unsigned int stylesheet_count,
struct css_selector ** selector, unsigned int depth,
@@ -105,28 +104,6 @@ struct box * box_create(box_type type, struct css_style * style,
}
-char * tolat1(xmlChar * s)
-{
- char *d = xcalloc(strlen((char*) s) + 1, sizeof(char));
- char *d0 = d;
- unsigned int u, chars;
-
- while (*s != 0) {
- u = sgetu8((unsigned char*) s, (int*) &chars);
- s += chars;
- if (u == 0x09 || u == 0x0a || u == 0x0d)
- *d = ' ';
- else if ((0x20 <= u && u <= 0x7f) || (0xa0 <= u && u <= 0xff))
- *d = u;
- else
- *d = '?';
- d++;
- }
- *d = 0;
-
- return d0;
-}
-
/**
* make a box tree with style data from an xml tree
*
@@ -212,7 +189,7 @@ struct box * convert_xml_to_box(xmlNode * n, struct css_style * parent_style,
add_img_element(elements, box->img);*/
if (style->display == CSS_DISPLAY_INLINE) {
if ((s = (char *) xmlGetProp(n, (const xmlChar *) "alt"))) {
- text = squash_whitespace(tolat1(s));
+ text = squash_tolat1(s);
xfree(s);
}
}
@@ -220,7 +197,7 @@ struct box * convert_xml_to_box(xmlNode * n, struct css_style * parent_style,
} else if (strcmp((const char *) n->name, "textarea") == 0) {
char * content = xmlNodeGetContent(n);
- char * thistext = squash_whitespace(tolat1(content)); /* squash ? */
+ char * thistext = squash_tolat1(content); /* squash ? */
LOG(("textarea"));
box = box_textarea(n, style, current_form);
current_textarea = box->gadget;
@@ -255,7 +232,7 @@ struct box * convert_xml_to_box(xmlNode * n, struct css_style * parent_style,
style->display = CSS_DISPLAY_BLOCK;
} else if (n->type == XML_TEXT_NODE) {
- text = squash_whitespace(tolat1(n->content));
+ text = squash_tolat1(n->content);
}
if (text != 0) {