aboutsummaryrefslogtreecommitdiff
path: root/lib/std/SemanticVersion.zig
diff options
context:
space:
mode:
authorRyan Liptak <squeek502@hotmail.com>2023-05-04 18:15:50 -0700
committerRyan Liptak <squeek502@hotmail.com>2023-05-13 13:45:05 -0700
commit2129f28953b72da2f1bb58ff063a044d737c59c4 (patch)
treed8b12c947b4936cd96f753537c6effd36b2cb0c2 /lib/std/SemanticVersion.zig
parent815e53b147a321d0bdb47dc008aa8181f57175ac (diff)
downloadzig-2129f28953b72da2f1bb58ff063a044d737c59c4.tar.gz
zig-2129f28953b72da2f1bb58ff063a044d737c59c4.zip
Update all std.mem.split calls to their appropriate function
Everywhere that can now use `splitScalar` should get a nice little performance boost.
Diffstat (limited to 'lib/std/SemanticVersion.zig')
-rw-r--r--lib/std/SemanticVersion.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/std/SemanticVersion.zig b/lib/std/SemanticVersion.zig
index 26f6f581c8..4d505b4e30 100644
--- a/lib/std/SemanticVersion.zig
+++ b/lib/std/SemanticVersion.zig
@@ -42,8 +42,8 @@ pub fn order(lhs: Version, rhs: Version) std.math.Order {
if (lhs.pre == null and rhs.pre != null) return .gt;
// Iterate over pre-release identifiers until a difference is found.
- var lhs_pre_it = std.mem.split(u8, lhs.pre.?, ".");
- var rhs_pre_it = std.mem.split(u8, rhs.pre.?, ".");
+ var lhs_pre_it = std.mem.splitScalar(u8, lhs.pre.?, '.');
+ var rhs_pre_it = std.mem.splitScalar(u8, rhs.pre.?, '.');
while (true) {
const next_lid = lhs_pre_it.next();
const next_rid = rhs_pre_it.next();
@@ -86,7 +86,7 @@ pub fn parse(text: []const u8) !Version {
// Parse the required major, minor, and patch numbers.
const extra_index = std.mem.indexOfAny(u8, text, "-+");
const required = text[0..(extra_index orelse text.len)];
- var it = std.mem.split(u8, required, ".");
+ var it = std.mem.splitScalar(u8, required, '.');
var ver = Version{
.major = try parseNum(it.first()),
.minor = try parseNum(it.next() orelse return error.InvalidVersion),
@@ -108,7 +108,7 @@ pub fn parse(text: []const u8) !Version {
// Check validity of optional pre-release identifiers.
// See: https://semver.org/#spec-item-9
if (ver.pre) |pre| {
- it = std.mem.split(u8, pre, ".");
+ it = std.mem.splitScalar(u8, pre, '.');
while (it.next()) |id| {
// Identifiers MUST NOT be empty.
if (id.len == 0) return error.InvalidVersion;
@@ -127,7 +127,7 @@ pub fn parse(text: []const u8) !Version {
// Check validity of optional build metadata identifiers.
// See: https://semver.org/#spec-item-10
if (ver.build) |build| {
- it = std.mem.split(u8, build, ".");
+ it = std.mem.splitScalar(u8, build, '.');
while (it.next()) |id| {
// Identifiers MUST NOT be empty.
if (id.len == 0) return error.InvalidVersion;