Skip to content

Instantly share code, notes, and snippets.

Created March 30, 2018 01:49
What would you like to do?
unsigned long ruby_strtoul(const char *str, char **endptr, int base);
#define STRTOUL(str, endptr, base) (ruby_strtoul((str), (endptr), (base)))
// ....
static VALUE
pack_pack(int argc, VALUE *argv, VALUE ary)
// ...
long len, idx, plen;
// ....
else if (ISDIGIT(*p)) {
errno = 0;
len = STRTOUL(p, (char**)&p, 10);
if (errno) {
rb_raise(rb_eRangeError, "pack length too big");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment