[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix a possibly problematic string comparison
From: |
Ihor Radchenko |
Subject: |
Re: [PATCH] Fix a possibly problematic string comparison |
Date: |
Tue, 29 Aug 2023 05:10:08 +0000 |
Rudolf Adamkovič <salutis@me.com> writes:
> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> This is not as trivial. Applying this patch will break tests.
>> One needs to carefully examine the org-table logic to fix this
>> particular warning.
>
> Wow! You are right. How is that even possible? In other words, what
> value (of 'elements') can possibly be object-equal to a literal "" but
> not string-equal to the same literal "" or vice versa?
This is not what is happening.
- (if (and (eq elements "") (not keep-empty))
(eq elements "") is always nil - the warning is right. We never enter
this branch of `if'.
+ (if (and (string-empty-p elements) (not keep-empty))
After the patch, we do enter this branch of `if', but it breaks tests.
So, it is not just an innocent warning - it reveals a fault in logic
elsewhere in the code.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>