From 00804d9ff488f63468a0bb528c7b807aea7c3ea3 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Mon, 18 Apr 2022 00:44:51 +0200 Subject: Converted all example to use cstr_str(&s) instead of s.str to allow SSO string. Fixed misc warnings. --- examples/astar.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'examples/astar.c') diff --git a/examples/astar.c b/examples/astar.c index ee002b79..bce03716 100644 --- a/examples/astar.c +++ b/examples/astar.c @@ -105,7 +105,7 @@ astar(cstr* maze, int width) point delta = deltas[i]; point next = point_init(current.x + delta.x, current.y + delta.y, width); int new_cost = *csmap_pcost_at(&costs, current); - if (maze->str[point_index(&next)] != '#') + if (cstr_str(maze)[point_index(&next)] != '#') { const csmap_pcost_value *cost = csmap_pcost_get(&costs, next); if (cost == NULL || new_cost < cost->second) @@ -160,8 +160,8 @@ main(void) int width = cstr_find(maze, "\n") + 1; c_autovar (cdeq_point path = astar(&maze, width), cdeq_point_drop(&path)) { - c_foreach (it, cdeq_point, path) maze.str[point_index(it.ref)] = 'x'; - printf("%s", maze.str); + c_foreach (it, cdeq_point, path) cstr_data(&maze)[point_index(it.ref)] = 'x'; + printf("%s", cstr_str(&maze)); } } } -- cgit v1.2.3