# fmt: Refactor parsing of placeholders into its own function · gitcafe/zig

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

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

Visibility: public

Requested revision: a41ad639a85218130f80956ce0c2e59ff322a1af

Requested commit: a41ad639a85218130f80956ce0c2e59ff322a1af

Commit: a41ad639a85218130f80956ce0c2e59ff322a1af

Tree: 7d1da86468fe9257e6c2ea1c7c752a418fce7f52

Author: Jimmi Holst Christensen

Committer: Andrew Kelley

## Message

```
fmt: Refactor parsing of placeholders into its own function

This saves on comptime format string parsing, as the compiler caches
comptime calls. The catch here, is that parsePlaceHolder cannot take the
placeholder string as a slice. It must take it as an array by value for
the caching to occure.

There is also some logic in here that ensures that the specifier_arg is
always them same slice when the items they contain are the same. This
makes the compiler stamp out less copies of formatType.

```

## Parents

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

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