Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv25771/src
Modified Files:
dhcp-com.c
Log Message:
optimized with get_type instead of is_type; now not sequentially searching on each test
Index: dhcp-com.c
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-com.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** dhcp-com.c 26 Jun 2003 13:55:09 -0000 1.12
--- dhcp-com.c 5 Aug 2003 04:55:31 -0000 1.13
***************
*** 468,473 ****
}
! /* test for type. */
! int dhcp_is_type(dhcp_obj * dhcp, uint8_t type)
{
dhcp_opt_t *opt;
--- 468,473 ----
}
! /* get the message type. */
! int dhcp_get_type(dhcp_obj *dhcp)
{
dhcp_opt_t *opt;
***************
*** 481,492 ****
message_type = dhcp_opt_get_host_data(opt);
!
! if(*message_type == type) {
! return 1;
! } else {
! return 0;
! }
}
}
return 0;
--- 481,500 ----
message_type = dhcp_opt_get_host_data(opt);
! return *message_type;
}
}
+ return -1;
+ }
+
+ /* test for type. */
+ int dhcp_is_type(dhcp_obj * dhcp, uint8_t type)
+ {
+ int message_type = dhcp_get_type(dhcp);
+
+ if(message_type == -1)
+ return 0;
+
+ if(message_type == type)
+ return 1;
return 0;
|