Don't pass VALUEs to rb_raise().
[ruby-eet.git] / ext / ext.c
index 485bfc6062b9da6106912f5a98b612c5883b0e5e..1819958b73976137104e2b3f316ac024e0efaab0 100644 (file)
--- a/ext/ext.c
+++ b/ext/ext.c
@@ -1,5 +1,5 @@
 /*
- * $Id: ext.c 29 2005-04-12 17:07:48Z tilman $
+ * $Id: ext.c 30 2005-04-12 18:38:31Z tilman $
  *
  * Copyright (c) 2005 Tilman Sauerbeck (tilman at code-monkey de)
  *
@@ -99,13 +99,13 @@ c_init (int argc, VALUE *argv, VALUE self)
        VALUE file = Qnil, mode = Qnil;
        Eet_File **ef = NULL;
        Eet_File_Mode m = EET_FILE_MODE_READ;
-       const char *tmp;
+       const char *tmp, *cfile;
 
        Data_Get_Struct (self, Eet_File *, ef);
 
        rb_scan_args (argc, argv, "11", &file, &mode);
 
-       StringValue (file);
+       cfile = StringValuePtr (file);
 
        if (!NIL_P (mode)) {
                StringValue (mode);
@@ -121,7 +121,7 @@ c_init (int argc, VALUE *argv, VALUE self)
 
        eet_init ();
 
-       *ef = eet_open (StringValuePtr (file), m);
+       *ef = eet_open (cfile, m);
        if (!*ef) {
                switch (m) {
                        case EET_FILE_MODE_READ_WRITE:
@@ -133,7 +133,7 @@ c_init (int argc, VALUE *argv, VALUE self)
                                break;
                }
 
-               rb_raise (rb_eRuntimeError, tmp, file);
+               rb_raise (rb_eRuntimeError, tmp, cfile);
        }
 
        return self;