Commit 38c8474
committed
Merge bitcoin#33914: Change Parse descriptor argument to string_view
c0bfe72 Change Parse descriptor argument to string_view (Sjors Provoost)
Pull request description:
While investigating a silent merge conflict in bitcoin#33135 I noticed that bitcoin#32983 changed the descriptor `Parse` function signature from `const std::string& descriptor` to `std::span<const char> descriptor`.
Calling that new version of `Parse` with a string literal will trigger a confusing "Invalid characters in payload" due to the trailing "\0".
It can be worked around by having (the test) wrap string literals in `std::string()`, but that's easy to forget.
Using `string_view` is easier and more compact than (as a previous version of this PR did) checking for trailing `\0`.
Also add a test.
ACKs for top commit:
maflcko:
review ACK c0bfe72 🍨
enirox001:
tACK c0bfe72
stickies-v:
ACK c0bfe72
rkrux:
crACK c0bfe72
Tree-SHA512: 6b20307f834dae66826c8763f6c2ba0071f4e369375184cb5ff8543b85220fcaf33a47ddb065e418d1af3ed9a3fac401a7854f8924f52aab2b000b1f65328f2cFile tree
3 files changed
+15
-5
lines changed- src
- script
- test
3 files changed
+15
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2743 | 2743 | | |
2744 | 2744 | | |
2745 | 2745 | | |
2746 | | - | |
| 2746 | + | |
2747 | 2747 | | |
2748 | | - | |
| 2748 | + | |
| 2749 | + | |
2749 | 2750 | | |
2750 | | - | |
2751 | | - | |
| 2751 | + | |
| 2752 | + | |
2752 | 2753 | | |
2753 | 2754 | | |
2754 | 2755 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | | - | |
| 178 | + | |
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1262 | 1262 | | |
1263 | 1263 | | |
1264 | 1264 | | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
1265 | 1274 | | |
0 commit comments