Remove unnecessary char* cast in memset call in examples/examples_common.h and also in include/libssh/priv.h

This merge request removes an unnecessary char* cast in the ZERO_STRUCT macro's memset call. In C, pointers are implicitly convertible to void*, and memset expects a void* as its first input, making the explicit cast redundant. This change simplifies the code and improves readability.

Changes:

  • Modified ZERO_STRUCT macro from memset((char *)&(x), 0, sizeof(x)) to memset(&(x), 0, sizeof(x)).
  • No functional impact; the cast was unnecessary as per C standard's implicit pointer conversion rules.

I have built the project after modifying the code, and ran make test, and all those tests passed. I am not sure how else I should test this change, and I would appreciate any hints you might spare. I am also a bit unfamiliar with this template, but I tried to check things off when applicable.


UPDATE: I had to make the same change in include/libssh/priv.h(hence another commit), because pipeline was failing due to inconsistent definitions.

Checklist

  • Commits have Signed-off-by: with name/author being identical to the commit author
  • Code modified for feature
  • Test suite updated with functionality tests
  • Test suite updated with negative tests
  • Documentation updated

Reviewer's checklist:

  • Any issues marked for closing are addressed
  • There is a test suite reasonably covering new functionality or modifications
  • Function naming, parameters, return values, types, etc., are consistent and according to CONTRIBUTING.md
  • This feature/change has adequate documentation added
  • No obvious mistakes in the code
Edited by navid fayezi

Merge request reports

Loading