Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mrdb: add and use mrb_debug_{str,strn}dup() #2659

Merged
merged 2 commits into from Jul 6, 2021

Conversation

cremno
Copy link
Contributor

@cremno cremno commented Dec 1, 2014

(cc: @mimaki)

I think it's a good idea to add and use these functions, because they're easier and safer (see #2652) to use than the previous (varying) combination of functions calls (mrb_malloc()+strlen()+strncpy() or strcpy()). They also simplify reading and maintaining the code a bit.

I'm unsure about the two new files, but I was also unsure about adding the functions to libmruby itself (src/gc.c).

They behave similar to their POSIX equivalents, except
mrb_malloc_simple() is used for memory allocation and
errno might not be set since ISO C99 doesn't have ENOMEM.
As they are safer to use than mrb_malloc()+strlen()+strncpy() (see mruby#2652).
@cremno cremno requested a review from matz as a code owner May 13, 2021 07:07
@matz matz merged commit 7c362ee into mruby:master Jul 6, 2021
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.

None yet

2 participants