summaryrefslogtreecommitdiff
path: root/css
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-02-05 15:07:19 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-02-05 15:07:19 +0000
commit0ccdff104f422ba08e7827f64d62b058b0500420 (patch)
tree9976e7ae3460a4be84a2ba4e9a0710410fdb0f38 /css
parent146e26a403edbfd045cf2cfdfac7f4e001e57e14 (diff)
downloadnetsurf-0ccdff104f422ba08e7827f64d62b058b0500420.tar.gz
netsurf-0ccdff104f422ba08e7827f64d62b058b0500420.tar.bz2
Blah.
svn path=/trunk/netsurf/; revision=6366
Diffstat (limited to 'css')
-rw-r--r--css/testcss.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/css/testcss.c b/css/testcss.c
index f3321690d..d21efa619 100644
--- a/css/testcss.c
+++ b/css/testcss.c
@@ -12,6 +12,8 @@
#include "utils/talloc.h"
#include "utils/utils.h"
+#define ITERATIONS (1)
+
bool verbose_log = 0;
int option_font_size = 10;
int option_font_min_size = 10;
@@ -123,59 +125,57 @@ int main(int argc, char **argv)
return 1;
}
- c = talloc_zero(0, struct content);
- if (c == NULL) {
- fprintf(stderr, "No memory for content\n");
- return 1;
- }
-
- c->url = talloc_strdup(c, "http://www.example.com/");
- if (c->url == NULL) {
- fprintf(stderr, "No memory for url\n");
- talloc_free(c);
- return 1;
- }
-
- c->type = CONTENT_CSS;
+ printf("sizeof(struct css_style): %zu\n", sizeof(struct css_style));
- fp = fopen(argv[1], "rb");
- if (fp == NULL) {
- fprintf(stderr, "Failed opening %s\n", argv[1]);
- talloc_free(c);
- return 1;
- }
+ for (int i = 0; i < ITERATIONS; i++) {
+ c = talloc_zero(0, struct content);
+ if (c == NULL) {
+ fprintf(stderr, "No memory for content\n");
+ return 1;
+ }
- fseek(fp, 0, SEEK_END);
- origlen = len = ftell(fp);
- fseek(fp, 0, SEEK_SET);
+ c->url = talloc_strdup(c, "http://www.example.com/");
+ if (c->url == NULL) {
+ fprintf(stderr, "No memory for url\n");
+ talloc_free(c);
+ return 1;
+ }
- printf("Reading %zu bytes\n", len);
+ c->type = CONTENT_CSS;
- while (len >= CHUNK_SIZE) {
- fread(data, 1, CHUNK_SIZE, fp);
+ fp = fopen(argv[1], "rb");
+ if (fp == NULL) {
+ fprintf(stderr, "Failed opening %s\n", argv[1]);
+ talloc_free(c);
+ return 1;
+ }
- css_process_data(c, data, CHUNK_SIZE);
+ fseek(fp, 0, SEEK_END);
+ origlen = len = ftell(fp);
+ fseek(fp, 0, SEEK_SET);
- len -= CHUNK_SIZE;
- }
+ while (len >= CHUNK_SIZE) {
+ fread(data, 1, CHUNK_SIZE, fp);
- if (len > 0) {
- fread(data, 1, len, fp);
+ css_process_data(c, data, CHUNK_SIZE);
- css_process_data(c, data, len);
+ len -= CHUNK_SIZE;
+ }
- len = 0;
- }
+ if (len > 0) {
+ fread(data, 1, len, fp);
- fclose(fp);
+ css_process_data(c, data, len);
- printf("Converting\n");
+ len = 0;
+ }
- css_convert(c, 100, 100);
+ fclose(fp);
- printf("Done\n");
+ css_convert(c, 100, 100);
- talloc_free(c);
+ talloc_free(c);
+ }
return 0;
}