search for: optargsv

Displaying 5 results from an estimated 5 matches for "optargsv".

Did you mean: optargs
2013 Dec 27
0
[PATCH] ruby: Fix .new method (RHBZ#1046509).
...ze method (see next + * function). */ static VALUE -ruby_guestfs_create (int argc, VALUE *argv, VALUE m) +ruby_guestfs_alloc (VALUE klass) { - guestfs_h *g; + guestfs_h *g = NULL; - if (argc > 1) - rb_raise (rb_eArgError, \"expecting 0 or 1 arguments\"); - - volatile VALUE optargsv = argc == 1 ? argv[0] : rb_hash_new (); - Check_Type (optargsv, T_HASH); + /* Wrap it, and make sure the close function is called when the + * handle goes away. + */ + return Data_Wrap_Struct (c_guestfs, NULL, ruby_guestfs_free, g); +} +static unsigned +parse_flags (int argc, VALUE *argv)...
2011 Jan 05
0
Fwd: Review of libguestfs ruby bindings
...in the ones that they are interested in. If you care to look, an example in the ruby-libvirt code is ext/libvirt/domain.c:libvirt_dom_memory_peek() 5) The way that hash lookups are done are a little complicated. For instance, ruby_guestfs_add_drive_opts() uses: VALUE v; v = rb_hash_lookup (optargsv, ID2SYM (rb_intern ("readonly"))); to get at the hash symbol. In ruby-libvirt I tend to do: v = rb_hash_aref(optsargv, rb_str_new2("readonly")); That being said, your way may actually be faster since you aren't allocating a new object. Minor in any case, they both work...
2013 Feb 04
1
[PATCH] generator: Add visibility to action struct
...String n -> pr " const char *%s = !NIL_P (%sv) ? StringValueCStr (%sv) : NULL;\n" n n n @@ -541,8 +540,8 @@ ruby_user_cancel (VALUE gv) (* Optional arguments are passed in a final hash parameter. *) if optargs <> [] then ( pr " Check_Type (optargsv, T_HASH);\n"; - pr " struct %s optargs_s = { .bitmask = 0 };\n" c_function; - pr " struct %s *optargs = &optargs_s;\n" c_function; + pr " struct %s optargs_s = { .bitmask = 0 };\n" f.c_function; + pr " struct %s *optargs =...
2012 Jan 09
1
[PATCH 1/2] generator: Rename java_structs to camel_structs to better reflect their purpose
This map was originally included just for the java bindings, but is generally useful to any binding which uses camel case by requirement or convention. --- generator/generator_haskell.ml | 4 ++-- generator/generator_java.ml | 10 +++++----- generator/generator_main.ml | 2 +- generator/generator_structs.ml | 12 +++++------- generator/generator_structs.mli | 8 ++++---- 5
2016 Dec 08
4
[PATCH] generator: Share Common_utils code.
...else args in @@ -295,7 +296,7 @@ and generate_ruby_c actions () = List.iter ( fun argt -> let n = name_of_optargt argt in - let uc_n = String.uppercase n in + let uc_n = String.uppercase_ascii n in pr " v = rb_hash_lookup (optargsv, ID2SYM (rb_intern (\"%s\")));\n" n; pr " if (v != Qnil) {\n"; (match argt with @@ -483,7 +484,7 @@ Init__guestfs (void) List.iter ( fun (name, bitmask) -> pr " rb_define_const (m_guestfs, \"EVENT_%s\",\n" -...