diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-01-21 12:45:21 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-21 12:45:21 -0800 |
| commit | ac2930332104cf1d1f51edca922b502ef3bd3f89 (patch) | |
| tree | 06ffbc7c3921a3c6d14cb83fde246620b67075ae /lib/std/Build/Step | |
| parent | bf7ebfa67af78da3ad40869cc61aecb594f9fc74 (diff) | |
| parent | e72f1d5ae70b78046c27d0b7fc12ee4b69380b2a (diff) | |
| download | zig-ac2930332104cf1d1f51edca922b502ef3bd3f89.tar.gz zig-ac2930332104cf1d1f51edca922b502ef3bd3f89.zip | |
Merge pull request #18634 from MrDmitry/bug/ConfigHeader_cmake_neighbors
std.Build.Step.ConfigHeader (cmake): fix offset calculation for multiple substitutions on a single line
Diffstat (limited to 'lib/std/Build/Step')
| -rw-r--r-- | lib/std/Build/Step/ConfigHeader.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/std/Build/Step/ConfigHeader.zig b/lib/std/Build/Step/ConfigHeader.zig index 59b8f610a2..44d387f524 100644 --- a/lib/std/Build/Step/ConfigHeader.zig +++ b/lib/std/Build/Step/ConfigHeader.zig @@ -537,7 +537,7 @@ fn replace_variables( switch (value) { .boolean => |b| { const buf = try std.fmt.allocPrint(allocator, "{s}{}{s}", .{ beginline, @intFromBool(b), endline }); - last_index = start_index + 1; + last_index = prefix_index + 1; allocator.free(content_buf); content_buf = buf; @@ -546,14 +546,14 @@ fn replace_variables( const buf = try std.fmt.allocPrint(allocator, "{s}{}{s}", .{ beginline, i, endline }); const isNegative = i < 0; const digits = (if (0 < i) std.math.log10(@abs(i)) else 0) + 1; - last_index = start_index + @intFromBool(isNegative) + digits + 1; + last_index = prefix_index + @intFromBool(isNegative) + digits; allocator.free(content_buf); content_buf = buf; }, .string, .ident => |x| { const buf = try std.fmt.allocPrint(allocator, "{s}{s}{s}", .{ beginline, x, endline }); - last_index = start_index + x.len + 1; + last_index = prefix_index + x.len; allocator.free(content_buf); content_buf = buf; @@ -561,7 +561,7 @@ fn replace_variables( else => { const buf = try std.fmt.allocPrint(allocator, "{s}{s}", .{ beginline, endline }); - last_index = start_index + 1; + last_index = prefix_index; allocator.free(content_buf); content_buf = buf; |
