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.
AFAIK there's no need to explicitly initialize these.
There was a problem hiding this comment.
Ah, those are pointers... Anyway, it's better initialize when needed (see below).
| i++ | ||
| length = 0 | ||
| } | ||
|
|
There was a problem hiding this comment.
please keep this empty line
kolyshkin
left a comment
There was a problem hiding this comment.
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
| str += "," | ||
| } | ||
| str += "c" + strconv.Itoa(int(i)) | ||
| str += "c" + strconv.FormatInt(int64(i), 10) |
There was a problem hiding this comment.
From the docs:
Itoa is equivalent to FormatInt(int64(i), 10).
so why change this?
There was a problem hiding this comment.
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.
Same here, strconv.Itoa(i) seems easier (feel free to ignore though).
kolyshkin
left a comment
There was a problem hiding this comment.
LGTM
@gitstashpop PTAL
|
LGTM, but would like @gitstashpop to take a look before merging this. |
gitstashpop
left a comment
There was a problem hiding this comment.
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.
nit: this could be a for init; condition; increment loop
Signed-off-by: Shengjing Zhu <[email protected]>
|
@kolyshkin @gitstashpop ptal (change was pushed and made your last review "outdated") |
|
Thanks @zhsj |
No description provided.