Bug 15043

Summary: KJS::allocateBlock(): posix_memalign takes a void** as its first parameter
Product: WebKit Reporter: Ryan Leavengood <leavengood>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Minor    
Priority: P2    
Version: 523.x (Safari 3)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Fix to posix_memalign call in KJS::allocateBlock
none
The same patch, with the removal of the reinterpret_cast in the memset call mjs: review+

Description Ryan Leavengood 2007-08-21 17:33:04 PDT
This clearly is not code that any current port uses, since it should not compile without the change attached. But my port makes use of this since it was already in the code, instead of making another #elsif. But as shown by the documentation here:

http://www.opengroup.org/onlinepubs/000095399/functions/posix_memalign.html

the function is being called incorrectly. The simple patch attached corrects that.
Comment 1 Ryan Leavengood 2007-08-21 17:35:04 PDT
Created attachment 16066 [details]
Fix to posix_memalign call in KJS::allocateBlock
Comment 2 Darin Adler 2007-08-21 17:38:53 PDT
Comment on attachment 16066 [details]
Fix to posix_memalign call in KJS::allocateBlock

I also don't think the reinterpret_cast is needed on the next line.
Comment 3 Ryan Leavengood 2007-08-21 17:45:36 PDT
Would you like me to make that change and create another patch, or could you take care of it? :)
Comment 4 Ryan Leavengood 2007-08-21 18:28:52 PDT
Created attachment 16067 [details]
The same patch, with the removal of the reinterpret_cast in the memset call
Comment 5 David Kilzer (:ddkilzer) 2007-08-21 21:46:35 PDT
(In reply to comment #0)
> This clearly is not code that any current port uses, since it should not
> compile without the change attached. But my port makes use of this since it was
> already in the code, instead of making another #elsif. [...]

What port are you working on?  :)

Comment 6 Ryan Leavengood 2007-08-22 06:22:52 PDT
(In reply to comment #5)
> 
> What port are you working on?  :)

I am porting WebKit to Haiku, http://haiku-os.org. It is a clone of BeOS.
Comment 7 Maciej Stachowiak 2007-08-28 21:17:07 PDT
Comment on attachment 16067 [details]
The same patch, with the removal of the reinterpret_cast in the memset call

r=me

Probably other ports could use memalign too, but don't set the right ifdef so they get the generic mmap-based version.
Comment 8 Mark Rowe (bdash) 2007-08-29 10:41:53 PDT
Landed in r25296.