summaryrefslogtreecommitdiff
path: root/ext/dl/sample
diff options
context:
space:
mode:
authorttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-06-10 18:23:39 +0000
committerttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-06-10 18:23:39 +0000
commitceade7b9268e9620b123843afeb25a7136f8a576 (patch)
tree5934090e772e41a4b3f75a7744a031f4576d60b1 /ext/dl/sample
parent5c1bdda10cc0febcac126532cf6f3aac51c08271 (diff)
bugfix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl/sample')
-rw-r--r--ext/dl/sample/libc.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/dl/sample/libc.rb b/ext/dl/sample/libc.rb
index 9975828be3..32816fd331 100644
--- a/ext/dl/sample/libc.rb
+++ b/ext/dl/sample/libc.rb
@@ -35,6 +35,11 @@ module LIBC
"int tz_minuteswest",
"int tz_dsttime",
]
+
+ def my_compare(ptr1, ptr2)
+ ptr1.ptr.to_s <=> ptr2.ptr.to_s
+ end
+ COMPARE = callback "int my_compare(char**, char**)"
end
@@ -54,7 +59,7 @@ p LIBC.strcat("a", "b")
ary = ["a","c","b"]
ptr = ary.to_ptr
-LIBC.qsort(ptr, ary.length, DL.sizeof('P'), $cb1)
+LIBC.qsort(ptr, ary.length, DL.sizeof('P'), LIBC::COMPARE)
p ptr.to_a('S', ary.length)
tv = LIBC::Timeval.malloc