# getenv: remove unnessary \`small key\` block · gitcafe/zig

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

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

Visibility: public

Requested revision: 11695745e5c6cbd158625d2c1682a09e2ee4c679

Requested commit: 11695745e5c6cbd158625d2c1682a09e2ee4c679

Commit: 11695745e5c6cbd158625d2c1682a09e2ee4c679

Tree: 71df103adf7fedece1ec2401c616682e72fd5e16

Author: Mathew R Gordon

Committer: Isaac Freund

## Message

```
getenv: remove unnessary `small key` block

The code removed does unnecessary copying in order to create a null-terminated pointer, just to pass it to libc getenv. It only does this for `small keys`, which are under 64 bytes in size.

Instead of going out of the way to add a null byte to a function that takes normal slices, this should just be handled by the loop below, which scans c.environ to find the value
```

## Parents

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

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