authorgravatar for prokop@rdck.devProkop Randáček <prokop@rdck.dev> 2024-03-26 13:00:13+01:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-03-26 14:00:13+02:00
log055023efb474acb4a2ff05b28d66a72f3805e34a
treeb24c98a27d0a2c04c73539318d4bfe4d7bdf1538
parent59203cb4f2a924d5815cbb9cca54a10cabf74292
signaturebadge-check Signed by PGP key B5690EEEBB952194

valgrind client request wrappers take const pointers (#19237)

* valgrind client request wrappers take const pointers * require zero terminated strings in valgrind wrappers

2 files changed, 8 insertions(+), 8 deletions(-)

lib/std/valgrind/callgrind.zig+1-1
......@@ -27,7 +27,7 @@ pub fn dumpStats() void {
2727/// The argument is appended to a string stating the reason which triggered
2828/// the dump. This string is written as a description field into the
2929/// profile data dump.
30pub fn dumpStatsAt(pos_str: [*]u8) void {
30pub fn dumpStatsAt(pos_str: [*:0]const u8) void {
3131 doCallgrindClientRequestStmt(.DumpStatsAt, @intFromPtr(pos_str), 0, 0, 0, 0);
3232}
3333
lib/std/valgrind/memcheck.zig+7-7
......@@ -29,19 +29,19 @@ fn doMemCheckClientRequestStmt(request: MemCheckClientRequest, a1: usize, a2: us
2929}
3030
3131/// Mark memory at qzz.ptr as unaddressable for qzz.len bytes.
32pub fn makeMemNoAccess(qzz: []u8) void {
32pub fn makeMemNoAccess(qzz: []const u8) void {
3333 _ = doMemCheckClientRequestExpr(0, // default return
3434 .MakeMemNoAccess, @intFromPtr(qzz.ptr), qzz.len, 0, 0, 0);
3535}
3636
3737/// Mark memory at qzz.ptr as addressable but undefined for qzz.len bytes.
38pub fn makeMemUndefined(qzz: []u8) void {
38pub fn makeMemUndefined(qzz: []const u8) void {
3939 _ = doMemCheckClientRequestExpr(0, // default return
4040 .MakeMemUndefined, @intFromPtr(qzz.ptr), qzz.len, 0, 0, 0);
4141}
4242
4343/// Mark memory at qzz.ptr as addressable and defined or qzz.len bytes.
44pub fn makeMemDefined(qzz: []u8) void {
44pub fn makeMemDefined(qzz: []const u8) void {
4545 _ = doMemCheckClientRequestExpr(0, // default return
4646 .MakeMemDefined, @intFromPtr(qzz.ptr), qzz.len, 0, 0, 0);
4747}
......@@ -49,7 +49,7 @@ pub fn makeMemDefined(qzz: []u8) void {
4949/// Similar to makeMemDefined except that addressability is
5050/// not altered: bytes which are addressable are marked as defined,
5151/// but those which are not addressable are left unchanged.
52pub fn makeMemDefinedIfAddressable(qzz: []u8) void {
52pub fn makeMemDefinedIfAddressable(qzz: []const u8) void {
5353 _ = doMemCheckClientRequestExpr(0, // default return
5454 .MakeMemDefinedIfAddressable, @intFromPtr(qzz.ptr), qzz.len, 0, 0, 0);
5555}
......@@ -58,7 +58,7 @@ pub fn makeMemDefinedIfAddressable(qzz: []u8) void {
5858/// string which is included in any messages pertaining to addresses
5959/// within the specified memory range. Has no other effect on the
6060/// properties of the memory range.
61pub fn createBlock(qzz: []u8, desc: [*]u8) usize {
61pub fn createBlock(qzz: []const u8, desc: [*:0]const u8) usize {
6262 return doMemCheckClientRequestExpr(0, // default return
6363 .CreateBlock, @intFromPtr(qzz.ptr), qzz.len, @intFromPtr(desc), 0, 0);
6464}
......@@ -74,7 +74,7 @@ pub fn discard(blkindex: usize) bool {
7474/// If suitable addressability is not established, Valgrind prints an
7575/// error message and returns the address of the first offending byte.
7676/// Otherwise it returns zero.
77pub fn checkMemIsAddressable(qzz: []u8) usize {
77pub fn checkMemIsAddressable(qzz: []const u8) usize {
7878 return doMemCheckClientRequestExpr(0, .CheckMemIsAddressable, @intFromPtr(qzz.ptr), qzz.len, 0, 0, 0);
7979}
8080
......@@ -82,7 +82,7 @@ pub fn checkMemIsAddressable(qzz: []u8) usize {
8282/// qzz.len bytes. If suitable addressability and definedness are not
8383/// established, Valgrind prints an error message and returns the
8484/// address of the first offending byte. Otherwise it returns zero.
85pub fn checkMemIsDefined(qzz: []u8) usize {
85pub fn checkMemIsDefined(qzz: []const u8) usize {
8686 return doMemCheckClientRequestExpr(0, .CheckMemIsDefined, @intFromPtr(qzz.ptr), qzz.len, 0, 0, 0);
8787}
8888