parser: fix warning in net_find_af_name

The fix to prevent the compiler from SEGV'ing when dumping network
rules in commit 2888 introduced the following compiler warning:

  network.c: In function ‘const char* net_find_af_name(unsigned int)’:
  network.c:331:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < sizeof(network_mappings) / sizeof(*network_mappings); i++) {

The problem is that the counter i is an int, but sizeof returns size_t
which is unsigned. The following patch fixes the issue by converting the
type of i to size_t.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
Steve Beattie 2015-03-19 00:12:09 -07:00
parent a11a39dd28
commit 1b1a0d448d

View file

@ -323,7 +323,7 @@ struct aa_network_entry *network_entry(const char *family, const char *type,
const char *net_find_af_name(unsigned int af)
{
int i;
size_t i;
if (af < 0 || af > get_af_max())
return NULL;