diff options
author | Andrew G. Morgan <morgan@kernel.org> | 2021-09-10 16:02:28 -0700 |
---|---|---|
committer | Andrew G. Morgan <morgan@kernel.org> | 2021-09-10 16:02:28 -0700 |
commit | e7297c1925d827d3932dc7ed96554a1d94c17dd7 (patch) | |
tree | 1a72c0636389200d7843aa645fe749e26ffdf0fa | |
parent | 39067301976057bc8915e4025f6715432a5b0c74 (diff) | |
download | libcap2-e7297c1925d827d3932dc7ed96554a1d94c17dd7.tar.gz |
More standard deprecation comment for cap.Compare and cap.IABInit
Based on what I see on go.dev, there seems to be some preferred
comment style for deprecating a function. Use it to help spread
the word.
Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
-rw-r--r-- | cap/flags.go | 33 | ||||
-rw-r--r-- | cap/iab.go | 12 |
2 files changed, 39 insertions, 6 deletions
diff --git a/cap/flags.go b/cap/flags.go index 310ac5d..88ad355 100644 --- a/cap/flags.go +++ b/cap/flags.go @@ -148,12 +148,35 @@ func (c *Set) ClearFlag(vec Flag) error { return c.forceFlag(vec, false) } -// Compare returns 0 if c and d are identical in content. Otherwise, -// this function returns a non-zero value of 3 independent bits: -// (differE ? 1:0) | (differP ? 2:0) | (differI ? 4:0). The Differs() -// function can be used to test for a difference in a specific Flag. +// Compare returns 0 if c and d are identical in content. // -// This function is deprecated in favor of (*Set).Cf(). +// Deprecated: Replace with (*Set).Cf(). +// +// Example, replace this: +// +// diff, err := a.Compare(b) +// if err != nil { +// return err +// } +// if diff == 0 { +// return nil +// } +// if diff & (1 << Effective) { +// log.Print("a and b difference includes Effective values") +// } +// +// with this: +// +// diff, err := a.Cf(b) +// if err != nil { +// return err +// } +// if diff == 0 { +// return nil +// } +// if diff.Has(Effective) { +// log.Print("a and b difference includes Effective values") +// } func (c *Set) Compare(d *Set) (uint, error) { u, err := c.Cf(d) return uint(u), err @@ -79,7 +79,17 @@ func NewIAB() *IAB { } } -// IABInit is a deprecated alias for the NewIAB function. +// IABInit allocates a new IAB tuple. +// +// Deprecated: Replace with NewIAB. +// +// Example, replace this: +// +// iab := IABInit() +// +// with this: +// +// iab := NewIAB() func IABInit() *IAB { return NewIAB() } |