From c96cea5a132efdf25509d9ea559e3dbe0638b593 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Sat, 30 Oct 2021 00:17:15 +0200 Subject: [PATCH] Port the examples to rename _get_at to _safe_get --- example/ex-grep01.c | 2 +- example/ex-multi01.c | 4 ++-- example/ex-string03.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/example/ex-grep01.c b/example/ex-grep01.c index 0c9ae428..5e354216 100644 --- a/example/ex-grep01.c +++ b/example/ex-grep01.c @@ -34,7 +34,7 @@ int main(int argc, const char *argv[]) // While it reads some word from the file while (string_fget_word(word, " \t\n\r\"(),=", f)) { // Get the reference to the array of this word in the dictionnary (or create it if needed) - array_size_t *array = map_pos_get_at(positions, word); + array_size_t *array = map_pos_safe_get(positions, word); // Push the new offset to this word in the associated array array_size_push_back(*array, (size_t)ftell(f) - string_size(word)); } diff --git a/example/ex-multi01.c b/example/ex-multi01.c index fb1893f2..7df847bc 100644 --- a/example/ex-multi01.c +++ b/example/ex-multi01.c @@ -48,8 +48,8 @@ static void program_init(program_t p, string_t text) { int left; array_int_pop_back(&left, leftstack); int right = pc; - *array_int_get_at (p->bracket_map, left) = right; - *array_int_get_at (p->bracket_map, right) = left; + *array_int_safe_get (p->bracket_map, left) = right; + *array_int_safe_get (p->bracket_map, right) = left; } pc++; diff --git a/example/ex-string03.c b/example/ex-string03.c index 12aeaa5f..a72cf286 100644 --- a/example/ex-string03.c +++ b/example/ex-string03.c @@ -28,7 +28,7 @@ int main(void) M_LET(map, dict_str_t) { // Count the words: for M_EACH(w, words, vector_str_t) { - (*dict_str_get_at(map, *w)) ++; + (*dict_str_safe_get(map, *w)) ++; } // Print the count: