Port the examples to rename _get_at to _safe_get

This commit is contained in:
Patrick Pelissier committed 2021-10-30 00:17:15 +02:00
1 parent 51d4e930f5
commit c96cea5a13
3 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -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));
}
+2 -2
View File
@@ -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++;
+1 -1
View File
@@ -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: