Replace null-byte terminated string literals with C-string literals (#32716)

* simple conversion from byte string to c-string

Signed-off-by: Bum Kim <bumcrystlbum@gmail.com>

* convert byte strings to c-strings to c_char ptr

Signed-off-by: Bum Kim <bumcrystlbum@gmail.com>

---------

Signed-off-by: Bum Kim <bumcrystlbum@gmail.com>
This commit is contained in:
Bumsoo Kim 2024-07-06 16:14:15 -04:00 committed by GitHub
parent 59d0f1fe1a
commit 141a594e23
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 29 additions and 29 deletions

View file

@ -69,7 +69,7 @@ impl NonCallbackInterfaceObjectClass {
) -> NonCallbackInterfaceObjectClass {
NonCallbackInterfaceObjectClass {
class: JSClass {
name: b"Function\0" as *const _ as *const libc::c_char,
name: c"Function".as_ptr(),
flags: 0,
cOps: &constructor_behavior.0,
spec: 0 as *const _,
@ -344,7 +344,7 @@ pub fn create_named_constructors(
assert!(JS_DefineProperty3(
*cx,
constructor.handle(),
b"prototype\0".as_ptr() as *const libc::c_char,
c"prototype".as_ptr(),
interface_prototype_object,
(JSPROP_PERMANENT | JSPROP_READONLY) as u32
));
@ -504,7 +504,7 @@ fn define_name(cx: SafeJSContext, obj: HandleObject, name: &[u8]) {
assert!(JS_DefineProperty4(
*cx,
obj,
b"name\0".as_ptr() as *const libc::c_char,
c"name".as_ptr(),
name.handle(),
JSPROP_READONLY as u32
));
@ -516,7 +516,7 @@ fn define_length(cx: SafeJSContext, obj: HandleObject, length: i32) {
assert!(JS_DefineProperty5(
*cx,
obj,
b"length\0".as_ptr() as *const libc::c_char,
c"length".as_ptr(),
length,
JSPROP_READONLY as u32
));
@ -666,7 +666,7 @@ pub fn get_desired_proto(
if !JS_GetProperty(
*cx,
original_new_target.handle().into(),
b"prototype\0".as_ptr() as *const libc::c_char,
c"prototype".as_ptr(),
proto_val.handle_mut().into(),
) {
return Err(());