aboutsummaryrefslogtreecommitdiff
path: root/grid.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2017-10-01 14:45:12 +0100
committerSimon Tatham <anakin@pobox.com>2017-10-01 16:35:40 +0100
commita58c1b216bb1d4547f7b2ef2703fe2d0cd3b5cac (patch)
treeb9bcdc589ffe1f72e2510237b6e1524f5b96085c /grid.c
parent3276376d1be74b66970b88c3e941dcedf8d22474 (diff)
downloadpuzzles-a58c1b216bb1d4547f7b2ef2703fe2d0cd3b5cac.zip
puzzles-a58c1b216bb1d4547f7b2ef2703fe2d0cd3b5cac.tar.gz
puzzles-a58c1b216bb1d4547f7b2ef2703fe2d0cd3b5cac.tar.bz2
puzzles-a58c1b216bb1d4547f7b2ef2703fe2d0cd3b5cac.tar.xz
Make the code base clean under -Wwrite-strings.
I've also added that warning option and -Werror to the build script, so that I'll find out if I break this property in future.
Diffstat (limited to 'grid.c')
-rw-r--r--grid.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/grid.c b/grid.c
index 4929b5c..52648e5 100644
--- a/grid.c
+++ b/grid.c
@@ -1529,8 +1529,8 @@ static void grid_size_triangular(int width, int height,
*yextent = height * vec_y;
}
-static char *grid_validate_desc_triangular(grid_type type, int width,
- int height, const char *desc)
+static const char *grid_validate_desc_triangular(grid_type type, int width,
+ int height, const char *desc)
{
/*
* Triangular grids: an absent description is valid (indicating
@@ -2855,8 +2855,9 @@ static char *grid_new_desc_penrose(grid_type type, int width, int height, random
return dupstr(gd);
}
-static char *grid_validate_desc_penrose(grid_type type, int width, int height,
- const char *desc)
+static const char *grid_validate_desc_penrose(grid_type type,
+ int width, int height,
+ const char *desc)
{
int tilesize = PENROSE_TILESIZE, startsz, depth, xoff, yoff, aoff, inner_radius;
double outer_radius;
@@ -3032,8 +3033,8 @@ char *grid_new_desc(grid_type type, int width, int height, random_state *rs)
}
}
-char *grid_validate_desc(grid_type type, int width, int height,
- const char *desc)
+const char *grid_validate_desc(grid_type type, int width, int height,
+ const char *desc)
{
if (type == GRID_PENROSE_P2 || type == GRID_PENROSE_P3) {
return grid_validate_desc_penrose(type, width, height, desc);
@@ -3048,7 +3049,7 @@ char *grid_validate_desc(grid_type type, int width, int height,
grid *grid_new(grid_type type, int width, int height, const char *desc)
{
- char *err = grid_validate_desc(type, width, height, desc);
+ const char *err = grid_validate_desc(type, width, height, desc);
if (err) assert(!"Invalid grid description.");
return grid_news[type](width, height, desc);