Displaying 17 results from an estimated 17 matches for "stringvaluecstr".
2011 Jan 05
0
Fwd: Review of libguestfs ruby bindings
...w2("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.
6) In ruby_guestfs_download() and elsewhere, there is code like:
Check_Type (remotefilenamev, T_STRING);
const char *remotefilename = StringValueCStr (remotefilenamev);
if (!remotefilename)
rb_raise (rb_eTypeError, "expected string for parameter %s of %s",
"remotefilename", "download");
First, the Check_Type isn't strictly necessary; StringValueCStr will check if
this is a T_STRING, and if n...
2011 Dec 07
1
[PATCH] hivex: Fix Ruby bindings for 1.9; let the user explicitly choose ruby, rake
...fndef RSTRING_PTR
+#define RSTRING_PTR(r) (RSTRING((r))->ptr)
+#endif
+
static VALUE m_hivex; /* hivex module */
static VALUE c_hivex; /* hive_h handle */
static VALUE e_Error; /* used for all errors */
@@ -3287,8 +3295,8 @@ get_value (VALUE valv, hive_set_value *val)
val->key = StringValueCStr (key);
val->t = NUM2ULL (type);
- val->len = RSTRING (value)->len;
- val->value = RSTRING (value)->ptr;
+ val->len = RSTRING_LEN (value);
+ val->value = RSTRING_PTR (value);
}
static hive_set_value *
diff --git a/ruby/Makefile.am b/ruby/Makefile.am
index b323d7e..efc...
2011 Aug 25
4
[PATCH 0/3] ruby: Fix event handler failure
I won't pretend I really understand what's going on here. I've CC'd
this message to Chris since he might have a better idea.
https://bugzilla.redhat.com/show_bug.cgi?id=733297
In this bug, it appears that the event log callback goes out of scope
and is garbage collected. (This is despite the fact we registered it
as a global root). When we invoke the callback later,
2016 Jun 07
3
[PATCH 1/2] ruby: Print exceptions thrown by event callbacks.
...\n\");
+ volatile VALUE message;
- /* XXX We could print the exception, but it's very difficult from
- * a Ruby extension.
- */
+ message = rb_funcall (exn, rb_intern (\"to_s\"), 0);
+ fprintf (stderr, \"libguestfs: exception in callback: %%s\\n\",
+ StringValueCStr (message));
return Qnil;
}
--
2.7.4
2012 Aug 14
7
[PATCH 0/7] Add tar compress, numericowner, excludes flags.
https://bugzilla.redhat.com/show_bug.cgi?id=847880
https://bugzilla.redhat.com/show_bug.cgi?id=847881
This patch series adds various optional arguments to the tar-in and
tar-out commands.
Firstly (1/7) an optional "compress" flag is added to select
compression. This makes the calls tgz-in/tgz-out/txz-in/txz-out
deprecated, and expands the range of compression types available.
2014 Feb 10
5
[PATCH 0/4] add GUID validation (RHBZ#1008417)
Hi,
this patch serie adds a new GUID type in the generator, which would do
the same as String, but also validating (just in the C output) the
passed GUID string.
This allows to reject invalid GUIDs before passing them to low-level
tools.
Pino Toscano (4):
utils: add a function to validate a GUID string
generator: add a GUID parameter type
generator: generate code for parameter validation
2015 Oct 20
3
[PATCH 1/2] generator: add a RelativePathnameList parameter type
...b187b0..5e22ed0 100644
--- a/generator/ruby.ml
+++ b/generator/ruby.ml
@@ -582,7 +582,7 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
pr " size_t %s_size = RSTRING_LEN (%sv);\n" n n
| OptString n ->
pr " const char *%s = !NIL_P (%sv) ? StringValueCStr (%sv) : NULL;\n" n n n
- | StringList n | DeviceList n ->
+ | StringList n | DeviceList n | RelativePathnameList n ->
pr " char **%s;\n" n;
pr " Check_Type (%sv, T_ARRAY);\n" n;
pr " {\n";
@@ -677,7 +677,7 @@...
2015 Oct 21
2
[PATCH 1/2] generator: add a FilenameList parameter type
...b187b0..e2761c7 100644
--- a/generator/ruby.ml
+++ b/generator/ruby.ml
@@ -582,7 +582,7 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
pr " size_t %s_size = RSTRING_LEN (%sv);\n" n n
| OptString n ->
pr " const char *%s = !NIL_P (%sv) ? StringValueCStr (%sv) : NULL;\n" n n n
- | StringList n | DeviceList n ->
+ | StringList n | DeviceList n | FilenameList n ->
pr " char **%s;\n" n;
pr " Check_Type (%sv, T_ARRAY);\n" n;
pr " {\n";
@@ -677,7 +677,7 @@ get_all...
2013 Feb 04
1
[PATCH] generator: Add visibility to action struct
...\"%s\", \"%s\");\n" n name;
+ pr " \"%s\", \"%s\");\n" n f.name;
pr " size_t %s_size = RSTRING_LEN (%sv);\n" n n
| OptString 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...
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
2013 Jan 24
3
[REVIEW ONLY] Mountable patches
These 3 patches implement support for APIs which must accept a mountable, but
don't update apis which must return mountables.
Matt
2009 Aug 17
13
total warning-removal for daemon/
The warnings in daemon were aggravating and risky
for development (too easy to miss new ones) so I spent some
time last week and today working on removing them.
The first patch gets us down to almost no warnings with
the original -Wall setting. That was by far the hardest part.
Once I'd done that, I enabled nearly all of gcc's warnings via
gnulib's warnings and manywarnings modules
2009 Aug 03
1
[PATCH 1/2] Convert all TABs-as-indentation to spaces.
..._eArgError, \"%%s: used handle after closing it\", \"%s\");\n"
- name;
+ name;
pr "\n";
List.iter (
- function
- | String n | FileIn n | FileOut n ->
- pr " Check_Type (%sv, T_STRING);\n" n;
- pr " const char *%s = StringValueCStr (%sv);\n" n n;
- pr " if (!%s)\n" n;
- pr " rb_raise (rb_eTypeError, \"expected string for parameter %%s of %%s\",\n";
- pr " \"%s\", \"%s\");\n" n name
- | OptString n ->
- pr " const char *%...
2013 Feb 07
12
[PATCH 01/12] generator: Add new Mountable argument type
...,7 @@ ruby_user_cancel (VALUE gv)
List.iter (
function
- | Pathname n | Device n | Dev_or_Path n | String n | Key n
+ | Pathname n | Device n | Mountable n | Dev_or_Path n | String n | Key n
| FileIn n | FileOut n ->
pr " const char *%s = StringValueCStr (%sv);\n" n n;
| BufferIn n ->
@@ -607,7 +607,7 @@ ruby_user_cancel (VALUE gv)
List.iter (
function
- | Pathname _ | Device _ | Dev_or_Path _ | String _ | Key _
+ | Pathname _ | Device _ | Mountable _ | Dev_or_Path _ | String _ | Key _
| Fil...
2009 Aug 12
23
[PATCH 0/23] factor and const-correctness
This started as a simple warning-elimination change.
I'll get back to that series shortly ;-)
It turned into a factorization and constification exercise
during which I got a taste of ocaml. Thanks to Rich Jones
for help with a few snippets in generator.ml.
The overall result is that many previously-manually-maintained
bits from daemon/*.c functions are now hoisted into the automatically-
2017 Apr 21
0
[PATCH 1/2] generator: Simplify the handling of string parameters.
...d generate_ruby_c actions () =
List.iter (
function
- | Pathname n | Device n | Mountable n
- | Dev_or_Path n | Mountable_or_Path n | String n | Key n
- | FileIn n | FileOut n | GUID n ->
+ | String (_, n) ->
pr " const char *%s = StringValueCStr (%sv);\n" n n;
| BufferIn n ->
pr " Check_Type (%sv, T_STRING);\n" n;
@@ -264,7 +262,7 @@ and generate_ruby_c actions () =
pr " size_t %s_size = RSTRING_LEN (%sv);\n" n n
| OptString n ->
pr " const char *%s =...
2017 Apr 21
4
[PATCH 0/2] generator: Simplify the handling of string parameters.
Very large but mechanical change to the generator.
Rich.