Improve C function signatures for const-correctness and type safety#14
Merged
micheloosterhof merged 2 commits intomainfrom Feb 11, 2026
Merged
Conversation
- Add const to pointer parameters not modified by callee: bistream_data_add, ihandler_new, node_info_set_addr, tempfile_new, tempdownload_new, and all processor_io function signatures - Return const char* from node_info_get_ip_string/node_info_get_port_string to prevent callers from modifying internal buffers - Accept const struct node_info* in getter functions that don't mutate state - Change IPv6 address check functions (ipv6_addr_linklocal, ipv6_addr_v4mapped, ipv6_addr_any, ipv6_addr_loopback) from int to bool return type - Fix bistream_new() definition to use (void) parameter list matching its header declaration - Update processor_io typedef and all implementing functions to use const void *data since I/O processors read but don't modify the data - Update Cython binding declarations in binding.pyx to match the new C signatures https://claude.ai/code/session_016apEwLpwZvcWbQBmcLiosm
…(pass 2) - recvfromto(): Remove incorrect const from fromaddr/toaddr output parameters that are written to by recvmsg() and memcpy() - sendtofrom(): Add const to buf, to, and from parameters (read-only inputs) - add_ext() in ssl.c: Change value parameter to const char* (passed to OpenSSL which accepts const char*) - pchild_sent_bind(): Add const to sockaddr parameter (only read via memcpy) - pchild_new(): Fix empty parameter list () to (void) for proper C prototype https://claude.ai/code/session_016apEwLpwZvcWbQBmcLiosm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ihandler_new, node_info_set_addr, tempfile_new, tempdownload_new, and all
processor_io function signatures
to prevent callers from modifying internal buffers
ipv6_addr_any, ipv6_addr_loopback) from int to bool return type
header declaration
const void *data since I/O processors read but don't modify the data
signatures