Skip to content

Conversation

@choury
Copy link

@choury choury commented Jan 20, 2026

I am currently porting several functions to the eBPF architecture, which supports a maximum of only 5 arguments per function call. To meet this constraint, I have refactored the internal _PDCLIB_strtox_main function to reduce its parameter count from 6 to 5 by consolidating the overflow boundary arguments into a single limit parameter.

Copilot AI review requested due to automatic review settings January 20, 2026 03:05
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request refactors the internal _PDCLIB_strtox_main function to reduce its parameter count from 6 to 5 parameters to meet eBPF architecture constraints, which supports a maximum of 5 function arguments. The refactoring consolidates the overflow boundary parameters (limval and limdigit) into a single limit parameter, with the individual boundary values now computed inside the function.

Changes:

  • Function signature updated to accept a single limit parameter instead of separate limval and limdigit parameters
  • All callers updated to pass the limit value, with division and modulo operations moved from call sites into the function
  • Test cases updated to reflect the new parameter structure

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
include/pdclib/_PDCLIB_internal.h Updated function declaration to remove limval and limdigit parameters, replaced with single limit parameter
functions/_PDCLIB/_PDCLIB_strtox_main.c Modified implementation to compute limval and limdigit from limit parameter internally; updated test cases
functions/stdlib/strtoull.c Updated caller to pass ULLONG_MAX as limit instead of pre-computed division/modulo values
functions/stdlib/strtoul.c Updated caller to pass ULONG_MAX as limit instead of pre-computed division/modulo values
functions/stdlib/strtoll.c Updated callers for both positive and negative cases; negative case now uses LLONG_MAX + 1 as limit
functions/stdlib/strtol.c Updated callers for both positive and negative cases; negative case now uses LONG_MAX + 1 as limit
functions/inttypes/strtoumax.c Updated caller to pass UINTMAX_MAX as limit instead of pre-computed division/modulo values
functions/inttypes/strtoimax.c Updated callers for both positive and negative cases; negative case now uses INTMAX_MAX + 1 as limit

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

#ifndef REGTEST

_PDCLIB_uintmax_t _PDCLIB_strtox_main( const char ** p, unsigned int base, uintmax_t error, uintmax_t limval, int limdigit, char * sign )
_PDCLIB_uintmax_t _PDCLIB_strtox_main( const char ** p, unsigned int base, uintmax_t error, uintmax_t limit, char * sign )
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The file header comment at line 1 needs to be updated to reflect the new function signature. It currently shows the old signature with 5 parameters (limval and limdigit as separate int parameters), but the function now takes 4 parameters after the base plus the sign pointer, with limit replacing limval and limdigit.

Copilot uses AI. Check for mistakes.
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.

1 participant