Files
RedBear-OS/recipes/libs/nghttp2/source/third-party/mruby/src/readint.c
T
vasilito ff4ff35918 feat: track all source trees in git — full fork offline-first model
Red Bear OS is a full fork. All sources must be available from git clone
with zero network access. Removed gitignore rules that excluded fetched
source trees under recipes/*/source/, local/recipes/kde/*/source/,
local/recipes/qt/*/source/, and vendor source trees.

Build artifacts (target/, build/, source.tar, *.o, *.so) remain excluded.

127291 files added — kernel, relibc, base, bootloader, pkgar, all KDE/Qt
frameworks, mesa, wayland, DRM drivers, and every other recipe source.
2026-05-14 10:55:53 +01:00

29 lines
861 B
C

#include <mruby.h>
#include <mruby/numeric.h>
/* mrb_read_int(): read mrb_int from a string (base 10 only) */
/* const char *p - string to read */
/* const char *e - end of string */
/* char **endp - end of parsed integer */
/* mrb_int *np - variable to save the result */
/* returns TRUE if read succeeded */
/* if integer overflows, returns FALSE */
MRB_API mrb_bool
mrb_read_int(const char *p, const char *e, char **endp, mrb_int *np)
{
mrb_int n = 0;
int ch;
while ((e == NULL || p < e) && ISDIGIT(*p)) {
ch = *p - '0';
if (mrb_int_mul_overflow(n, 10, &n) ||
mrb_int_add_overflow(n, ch, &n)) {
return FALSE;
}
p++;
}
if (endp) *endp = (char*)p;
*np = n;
return TRUE;
}