[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master is broken due to latest changes to pk-mi-json

From: Jose E. Marchesi
Subject: Re: master is broken due to latest changes to pk-mi-json
Date: Fri, 26 Nov 2021 16:14:15 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> On Fri, Nov 26, 2021 at 05:35:46PM +0330, Mohammad-Reza Nabipoor wrote:
>> Unfortunately, we don't have access to members of `struct json_object`;
>> it's an opaque type.
>> I think we should implement the logic using user-visible API.
>> It's not that complicated.

I disagree.  JSON objects may be complex, containing other JSON objects,
and the comparison logic doesn't seem trivial to me at all.

> Or even better approach:
>   Convert JSON to string representation (using `json_object_to_json_string`)
>   and `strcmp` the string representation of objects.
> I think due to the fact that we just use `json_object_equal` in testsuite,
> it's totally fine to use this not-so-optimized approach.

This would be feasible, but may lead to spurious results depending on
how the conversion routine is implemented: there may not be a 1-1
relationship between the written representation and the JSON object.

I think the best alternative is to detect at configure time whether
json-c provides json_object_equal, defining HAVE_JSON_OBJECT_EQUAL
accordingly.  Then the testsuite can just skip() the tests requiring
that function.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]