Re: [PATCH v2 13/44] ruby: bind setup_git_directory()
- From
Ramkumar Ramachandra <artagnon@gmail.com>
- Date
- Sep 29, 2013, 05:11 UTC
- Message-ID
- <CALkWK0kSWDiKHDNcFFXHMa__YZXpL=YAL_zejvTRu7bAqUc6Vw@mail.gmail.com>
- In-Reply-To
- <1380405849-13000-14-git-send-email-felipe.contreras@gmail.com>
Felipe Contreras wrote:
Show 14 quoted lines
> +static inline VALUE cstr_to_str(const char *str)
> +{
> + if (str == NULL)
> + return Qnil;
> + return rb_str_new2(str);
> +}
> +
> +static VALUE git_rb_setup_git_directory(VALUE self)
> +{
> + int nongit_ok;
> + const char *prefix;
> + prefix = setup_git_directory_gently(&nongit_ok);
> + return rb_ary_new3(2, cstr_to_str(prefix), INT2FIX(nongit_ok));
> +}Most excellent. Goes to show how well ruby.h is written.
I'm not very familiar with the interface, and am referring to http://www.ruby-doc.org/docs/ProgrammingRuby/html/ext_ruby.html -- let me know if there are some other sources.