feat: max_depth - #8
Conversation
| return 0; | ||
| } | ||
|
|
||
| if(!enif_get_uint(env, tuple[1], &depth)) { |
There was a problem hiding this comment.
Since depth is int should we do enif_get_int and just additionally check depth > 0?
There was a problem hiding this comment.
I guess enif_get_uint already do that
https://erlang.org/documentation/doc-6.1/erts-6.1/doc/html/erl_nif.html#enif_get_uint
Set *ip to the unsigned integer value of term and return true, or return false if term is not an unsigned integer or is outside the bounds of type unsigned int
There was a problem hiding this comment.
In theory, the problem is with the number being outside the signed integer bounds but still inside the unsigned integer bounds. Another fix may be to explicitly assert depth does not exceed INT_MAX. What do you think? In practice, we should not expect such a large depth off course, so it is a nitpick
| return 0; | ||
| } | ||
|
|
||
| *max_depth = (int) depth; |
There was a problem hiding this comment.
issue with unsigned vs. signed likely surface here. Worth a check about size of depth, or redefining depth as a signed integer
No description provided.