projects
/
ruby-eet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use StringValue() instead of Check_Type(blah, T_STRING).
[ruby-eet.git]
/
ext
/
ext.c
diff --git
a/ext/ext.c
b/ext/ext.c
index 236df7c0450359299852bdd27fa93ebdc6685221..94df85d4e8ff2d601c580ca91531228201331326 100644
(file)
--- a/
ext/ext.c
+++ b/
ext/ext.c
@@
-1,5
+1,5
@@
/*
/*
- * $Id: ext.c
13 2005-03-27 18:35:51
Z tilman $
+ * $Id: ext.c
28 2005-04-11 20:58:23
Z tilman $
*
* Copyright (c) 2005 Tilman Sauerbeck (tilman at code-monkey de)
*
*
* Copyright (c) 2005 Tilman Sauerbeck (tilman at code-monkey de)
*
@@
-27,9
+27,10
@@
#include <ruby.h>
#define CHECK_KEY(key) \
#include <ruby.h>
#define CHECK_KEY(key) \
- Check_Type ((key), T_STRING); \
- if (rb_funcall ((key), rb_intern ("include?"), \
- 1, INT2FIX (0)) == Qtrue) \
+ StringValue((key)); \
+\
+ if (rb_funcall (key, rb_intern ("include?"), \
+ 1, INT2FIX (0)) == Qtrue) \
rb_raise (rb_eArgError, "key must not contain binary zeroes");
static VALUE c_close (VALUE self);
rb_raise (rb_eArgError, "key must not contain binary zeroes");
static VALUE c_close (VALUE self);
@@
-100,10
+101,10
@@
c_init (int argc, VALUE *argv, VALUE self)
rb_scan_args (argc, argv, "11", &file, &mode);
rb_scan_args (argc, argv, "11", &file, &mode);
-
Check_Type (file, T_STRING
);
+
StringValue (file
);
if (!NIL_P (mode)) {
if (!NIL_P (mode)) {
-
Check_Type (mode, T_STRING
);
+
StringValue (mode
);
tmp = StringValuePtr (mode);
if (!strcmp (tmp, "r+"))
tmp = StringValuePtr (mode);
if (!strcmp (tmp, "r+"))
@@
-194,10
+195,8
@@
c_list (int argc, VALUE *argv, VALUE self)
rb_scan_args (argc, argv, "01", &glob);
rb_scan_args (argc, argv, "01", &glob);
- if (!NIL_P (glob)) {
- Check_Type (glob, T_STRING);
+ if (!NIL_P (glob))
tmp = StringValuePtr (glob);
tmp = StringValuePtr (glob);
- }
ret = rb_ary_new ();
ret = rb_ary_new ();
@@
-302,7
+301,7
@@
c_write (int argc, VALUE *argv, VALUE self)
comp = Qtrue;
CHECK_KEY (key);
comp = Qtrue;
CHECK_KEY (key);
-
Check_Type (buf, T_STRING
);
+
StringValue (buf
);
n = eet_write (*ef, StringValuePtr (key),
StringValuePtr (buf), RSTRING (buf)->len,
n = eet_write (*ef, StringValuePtr (key),
StringValuePtr (buf), RSTRING (buf)->len,
@@
-395,7
+394,7
@@
c_write_image (int argc, VALUE *argv, VALUE self)
has_alpha = Qfalse;
CHECK_KEY (key);
has_alpha = Qfalse;
CHECK_KEY (key);
-
Check_Type (buf, T_STRING
);
+
StringValue (buf
);
Check_Type (w, T_FIXNUM);
Check_Type (h, T_FIXNUM);
Check_Type (w, T_FIXNUM);
Check_Type (h, T_FIXNUM);