aboutsummaryrefslogtreecommitdiff
path: root/bencode
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-06-21 20:36:48 +0200
committerDimitri Sokolyuk <demon@dim13.org>2016-06-21 20:36:48 +0200
commit58dc7932c4e26e312bf10e27c247527e577ca945 (patch)
treedafa1c6317643e6bbc173d499324576dc8bf5b91 /bencode
parent18e305f4dee1ab643e173061e7b12112035a1bdc (diff)
rename isZero
Diffstat (limited to 'bencode')
-rw-r--r--bencode/bencode.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/bencode/bencode.go b/bencode/bencode.go
index 80b2ed3..14d8953 100644
--- a/bencode/bencode.go
+++ b/bencode/bencode.go
@@ -49,7 +49,7 @@ func marshalField(out io.Writer, v reflect.Value) error {
return nil
}
-func isEmpty(v reflect.Value) bool {
+func isZero(v reflect.Value) bool {
switch v.Kind() {
case reflect.Int:
return v.Int() == 0
@@ -94,7 +94,7 @@ func marshalDict(out io.Writer, v reflect.Value) {
name = n.Name
}
vf := v.FieldByIndex(n.Index)
- if param == "optional" && isEmpty(vf) {
+ if param == "optional" && isZero(vf) {
continue
}
marshalString(out, name)