From 49afc747d1b093924f514b923bf4b271e04120ee Mon Sep 17 00:00:00 2001 From: "Andrew V. Samoilov" Date: Sun, 22 Oct 2000 15:37:33 +0000 Subject: [PATCH] nmb_header_opcode_names constified, lookup_opcode_names rewritten to avoid warnings --- vfs/samba/libsmb/nmblib.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/vfs/samba/libsmb/nmblib.c b/vfs/samba/libsmb/nmblib.c index fdbb50fab..9f3025fc2 100644 --- a/vfs/samba/libsmb/nmblib.c +++ b/vfs/samba/libsmb/nmblib.c @@ -30,7 +30,7 @@ int num_good_receives = 0; static struct opcode_names { char *nmb_opcode_name; int opcode; -} nmb_header_opcode_names[] = { +} const nmb_header_opcode_names[] = { {"Query", 0 }, {"Registration", 5 }, {"Release", 6 }, @@ -46,13 +46,12 @@ static struct opcode_names { ****************************************************************************/ static char *lookup_opcode_name( int opcode ) { - struct opcode_names *op_namep; - int i; + const struct opcode_names *op_namep = nmb_header_opcode_names; - for(i = 0; nmb_header_opcode_names[i].nmb_opcode_name != 0; i++) { - op_namep = &nmb_header_opcode_names[i]; + while(op_namep->nmb_opcode_name) { if(opcode == op_namep->opcode) return op_namep->nmb_opcode_name; + op_namep++; } return ""; }