mirror of
https://codeberg.org/ziglings/exercises.git
synced 2025-09-20 14:45:36 +00:00
Fixed changes in array list
This commit is contained in:
parent
82d8f06ffa
commit
aeacadb76b
|
@ -88,6 +88,7 @@ that if you update one, you may need to also update the other.
|
||||||
### Version Changes
|
### Version Changes
|
||||||
|
|
||||||
Version-0.15.0-dev.1380
|
Version-0.15.0-dev.1380
|
||||||
|
* *2025-08-08* zig 0.15.0-dev.1519 - changes in array listr, see [#24801](https://github.com/ziglang/zig/pull/24801)
|
||||||
* *2025-08-08* zig 0.15.0-dev.1380 - changes in build system, see [#24588](https://github.com/ziglang/zig/pull/24588)
|
* *2025-08-08* zig 0.15.0-dev.1380 - changes in build system, see [#24588](https://github.com/ziglang/zig/pull/24588)
|
||||||
* *2025-07-22* zig 0.15.0-dev.1092 - various changes due to new I/O API, see [#24488](https://github.com/ziglang/zig/pull/24488)
|
* *2025-07-22* zig 0.15.0-dev.1092 - various changes due to new I/O API, see [#24488](https://github.com/ziglang/zig/pull/24488)
|
||||||
* *2024-09-16* zig 0.14.0-dev.1573 - introduction of labeled switch, see [#21257](https://github.com/ziglang/zig/pull/21257)
|
* *2024-09-16* zig 0.14.0-dev.1573 - introduction of labeled switch, see [#21257](https://github.com/ziglang/zig/pull/21257)
|
||||||
|
|
12
build.zig
12
build.zig
|
@ -15,7 +15,7 @@ const print = std.debug.print;
|
||||||
// 1) Getting Started
|
// 1) Getting Started
|
||||||
// 2) Version Changes
|
// 2) Version Changes
|
||||||
comptime {
|
comptime {
|
||||||
const required_zig = "0.15.0-dev.1380";
|
const required_zig = "0.15.0-dev.1519";
|
||||||
const current_zig = builtin.zig_version;
|
const current_zig = builtin.zig_version;
|
||||||
const min_zig = std.SemanticVersion.parse(required_zig) catch unreachable;
|
const min_zig = std.SemanticVersion.parse(required_zig) catch unreachable;
|
||||||
if (current_zig.order(min_zig) == .lt) {
|
if (current_zig.order(min_zig) == .lt) {
|
||||||
|
@ -492,7 +492,7 @@ const ZiglingStep = struct {
|
||||||
const path = join(b.allocator, &.{ self.work_path, exercise_path }) catch
|
const path = join(b.allocator, &.{ self.work_path, exercise_path }) catch
|
||||||
@panic("OOM");
|
@panic("OOM");
|
||||||
|
|
||||||
var zig_args = std.ArrayList([]const u8).init(b.allocator);
|
var zig_args = std.array_list.Managed([]const u8).init(b.allocator);
|
||||||
defer zig_args.deinit();
|
defer zig_args.deinit();
|
||||||
|
|
||||||
zig_args.append(b.graph.zig_exe) catch @panic("OOM");
|
zig_args.append(b.graph.zig_exe) catch @panic("OOM");
|
||||||
|
@ -581,17 +581,17 @@ fn resetLine() void {
|
||||||
/// Removes trailing whitespace for each line in buf, also ensuring that there
|
/// Removes trailing whitespace for each line in buf, also ensuring that there
|
||||||
/// are no trailing LF characters at the end.
|
/// are no trailing LF characters at the end.
|
||||||
pub fn trimLines(allocator: std.mem.Allocator, buf: []const u8) ![]const u8 {
|
pub fn trimLines(allocator: std.mem.Allocator, buf: []const u8) ![]const u8 {
|
||||||
var list = try std.ArrayList(u8).initCapacity(allocator, buf.len);
|
var list = try std.array_list.Aligned(u8, null).initCapacity(allocator, buf.len);
|
||||||
|
|
||||||
var iter = std.mem.splitSequence(u8, buf, " \n");
|
var iter = std.mem.splitSequence(u8, buf, " \n");
|
||||||
while (iter.next()) |line| {
|
while (iter.next()) |line| {
|
||||||
// TODO: trimming CR characters is probably not necessary.
|
// TODO: trimming CR characters is probably not necessary.
|
||||||
const data = std.mem.trimRight(u8, line, " \r");
|
const data = std.mem.trimRight(u8, line, " \r");
|
||||||
try list.appendSlice(data);
|
try list.appendSlice(allocator, data);
|
||||||
try list.append('\n');
|
try list.append(allocator, '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = try list.toOwnedSlice(); // TODO: probably not necessary
|
const result = try list.toOwnedSlice(allocator); // TODO: probably not necessary
|
||||||
|
|
||||||
// Remove the trailing LF character, that is always present in the exercise
|
// Remove the trailing LF character, that is always present in the exercise
|
||||||
// output.
|
// output.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user