-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace bitset with std math/big #159
Conversation
@kolyshkin @thaJeztah PTAL |
go-selinux/selinux_linux.go
Outdated
low: &level{cats: new(big.Int)}, | ||
high: &level{cats: new(big.Int)}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK there's no need to explicitly initialize these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, those are pointers... Anyway, it's better initialize when needed (see below).
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please keep this empty line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, LGTM except a nit about initialization
71d72f5
to
8e14aa1
Compare
looks like this was updated; @kolyshkin ptal if your comments were addressed 🤗 |
go-selinux/selinux_linux.go
Outdated
if str != "" { | ||
str += "," | ||
} | ||
str += "c" + strconv.Itoa(int(i)) | ||
str += "c" + strconv.FormatInt(int64(i), 10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the docs:
Itoa is equivalent to FormatInt(int64(i), 10).
so why change this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no particular reason, probably i deleted the old lines when rewrote and used my own tastes.
grep the strconv usage in this package, seems itoa and atoi are more used. let's keep the style.
go-selinux/selinux_linux.go
Outdated
str += ",c" + strconv.FormatInt(int64(i), 10) | ||
} else if length > 1 { | ||
str += ".c" + strconv.FormatInt(int64(i), 10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, strconv.Itoa(i)
seems easier (feel free to ignore though).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@gitstashpop PTAL
LGTM, but would like @gitstashpop to take a look before merging this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes lgtm, just a nit about for loop style
go-selinux/selinux_linux.go
Outdated
|
||
i := int(c.TrailingZeroBits()) | ||
length := 0 | ||
for i < c.BitLen() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this could be a for init; condition; increment
loop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Signed-off-by: Shengjing Zhu <i@zhsj.me>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@kolyshkin @gitstashpop ptal (change was pushed and made your last review "outdated") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Thanks @zhsj |
No description provided.