patch 8.1.0166: using dict_add_nr_str() is clumsy
Problem: Using dict_add_nr_str() is clumsy.
Solution: Split into two functions. (Ozaki Kiichi, closes #3154)
diff --git a/src/ops.c b/src/ops.c
index 2e08a53..26e15f7 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -1723,12 +1723,12 @@
buf[0] = (char_u)oap->regname;
buf[1] = NUL;
- dict_add_nr_str(v_event, "regname", 0, buf);
+ dict_add_string(v_event, "regname", buf);
buf[0] = get_op_char(oap->op_type);
buf[1] = get_extra_op_char(oap->op_type);
buf[2] = NUL;
- dict_add_nr_str(v_event, "operator", 0, buf);
+ dict_add_string(v_event, "operator", buf);
buf[0] = NUL;
buf[1] = NUL;
@@ -1741,7 +1741,7 @@
reglen + 1);
break;
}
- dict_add_nr_str(v_event, "regtype", 0, buf);
+ dict_add_string(v_event, "regtype", buf);
/* Lock the dictionary and its keys */
dict_set_items_ro(v_event);
@@ -7641,19 +7641,19 @@
#if defined(FEAT_EVAL)
if (dict != NULL)
{
- dict_add_nr_str(dict, "words", word_count, NULL);
- dict_add_nr_str(dict, "chars", char_count, NULL);
- dict_add_nr_str(dict, "bytes", byte_count
+ dict_add_number(dict, "words", word_count);
+ dict_add_number(dict, "chars", char_count);
+ dict_add_number(dict, "bytes", byte_count
# ifdef FEAT_MBYTE
+ bom_count
# endif
- , NULL);
- dict_add_nr_str(dict, VIsual_active ? "visual_bytes" : "cursor_bytes",
- byte_count_cursor, NULL);
- dict_add_nr_str(dict, VIsual_active ? "visual_chars" : "cursor_chars",
- char_count_cursor, NULL);
- dict_add_nr_str(dict, VIsual_active ? "visual_words" : "cursor_words",
- word_count_cursor, NULL);
+ );
+ dict_add_number(dict, VIsual_active ? "visual_bytes" : "cursor_bytes",
+ byte_count_cursor);
+ dict_add_number(dict, VIsual_active ? "visual_chars" : "cursor_chars",
+ char_count_cursor);
+ dict_add_number(dict, VIsual_active ? "visual_words" : "cursor_words",
+ word_count_cursor);
}
#endif
}