Skip to content

Support CStr #487

@conradludgate

Description

@conradludgate

I noticed that passing &str or String requires converting to a &[u8] where you then push a nul byte. It would be nice to support CStr as well to avoid this alloc.

Additionally, instead of doing

// args.1: String
let arg_1 = [(args.1.as_ref() as &str).as_bytes(), &[0_u8]].concat();

it would likely be better instead to do

let arg_1 = {
    let mut bytes = args.1.into_bytes();
    bytes.push(0);
    bytes
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions