From 0ccdff104f422ba08e7827f64d62b058b0500420 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Thu, 5 Feb 2009 15:07:19 +0000 Subject: Blah. svn path=/trunk/netsurf/; revision=6366 --- css/testcss.c | 78 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'css') 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; } -- cgit v1.2.3