Skip to content

Minor style changes to the code#439

Open
freddy77 wants to merge 7 commits intoxapi-project:masterfrom
freddy77:styles
Open

Minor style changes to the code#439
freddy77 wants to merge 7 commits intoxapi-project:masterfrom
freddy77:styles

Conversation

@freddy77
Copy link
Contributor

@freddy77 freddy77 commented Feb 27, 2026

Summary

  • Fix file guards spellings
  • Update definitions to use ANSI style
  • Check all required headers are present during configuration
  • Avoid crash calling safe_strncpy with zero size
  • Ignore warnings calling strncpy
  • Remove unused return value from safe_strncpy
  • Fix typo in comment

Mostly detected by a more recent compiler.

Frediano Ziglio added 7 commits February 27, 2026 13:45
Make sure file guards macros are consistent.

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Some compiler nowadays complain about the old K&R syntax.

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Avoid surprises later, during the build phase.

The additional includes checking cmocka.h are needed as
cmocka.h file is not self-sufficient.

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
The call to strncpy would crash as "n - 1" would be cause filling
unwanted memory with zero bytes.
There was already the check to avoid underflowing the
buffer for terminator, but not for the string.

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Avoid warnings/errors like:

   error: 'strncpy' output may be truncated copying 254 bytes
   from a string of length 255 [-Werror=stringop-truncation]

The function is already doing the correct checks to avoid
that condition.

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Never used.

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
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.

2 participants