summaryrefslogtreecommitdiff
path: root/perf/cairo-perf-diff-files.c
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2007-04-19 16:21:39 -0700
committerCarl Worth <cworth@cworth.org>2007-04-25 11:27:33 -0700
commit6121f4fccfe8d98fb09c096402da05d29d10b9e8 (patch)
treec304993aa3ad53f5f5443b39cebb180f49f7cc8d /perf/cairo-perf-diff-files.c
parentcc03f0499e7b133a2e5c14e55207259ea000b8c2 (diff)
cairo-perf-diff-files: Simplify code to grow report->tests
Diffstat (limited to 'perf/cairo-perf-diff-files.c')
-rw-r--r--perf/cairo-perf-diff-files.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/perf/cairo-perf-diff-files.c b/perf/cairo-perf-diff-files.c
index 7b64504f..9492c206 100644
--- a/perf/cairo-perf-diff-files.c
+++ b/perf/cairo-perf-diff-files.c
@@ -369,8 +369,8 @@ cairo_perf_report_load (cairo_perf_report_t *report, const char *filename)
size_t line_size = 0;
report->name = filename;
- report->tests = NULL;
- report->tests_size = 0;
+ report->tests_size = 16;
+ report->tests = xmalloc (report->tests_size * sizeof (test_report_t));
report->tests_count = 0;
file = fopen (filename, "r");
@@ -382,13 +382,9 @@ cairo_perf_report_load (cairo_perf_report_t *report, const char *filename)
while (1) {
if (report->tests_count == report->tests_size) {
- report->tests_size = report->tests_size ? 2 * report->tests_size : 16;
- report->tests = realloc (report->tests,
- report->tests_size * sizeof (test_report_t));
- if (report->tests == NULL) {
- fprintf (stderr, "Out of memory.\n");
- exit (1);
- }
+ report->tests_size *= 2;
+ report->tests = xrealloc (report->tests,
+ report->tests_size * sizeof (test_report_t));
}
line_number++;