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/dict.c b/src/dict.c
index 5506978..e1f7fa2 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -327,16 +327,11 @@
 }
 
 /*
- * Add a number or string entry to dictionary "d".
- * When "str" is NULL use number "nr", otherwise use "str".
+ * Add a number entry to dictionary "d".
  * Returns FAIL when out of memory and when key already exists.
  */
     int
-dict_add_nr_str(
-    dict_T	*d,
-    char	*key,
-    varnumber_T	nr,
-    char_u	*str)
+dict_add_number(dict_T *d, char *key, varnumber_T nr)
 {
     dictitem_T	*item;
 
@@ -344,16 +339,31 @@
     if (item == NULL)
 	return FAIL;
     item->di_tv.v_lock = 0;
-    if (str == NULL)
+    item->di_tv.v_type = VAR_NUMBER;
+    item->di_tv.vval.v_number = nr;
+    if (dict_add(d, item) == FAIL)
     {
-	item->di_tv.v_type = VAR_NUMBER;
-	item->di_tv.vval.v_number = nr;
+	dictitem_free(item);
+	return FAIL;
     }
-    else
-    {
-	item->di_tv.v_type = VAR_STRING;
-	item->di_tv.vval.v_string = vim_strsave(str);
-    }
+    return OK;
+}
+
+/*
+ * Add a string entry to dictionary "d".
+ * Returns FAIL when out of memory and when key already exists.
+ */
+    int
+dict_add_string(dict_T *d, char *key, char_u *str)
+{
+    dictitem_T	*item;
+
+    item = dictitem_alloc((char_u *)key);
+    if (item == NULL)
+	return FAIL;
+    item->di_tv.v_lock = 0;
+    item->di_tv.v_type = VAR_STRING;
+    item->di_tv.vval.v_string = str != NULL ? vim_strsave(str) : NULL;
     if (dict_add(d, item) == FAIL)
     {
 	dictitem_free(item);