Closed Bug 518463 Opened 10 years ago Closed 10 years ago

JS_GetStringBytes/Chars replacements

Categories

(Core :: JavaScript Engine, defect)

Other Branch
defect
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: jorendorff, Assigned: jorendorff)

References

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

Just in case any JSAPI clients are interested in correct behavior (or at least not-randomly-weird behavior) on OOM. ctypes for instance.

The proposed APIs are:

// Always returns a null-terminated string on success. Reports OOM and
// returns NULL on failure.
const jschar *
JS_GetStringCharsZ(JSContext *cx, JSString *str);

// Same.
const char *
JS_GetStringBytesZ(JSContext *cx, JSString *str);

Trivial to implement.
Attached patch v1Splinter Review
Assignee: general → jorendorff
Attachment #402916 - Flags: review?(brendan)
Attachment #402916 - Flags: review?(brendan) → review+
Comment on attachment 402916 [details] [diff] [review]
v1

The right thing. Thanks,

/be
Blocks: 519233
http://hg.mozilla.org/tracemonkey/rev/df46957a46f1
Whiteboard: fixed-in-tracemonkey
http://hg.mozilla.org/mozilla-central/rev/df46957a46f1
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.