# valgrind.memcheck: fix makeMem\*\(\) · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/4930094e622c043d9be459abbfc5a7b203a22aa2)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 4930094e622c043d9be459abbfc5a7b203a22aa2

Requested commit: 4930094e622c043d9be459abbfc5a7b203a22aa2

Commit: 4930094e622c043d9be459abbfc5a7b203a22aa2

Tree: 19e81fd0a9271a3f5d97ccb47740d8564ac898ff

Author: Frank Denis

Committer: Andrew Kelley

## Message

```
valgrind.memcheck: fix makeMem*()

The `makeMem*()` functions crashed under valgrind in Debug and
ReleaseSafe modes.

The reason being that `doMemCheckClientRequestExpr()` returns `0`
when not running under Valgrind, and `maxInt(usize)` when running
under Valgrind.

Thus, `@as(i1, @intCast(maxInt(usize)))` always fails and these
functions crashed before returning.

That being said, what these functions used to return was quite
unexpected: `0` on error and `-1` on success (=running under valgrind).
That doesn't match any Zig nor C conventions.

But that return value doesn't seem to be very useful. Either we are
running under Valgrind or we are not. There's no point in checking this
for every single call. Applications are likely to always discard it.

So, just return a `void` instead.

Also avoid function comments that start with `Similarly, ...` because
that doesn't refer to anything in the context of autodoc or in IDEs.

```

## Parents

- [0bdbd3e235daee64caf1f99e5b9d7b62f4c5c484](https://git.cafe/gitcafe/zig/commit/0bdbd3e235daee64caf1f99e5b9d7b62f4c5c484?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/4930094e622c043d9be459abbfc5a7b203a22aa2?format=markdown)
