aboutsummaryrefslogtreecommitdiff
path: root/hdata/hdif.h
diff options
context:
space:
mode:
Diffstat (limited to 'hdata/hdif.h')
-rw-r--r--hdata/hdif.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/hdata/hdif.h b/hdata/hdif.h
index 52df0f1..38df6c2 100644
--- a/hdata/hdif.h
+++ b/hdata/hdif.h
@@ -63,12 +63,16 @@ struct HDIF_child_ptr {
.size = CPU_TO_BE32(_size), \
}
-static inline bool HDIF_check(const void *hdif, const char id[])
+static inline bool HDIF_check(const void *hdif, const char *id)
{
const struct HDIF_common_hdr *hdr = hdif;
- return hdr->d1f0 == CPU_TO_BE16(0xd1f0) &&
- memcmp(hdr->id, id, sizeof(hdr->id)) == 0;
+ if (hdr->d1f0 != CPU_TO_BE16(0xd1f0))
+ return false;
+ if (id && memcmp(hdr->id, id, sizeof(hdr->id)) != 0)
+ return false;
+
+ return true;
}
/* HDIF_get_idata - Get a pointer to internal data block