[PATCH] dive.c:merge_text(): Slighly better string merge logic

Lubomir I. Ivanov neolit123 at gmail.com
Fri Mar 8 10:01:03 PST 2013


On 8 March 2013 19:46, Dirk Hohndel <dirk at hohndel.org> wrote:
> "Lubomir I. Ivanov" <neolit123 at gmail.com> writes:
>
>> On 8 March 2013 18:55, Dirk Hohndel <dirk at hohndel.org> wrote:
>>> I don't agree with this patch.
>>>
>>> Imagine that a="" and b="Great dive location"
>>> The existing code returns a copy of "Great dive location" while your
>>> code returns "() or (Great dive locations)".
>>> That is not an improvement.
>>>
>>
>> yeah, it has to be improved further.
>>
>>> Can you explain in more detail what you are trying to fix?
>>>
>>
>> the backtrace of #90, showed:
>> (a=0x348d770 "", b=0x0) at dive.c:911
>>
>> where 'a' is "", but 'b' is NULL, so it passes NULL to strdup().
>
> So test for that :-)
>
> I can fix this myself if you prefer.
>

i'll have to go AFK in a bit, so if you think this should be fixed
right now, please go ahead.
not sure on a wider perspective, if 'a' is "" and 'b' is NULL, that we
could just return NULL, instead of doing a strdup("").

lubomir
--


More information about the subsurface mailing list