diff options
author | Julien Dessaux | 2020-02-22 11:57:50 +0100 |
---|---|---|
committer | Julien Dessaux | 2020-02-22 11:57:50 +0100 |
commit | bcfaffac240d74cd79bec3c2a9d3c144d215b495 (patch) | |
tree | edd2c5f1e011afee759970323042fcf35bf68962 /utils/clen.go | |
parent | Improved tests for job package (diff) | |
download | bareos-zabbix-check-bcfaffac240d74cd79bec3c2a9d3c144d215b495.tar.gz bareos-zabbix-check-bcfaffac240d74cd79bec3c2a9d3c144d215b495.tar.bz2 bareos-zabbix-check-bcfaffac240d74cd79bec3c2a9d3c144d215b495.zip |
Added tests to the state package, and reworked the code around that
Diffstat (limited to 'utils/clen.go')
-rw-r--r-- | utils/clen.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/utils/clen.go b/utils/clen.go new file mode 100644 index 0000000..17d1c4b --- /dev/null +++ b/utils/clen.go @@ -0,0 +1,11 @@ +package utils + +// Clen returns the length of a null terminated string like in C +func Clen(n []byte) int { + for i := 0; i < len(n); i++ { + if n[i] == 0 { + return i + } + } + return len(n) +} |