mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 970253 - cx param to JS_AllocateArrayBufferContents is optional, r=terrence
--HG-- extra : rebase_source : 23adbdf985c85d3879f49578840f3e038aba4527
This commit is contained in:
parent
5253bae27f
commit
9a76f872d0
@ -3165,15 +3165,17 @@ JS_StealArrayBufferContents(JSContext *cx, JS::HandleObject obj, void **contents
|
||||
|
||||
/*
|
||||
* Allocate memory that may be eventually passed to
|
||||
* JS_NewArrayBufferWithContents. |nbytes| is the number of payload bytes
|
||||
* required. The pointer to pass to JS_NewArrayBufferWithContents is returned
|
||||
* in |contents|. The pointer to the |nbytes| of usable memory is returned in
|
||||
* |data|. (*|contents| will contain a header before |data|.) The only legal
|
||||
* operations on *|contents| is to free it, or pass it to
|
||||
* JS_NewArrayBufferWithContents or JS_ReallocateArrayBufferContents.
|
||||
* JS_NewArrayBufferWithContents. |maybecx| is optional; if a non-nullptr cx is
|
||||
* given, it will be used for memory accounting and OOM reporting. |nbytes| is
|
||||
* the number of payload bytes required. The pointer to pass to
|
||||
* JS_NewArrayBufferWithContents is returned in |contents|. The pointer to the
|
||||
* |nbytes| of usable memory is returned in |data|. (*|contents| will contain a
|
||||
* header before |data|.) The only legal operations on *|contents| is to free
|
||||
* it, or pass it to JS_NewArrayBufferWithContents or
|
||||
* JS_ReallocateArrayBufferContents.
|
||||
*/
|
||||
extern JS_PUBLIC_API(bool)
|
||||
JS_AllocateArrayBufferContents(JSContext *cx, uint32_t nbytes, void **contents, uint8_t **data);
|
||||
JS_AllocateArrayBufferContents(JSContext *maybecx, uint32_t nbytes, void **contents, uint8_t **data);
|
||||
|
||||
/*
|
||||
* Reallocate memory allocated by JS_AllocateArrayBufferContents, growing or
|
||||
|
@ -4088,9 +4088,10 @@ JS_NewArrayBufferWithContents(JSContext *cx, void *contents)
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_AllocateArrayBufferContents(JSContext *cx, uint32_t nbytes, void **contents, uint8_t **data)
|
||||
JS_AllocateArrayBufferContents(JSContext *maybecx, uint32_t nbytes,
|
||||
void **contents, uint8_t **data)
|
||||
{
|
||||
js::ObjectElements *header = AllocateArrayBufferContents(cx, nbytes);
|
||||
js::ObjectElements *header = AllocateArrayBufferContents(maybecx, nbytes);
|
||||
if (!header)
|
||||
return false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user