freebsd-dev/sbin/ipf/libipf/printhash.c
Cy Schubert 44bc301921 ipfilter userland: Style(9) requires a space after return
Reported by:    jrtc27
Fixes:          2582ae5740
MFC after:      1 month
2022-01-03 19:37:25 -08:00

55 lines
1.0 KiB
C

/* $FreeBSD$ */
/*
* Copyright (C) 2012 by Darren Reed.
*
* See the IPFILTER.LICENCE file for details on licencing.
*/
#include "ipf.h"
iphtable_t *
printhash( iphtable_t *hp, copyfunc_t copyfunc, char *name, int opts,
wordtab_t *fields)
{
iphtent_t *ipep, **table;
iphtable_t iph;
int printed;
size_t sz;
if ((*copyfunc)((char *)hp, (char *)&iph, sizeof(iph)))
return (NULL);
if ((name != NULL) && strncmp(name, iph.iph_name, FR_GROUPLEN))
return (iph.iph_next);
if (fields == NULL)
printhashdata(hp, opts);
if ((hp->iph_flags & IPHASH_DELETE) != 0)
PRINTF("# ");
if ((opts & OPT_DEBUG) == 0)
PRINTF("\t{");
sz = iph.iph_size * sizeof(*table);
table = malloc(sz);
if ((*copyfunc)((char *)iph.iph_table, (char *)table, sz))
return (NULL);
for (printed = 0, ipep = iph.iph_list; ipep != NULL; ) {
ipep = printhashnode(&iph, ipep, copyfunc, opts, fields);
printed++;
}
if (printed == 0)
putchar(';');
free(table);
if ((opts & OPT_DEBUG) == 0)
PRINTF(" };\n");
return (iph.iph_next);
}