summaryrefslogtreecommitdiff
path: root/ext/dl/lib/dl
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-29 14:54:24 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-29 14:54:24 +0000
commitd0ed5a93786881e2ddda99d0c83e4d1a216a3ca8 (patch)
treec4f124d0bc8024aaac1de1ffb7f324dc3e8160fe /ext/dl/lib/dl
parentb3ff7eb3efed3b3bf5f4cb7eeaf03b96108e13d9 (diff)
* ext/dl/test/test_base.rb: add libc search logic.
this patch is written by Takehiro Kubo. [ruby-core:20963] [Bug #932] * ext/dl/dl.h: Add ",..." as the last argument. this patch is written by Takehiro Kubo. Bug #633 [ruby-core:19289] * ext/dl/lib/dl/stack.rb: add add_padding() to calculate alignment. this patch is written by Takehiro Kubo. Bug #633 [ruby-core:19289] * ext/dl/test/test_func.rb: atof()'s return value is double. this patch is written by Takehiro Kubo. Bug #633 [ruby-core:19289] * ext/dl/test/test_import.rb: - atof()'s return value is double. - The types of qsort's second and third argument are size_t. - fprintf()'s return value is int. this patch is written by Takehiro Kubo. Bug #633 [ruby-core:19289] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl/lib/dl')
-rw-r--r--ext/dl/lib/dl/stack.rb18
1 files changed, 12 insertions, 6 deletions
diff --git a/ext/dl/lib/dl/stack.rb b/ext/dl/lib/dl/stack.rb
index 9daf089775..99a24bc1ba 100644
--- a/ext/dl/lib/dl/stack.rb
+++ b/ext/dl/lib/dl/stack.rb
@@ -121,20 +121,26 @@ end
@template = ""
addr = 0
types.each{|t|
- orig_addr = addr
- addr = align(orig_addr, ALIGN_MAP[t])
- d = addr - orig_addr
- if( d > 0 )
- @template << "x#{d}"
- end
+ addr = add_padding(addr, ALIGN_MAP[t])
@template << PACK_MAP[t]
addr += SIZE_MAP[t]
}
+ addr = add_padding(addr, ALIGN_MAP[SIZEOF_VOIDP])
if( addr % SIZEOF_VOIDP == 0 )
@size = addr / SIZEOF_VOIDP
else
@size = (addr / SIZEOF_VOIDP) + 1
end
end
+
+ def add_padding(addr, align)
+ orig_addr = addr
+ addr = align(orig_addr, align)
+ d = addr - orig_addr
+ if( d > 0 )
+ @template << "x#{d}"
+ end
+ addr
+ end
end
end