Skip to content

Commit 857656d

Browse files
committed
Add some const qualifiers
Moreover: Fix indentation.
1 parent 94d4ea6 commit 857656d

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

util-print.c

+8-12
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ print_unknown_data(netdissect_options *ndo, const u_char *cp,
472472
*/
473473
static const char *
474474
tok2strbuf(const struct tok *lp, const char *fmt,
475-
u_int v, char *buf, size_t bufsize)
475+
const u_int v, char *buf, const size_t bufsize)
476476
{
477477
if (lp != NULL) {
478478
while (lp->s != NULL) {
@@ -494,8 +494,7 @@ tok2strbuf(const struct tok *lp, const char *fmt,
494494
* in round-robin fashion.
495495
*/
496496
const char *
497-
tok2str(const struct tok *lp, const char *fmt,
498-
u_int v)
497+
tok2str(const struct tok *lp, const char *fmt, const u_int v)
499498
{
500499
static char buf[4][TOKBUFSIZE];
501500
static int idx = 0;
@@ -516,7 +515,7 @@ tok2str(const struct tok *lp, const char *fmt,
516515
*/
517516
static char *
518517
bittok2str_internal(const struct tok *lp, const char *fmt,
519-
u_int v, const char *sep)
518+
const u_int v, const char *sep)
520519
{
521520
static char buf[1024+1]; /* our string buffer */
522521
char *bufp = buf;
@@ -556,8 +555,7 @@ bittok2str_internal(const struct tok *lp, const char *fmt,
556555
* this is useful for parsing bitfields, the output strings are not separated.
557556
*/
558557
char *
559-
bittok2str_nosep(const struct tok *lp, const char *fmt,
560-
u_int v)
558+
bittok2str_nosep(const struct tok *lp, const char *fmt, const u_int v)
561559
{
562560
return (bittok2str_internal(lp, fmt, v, ""));
563561
}
@@ -567,8 +565,7 @@ bittok2str_nosep(const struct tok *lp, const char *fmt,
567565
* this is useful for parsing bitfields, the output strings are comma separated.
568566
*/
569567
char *
570-
bittok2str(const struct tok *lp, const char *fmt,
571-
u_int v)
568+
bittok2str(const struct tok *lp, const char *fmt, const u_int v)
572569
{
573570
return (bittok2str_internal(lp, fmt, v, ", "));
574571
}
@@ -580,8 +577,7 @@ bittok2str(const struct tok *lp, const char *fmt,
580577
* correct for bounds-checking.
581578
*/
582579
const char *
583-
tok2strary_internal(const char **lp, int n, const char *fmt,
584-
int v)
580+
tok2strary_internal(const char **lp, int n, const char *fmt, const int v)
585581
{
586582
static char buf[TOKBUFSIZE];
587583

@@ -614,7 +610,7 @@ uint2tokary_internal(const struct uint_tokary dict[], const size_t size,
614610
*/
615611

616612
int
617-
mask2plen(uint32_t mask)
613+
mask2plen(const uint32_t mask)
618614
{
619615
const uint32_t bitmasks[33] = {
620616
0x00000000,
@@ -682,7 +678,7 @@ mask62plen(const u_char *mask)
682678
*/
683679
static int
684680
fetch_token(netdissect_options *ndo, const u_char *pptr, u_int idx, u_int len,
685-
u_char *tbuf, size_t tbuflen)
681+
u_char *tbuf, size_t tbuflen)
686682
{
687683
size_t toklen = 0;
688684
u_char c;

0 commit comments

Comments
 (0)