diff src/typval.c @ 25806:8d55e978f95b v8.2.3438

patch 8.2.3438: cannot manipulate blobs Commit: https://github.com/vim/vim/commit/5dfe467432638fac2e0156a2f9cd0d9eb569fb39 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Tue Sep 14 17:54:30 2021 +0200 patch 8.2.3438: cannot manipulate blobs Problem: Cannot manipulate blobs. Solution: Add blob2list() and list2blob(). (Yegappan Lakshmanan, closes #8868)
author Bram Moolenaar <Bram@vim.org>
date Tue, 14 Sep 2021 18:00:08 +0200
parents 5ef704de7709
children 936f77929f16
line wrap: on
line diff
--- a/src/typval.c
+++ b/src/typval.c
@@ -471,6 +471,23 @@ check_for_opt_bool_arg(typval_T *args, i
 }
 
 /*
+ * Give an error and return FAIL unless "args[idx]" is a blob.
+ */
+    int
+check_for_blob_arg(typval_T *args, int idx)
+{
+    if (args[idx].v_type != VAR_BLOB)
+    {
+	if (idx >= 0)
+	    semsg(_(e_blob_required_for_argument_nr), idx + 1);
+	else
+	    emsg(_(e_blob_required));
+	return FAIL;
+    }
+    return OK;
+}
+
+/*
  * Give an error and return FAIL unless "args[idx]" is a list.
  */
     int