Commit aa7d4d2
authored
make_qualified_base_name: qbn string view (#419)
* make_qualified_base_name: use std::string_view
The function takes const std::string& but its callers in util.cc:1289,
1332, 1420 pass `(const std::string ext_name, const char *)` — the
const char* is silently wrapped in a temporary std::string. Switching
to std::string_view lets all current callers pass through unchanged
(std::string and const char* both convert implicitly) while removing
those hidden allocations.
Closes #416. Surfaced in #257 review thread; #408 deferred this.
* make_qualified_base_name: reserve+append, no temporaries
Per maintainer review: the std::string_view conversion in PR #419 left
the body constructing two std::string temporaries plus operator+
intermediates — 2-4 allocations to do what should be 0-1. Switch to
reserve + append/push_back for a single allocation when the result
exceeds SSO.1 parent 3b8b394 commit aa7d4d2
1 file changed
Lines changed: 8 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | | - | |
57 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
| |||
0 commit comments