[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH 2/3] ruby: Remove unnecessary checking around StringValueCStr



-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top
>From c50ed37b71a50b2570a3b16a82a9d73e026be739 Mon Sep 17 00:00:00 2001
From: Richard W.M. Jones <rjones redhat com>
Date: Tue, 15 Mar 2011 14:52:03 +0000
Subject: [PATCH 2/3] ruby: Remove unnecessary checking around StringValueCStr (RHBZ#667610).

---
 generator/generator_ruby.ml |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/generator/generator_ruby.ml b/generator/generator_ruby.ml
index a2a112a..8be9369 100644
--- a/generator/generator_ruby.ml
+++ b/generator/generator_ruby.ml
@@ -351,11 +351,7 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
         function
         | Pathname n | Device n | Dev_or_Path n | String n | Key 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
         | BufferIn n ->
             pr "  Check_Type (%sv, T_STRING);\n" n;
             pr "  const char *%s = RSTRING (%sv)->ptr;\n" n n;
@@ -411,7 +407,6 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
              | Int64 n ->
                  pr "    optargs_s.%s = NUM2LL (v);\n" n;
              | String _ ->
-                 pr "    Check_Type (v, T_STRING);\n";
                  pr "    optargs_s.%s = StringValueCStr (v);\n" n
              | _ -> assert false
             );
-- 
1.7.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]