Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve code clarity #731

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rettichschnidi
Copy link
Contributor

Changes implemented while trying to understand/reviewing PR #696. Details can be found in the commit messages.

All lwm2m_session_is_equal() does is comparing pointers. Its comment however
suggests that it does more/something slightly different. Also, the 3rd, unused
parameter is just cumbersome.

This commit simplifies all of this by removing the code in question.
I wish this was already stated explictly when I reviewed PR eclipse-wakaama#696.
@rettichschnidi rettichschnidi marked this pull request as draft November 13, 2023 09:10
@@ -298,7 +298,7 @@ bool transaction_handleResponse(lwm2m_context_t * contextP,

while (NULL != transacP)
{
if (lwm2m_session_is_equal(fromSessionH, transacP->peerH, contextP->userData) == true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand it, lwm2m_session_is_equal is a function that the users of Wakaama need to implement for their platform. The implementation in the examples does indeed only compare pointers. But that might not be the right thing to do in other cases.

// Compare two session handles
// Returns true if the two sessions identify the same peer. false otherwise.
// userData: parameter to lwm2m_init()
bool lwm2m_session_is_equal(void * session1, void * session2, void * userData);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above about lwm2m_session_is_equal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants