Drop redundant SIZEOF() macro

Change-Id: I6db2033746f5f22dd0229c96727bb352bdb1e866
Reviewed-on: https://code.wireshark.org/review/18298
Reviewed-by: Balint Reczey <balint@balintreczey.hu>
Petri-Dish: Balint Reczey <balint@balintreczey.hu>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Balint Reczey 2016-10-18 22:41:55 +02:00 committed by Anders Broman
parent 739bdfb45f
commit bf96599f19
2 changed files with 10 additions and 12 deletions

View File

@ -917,19 +917,19 @@ decode_command(tvbuff_t *tvb, int offset, int dst, proto_tree *pt)
if (cmd > 0x3F)
cmd += dst * 256;
for (i = 0; i < SIZEOF(cmds); i++) {
for (i = 0; i < array_length(cmds); i++) {
if (cmds[i].value == cmd)
break;
}
if (i >= SIZEOF(cmds) && dst >= SD_KNOWN) {
if (i >= array_length(cmds) && dst >= SD_KNOWN) {
cmd = (cmd & 0xFF) + SD_CARD * 256;
for (i = 0; i < SIZEOF(cmds); i++) {
for (i = 0; i < array_length(cmds); i++) {
if (cmds[i].value == cmd)
break;
}
}
if (i >= SIZEOF(cmds))
i = SIZEOF(cmds) - 1;
if (i >= array_length(cmds))
i = array_length(cmds) - 1;
proto_tree_add_string(pt, hf_gryphon_command, tvb, offset, 4, cmds[i].strptr);
offset += 4;
@ -955,19 +955,19 @@ decode_response(tvbuff_t *tvb, int offset, int src, proto_tree *pt)
if (cmd > 0x3F)
cmd += src * 256;
for (i = 0; i < SIZEOF(cmds); i++) {
for (i = 0; i < array_length(cmds); i++) {
if (cmds[i].value == cmd)
break;
}
if (i >= SIZEOF(cmds) && src >= SD_KNOWN) {
if (i >= array_length(cmds) && src >= SD_KNOWN) {
cmd = (cmd & 0xFF) + SD_CARD * 256;
for (i = 0; i < SIZEOF(cmds); i++) {
for (i = 0; i < array_length(cmds); i++) {
if (cmds[i].value == cmd)
break;
}
}
if (i >= SIZEOF(cmds))
i = SIZEOF(cmds) - 1;
if (i >= array_length(cmds))
i = array_length(cmds) - 1;
proto_tree_add_string(pt, hf_gryphon_command, tvb, offset, 4, cmds[i].strptr);
offset += 4;
msglen -= 4;

View File

@ -449,8 +449,6 @@
#define GLIN 0x0b /* LIN TYPE */
#define GDGLIN08 0x01 /* DG HC08 SUBTYPE */
#define SIZEOF(x) (sizeof(x)/sizeof(x[0]))
#define MEMCPY(dest, src, size) \
memcpy (dest, src, size); \
*((dest)+size) = 0;