mirror of
https://github.com/zigzap/zap.git
synced 2025-10-20 23:24:09 +00:00
fixed users.zig
This commit is contained in:
parent
3af5b7b939
commit
50c64e0f90
1 changed files with 2 additions and 2 deletions
|
@ -36,8 +36,6 @@ pub fn addByName(self: *Self, first: ?[]const u8, last: ?[]const u8) !usize {
|
||||||
var temp = try self.alloc.alloc(InternalUser, 1);
|
var temp = try self.alloc.alloc(InternalUser, 1);
|
||||||
defer self.alloc.free(temp);
|
defer self.alloc.free(temp);
|
||||||
var user = temp[0];
|
var user = temp[0];
|
||||||
self.count = self.count + 1;
|
|
||||||
user.id = self.count;
|
|
||||||
user.firstnamelen = 0;
|
user.firstnamelen = 0;
|
||||||
user.lastnamelen = 0;
|
user.lastnamelen = 0;
|
||||||
if (first) |firstname| {
|
if (first) |firstname| {
|
||||||
|
@ -52,6 +50,8 @@ pub fn addByName(self: *Self, first: ?[]const u8, last: ?[]const u8) !usize {
|
||||||
// We lock only on insertion, deletion, and listing
|
// We lock only on insertion, deletion, and listing
|
||||||
self.lock.lock();
|
self.lock.lock();
|
||||||
defer self.lock.unlock();
|
defer self.lock.unlock();
|
||||||
|
self.count = self.count + 1;
|
||||||
|
user.id = self.count;
|
||||||
try self.users.put(user.id, user);
|
try self.users.put(user.id, user);
|
||||||
return user.id;
|
return user.id;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue