mirror of
https://github.com/neovim/neovim.git
synced 2025-10-08 10:56:31 +00:00
vim-patch:8.1.0736: code for Blob not sufficiently tested
Problem: Code for Blob not sufficiently tested.
Solution: Add more tests. Fix uncovered crash. Add test_null_blob().
c0f5a78c15
eval0 and ex_echo's emsg-specific changes have already been ported.
These tests uncover another crash that was fixed in v8.1.0738.
This commit is contained in:
@@ -2174,13 +2174,17 @@ void tv_blob_unref(blob_T *const b)
|
||||
bool tv_blob_equal(const blob_T *const b1, const blob_T *const b2)
|
||||
FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
if (b1 == NULL || b2 == NULL) {
|
||||
return false;
|
||||
const int len1 = tv_blob_len(b1);
|
||||
const int len2 = tv_blob_len(b2);
|
||||
|
||||
// empty and NULL are considered the same
|
||||
if (len1 == 0 && len2 == 0) {
|
||||
return true;
|
||||
}
|
||||
if (b1 == b2) {
|
||||
return true;
|
||||
}
|
||||
if (tv_blob_len(b1) != tv_blob_len(b2)) {
|
||||
if (len1 != len2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user