cbor_map_get and cbor_equal#96
cbor_map_get and cbor_equal#96babelouest wants to merge 11 commits intoPJK:masterfrom babelouest:cbor_map_get
Conversation
PJK
left a comment
There was a problem hiding this comment.
Hi @babelouest, thanks for the CL! I have added a few smaller comments to the code; the high level comment is that equality on deeply nested structures is very tricky and I while I'm definitely open to doing this, we will need to give it a lot of consideration.
The main question to start with is: Do you think equality should be structural (exact same shape, e.g. integers must have the same width and value) or semantic (e.g. integers can have different width as long as the value is the same)? What are the tradeoffs? (I haven't implemented equality to avoid having to answer these :))
| if (cbor_string_length(item1) != cbor_string_length(item2)) | ||
| return false; | ||
| else | ||
| return !memcmp(item1->data, item2->data, cbor_string_length(item1))?true:false; |
|
Hello @PJK , Thanks for your feedback, I know My real goal is to have In my opinion, a But you're the maintainer so it's your call. I will address your comments soon. |
|
@PJK , I've made some adjustments, and now Travis CI fails, I don't understand why. I may have missed a Do you have an idea? |
|
@PJK , any update? |
|
Thanks for changes and sorry about the delay, I'm somewhat overloaded these days. Looking at the Travis failure, I see This means that the code is not formatted according to clang-format's liking -- you can just run the script yourself and commit the changes, that should fix it. Also filed #104 to make this part better. |
|
If I run the Would there be some environment difference between travis-ci and my Ubuntu? |
|
Hmm, could be, that is unfortunate. I will try to take a look later this week |
|
After further investigation, it seems the problem comes from the following command in .travis-qemu.sh: git status | grep "nothing to commit, working tree clean"I just provided a PR to make some small improvements to the CI script: #105 |
Nailed it! :-) |
Add two functions in the library:
cbor_equal: compare two cbor items content and return true if type, metadata and data are the samecbor_map_get: return the value corresponding to the specified key in a CBOR map structure