summaryrefslogtreecommitdiff
path: root/src/blob.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-01-13 15:16:13 +0100
committerBram Moolenaar <Bram@vim.org>2019-01-13 15:16:13 +0100
commitc0f5a78c15b194f23bedb82e6825e34f481e6532 (patch)
tree499198e36943d41843167eadc9e90efdad928369 /src/blob.c
parent6e5ea8d2a995b32bbc5972edc4f827b959f2702f (diff)
downloadvim-git-c0f5a78c15b194f23bedb82e6825e34f481e6532.tar.gz
patch 8.1.0736: code for Blob not sufficiently testedv8.1.0736
Problem: Code for Blob not sufficiently tested. Solution: Add more tests. Fix uncovered crash. Add test_null_blob().
Diffstat (limited to 'src/blob.c')
-rw-r--r--src/blob.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/blob.c b/src/blob.c
index fc1d3f624..c260a4357 100644
--- a/src/blob.c
+++ b/src/blob.c
@@ -114,13 +114,16 @@ blob_equal(
blob_T *b1,
blob_T *b2)
{
- int i;
+ int i;
+ int len1 = blob_len(b1);
+ int len2 = blob_len(b2);
- if (b1 == NULL || b2 == NULL)
- return FALSE;
+ // empty and NULL are considered the same
+ if (len1 == 0 && len2 == 0)
+ return TRUE;
if (b1 == b2)
return TRUE;
- if (blob_len(b1) != blob_len(b2))
+ if (len1 != len2)
return FALSE;
for (i = 0; i < b1->bv_ga.ga_len; i++)