mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-03 22:10:17 +01:00
[boilerplate] Make array of targets const.
Protect the boilerplate targets from unexpected modifications.
This commit is contained in:
parent
6aebde6598
commit
a41e1275d2
6 changed files with 14 additions and 14 deletions
|
|
@ -270,7 +270,7 @@ cairo_boilerplate_get_image_surface_from_png (const char *filename,
|
|||
return surface;
|
||||
}
|
||||
|
||||
static cairo_boilerplate_target_t targets[] =
|
||||
static const cairo_boilerplate_target_t targets[] =
|
||||
{
|
||||
/* I'm uncompromising about leaving the image backend as 0
|
||||
* for tolerance. There shouldn't ever be anything that is out of
|
||||
|
|
@ -744,13 +744,13 @@ static cairo_boilerplate_target_t targets[] =
|
|||
#endif
|
||||
};
|
||||
|
||||
cairo_boilerplate_target_t **
|
||||
const cairo_boilerplate_target_t **
|
||||
cairo_boilerplate_get_targets (int *pnum_targets, cairo_bool_t *plimited_targets)
|
||||
{
|
||||
size_t i, num_targets;
|
||||
cairo_bool_t limited_targets = FALSE;
|
||||
const char *tname;
|
||||
cairo_boilerplate_target_t **targets_to_test;
|
||||
const cairo_boilerplate_target_t **targets_to_test;
|
||||
|
||||
if ((tname = getenv ("CAIRO_TEST_TARGET")) != NULL && *tname) {
|
||||
/* check the list of targets specified by the user */
|
||||
|
|
@ -868,7 +868,7 @@ cairo_boilerplate_get_image_target (cairo_content_t content)
|
|||
}
|
||||
|
||||
void
|
||||
cairo_boilerplate_free_targets (cairo_boilerplate_target_t **targets)
|
||||
cairo_boilerplate_free_targets (const cairo_boilerplate_target_t **targets)
|
||||
{
|
||||
free (targets);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -168,11 +168,11 @@ typedef struct _cairo_boilerplate_target
|
|||
const cairo_boilerplate_target_t *
|
||||
cairo_boilerplate_get_image_target (cairo_content_t content);
|
||||
|
||||
cairo_boilerplate_target_t **
|
||||
const cairo_boilerplate_target_t **
|
||||
cairo_boilerplate_get_targets (int *num_targets, cairo_bool_t *limited_targets);
|
||||
|
||||
void
|
||||
cairo_boilerplate_free_targets (cairo_boilerplate_target_t **targets);
|
||||
cairo_boilerplate_free_targets (const cairo_boilerplate_target_t **targets);
|
||||
|
||||
cairo_surface_t *
|
||||
_cairo_boilerplate_get_image_surface (cairo_surface_t *src,
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@
|
|||
* loops wouldn't count the real work, just the recording by the
|
||||
* meta-surface. */
|
||||
static cairo_bool_t
|
||||
target_is_measurable (cairo_boilerplate_target_t *target)
|
||||
target_is_measurable (const cairo_boilerplate_target_t *target)
|
||||
{
|
||||
if (target->content != CAIRO_CONTENT_COLOR_ALPHA)
|
||||
return FALSE;
|
||||
|
|
@ -571,7 +571,7 @@ have_trace_filenames (cairo_perf_t *perf)
|
|||
|
||||
static void
|
||||
cairo_perf_trace (cairo_perf_t *perf,
|
||||
cairo_boilerplate_target_t *target,
|
||||
const cairo_boilerplate_target_t *target,
|
||||
const char *trace)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
|
@ -648,7 +648,7 @@ main (int argc, char *argv[])
|
|||
names_are_traces = have_trace_filenames (&perf);
|
||||
|
||||
for (i = 0; i < perf.num_targets; i++) {
|
||||
cairo_boilerplate_target_t *target = perf.targets[i];
|
||||
const cairo_boilerplate_target_t *target = perf.targets[i];
|
||||
|
||||
if (! perf.list_only && ! target_is_measurable (target))
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ const cairo_perf_case_t perf_cases[];
|
|||
* loops wouldn't count the real work, just the recording by the
|
||||
* meta-surface. */
|
||||
static cairo_bool_t
|
||||
target_is_measurable (cairo_boilerplate_target_t *target)
|
||||
target_is_measurable (const cairo_boilerplate_target_t *target)
|
||||
{
|
||||
switch (target->expected_type) {
|
||||
case CAIRO_SURFACE_TYPE_IMAGE:
|
||||
|
|
@ -417,7 +417,7 @@ main (int argc, char *argv[])
|
|||
perf.times = xmalloc (perf.iterations * sizeof (cairo_perf_ticks_t));
|
||||
|
||||
for (i = 0; i < perf.num_targets; i++) {
|
||||
cairo_boilerplate_target_t *target = perf.targets[i];
|
||||
const cairo_boilerplate_target_t *target = perf.targets[i];
|
||||
|
||||
if (! target_is_measurable (target))
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -84,9 +84,9 @@ typedef struct _cairo_perf {
|
|||
|
||||
/* Stuff used internally */
|
||||
cairo_perf_ticks_t *times;
|
||||
cairo_boilerplate_target_t **targets;
|
||||
const cairo_boilerplate_target_t **targets;
|
||||
int num_targets;
|
||||
cairo_boilerplate_target_t *target;
|
||||
const cairo_boilerplate_target_t *target;
|
||||
unsigned int test_number;
|
||||
unsigned int size;
|
||||
cairo_t *cr;
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ struct _cairo_test_context {
|
|||
|
||||
size_t num_targets;
|
||||
cairo_bool_t limited_targets;
|
||||
cairo_boilerplate_target_t **targets_to_test;
|
||||
const cairo_boilerplate_target_t **targets_to_test;
|
||||
cairo_bool_t own_targets;
|
||||
|
||||
int malloc_failure;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue