diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2016-09-27 23:42:01 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2016-09-27 23:44:15 +0200 |
commit | 0c548939747b9be5008fca38dd717b41810186d4 (patch) | |
tree | e5e43f5e600c1e6eb50802997116f619b5b9c639 /lib/x509/ip.c | |
parent | 2503f65550f52e4b17d6d06083f69dcfbb107194 (diff) | |
download | gnutls-0c548939747b9be5008fca38dd717b41810186d4.tar.gz |
Removed C99 constructions in for-loops
These constructions although valid for C99 they are
being rejected by various compilers. Get rid of them.
Diffstat (limited to 'lib/x509/ip.c')
-rw-r--r-- | lib/x509/ip.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/x509/ip.c b/lib/x509/ip.c index 9316933f3e..b4b31a4f94 100644 --- a/lib/x509/ip.c +++ b/lib/x509/ip.c @@ -175,10 +175,13 @@ static void prefix_to_mask(unsigned prefix, unsigned char *mask, size_t mask_siz * * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a negative error value. -*/ -int _gnutls_mask_ip(unsigned char *ip, const unsigned char *mask, unsigned ipsize) { +int _gnutls_mask_ip(unsigned char *ip, const unsigned char *mask, unsigned ipsize) +{ + unsigned i; + if (ipsize != 4 && ipsize != 16) return GNUTLS_E_MALFORMED_CIDR; - for (unsigned i = 0;i < ipsize; i++) + for (i = 0; i < ipsize; i++) ip[i] &= mask[i]; return GNUTLS_E_SUCCESS; } |