From 99fe8c168209b72ff47abce0591a34c4ac24fab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Mon, 18 Jan 2016 16:58:59 +0100 Subject: [PATCH] Deduplicate tag type tracking. It's available through tag->type. --- libfreefare/freefare_internal.h | 1 - libfreefare/mifare_ultralight.c | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libfreefare/freefare_internal.h b/libfreefare/freefare_internal.h index b67a1ef..e38b3a8 100644 --- a/libfreefare/freefare_internal.h +++ b/libfreefare/freefare_internal.h @@ -261,7 +261,6 @@ struct mifare_ultralight_tag { /* mifare_ultralight_read() reads 4 pages at a time (wrapping) */ MifareUltralightPage cache[MIFARE_ULTRALIGHT_MAX_PAGE_COUNT + 3]; uint8_t cached_pages[MIFARE_ULTRALIGHT_MAX_PAGE_COUNT]; - bool is_ultralightc; }; /* diff --git a/libfreefare/mifare_ultralight.c b/libfreefare/mifare_ultralight.c index b0bd95a..2afb212 100644 --- a/libfreefare/mifare_ultralight.c +++ b/libfreefare/mifare_ultralight.c @@ -121,7 +121,6 @@ _mifare_ultralightc_tag_new (nfc_device *device, nfc_target target, bool is_ultr FreefareTag tag; if ((tag = malloc (sizeof (struct mifare_ultralight_tag)))) { - MIFARE_ULTRALIGHT(tag)->is_ultralightc = is_ultralightc; tag->type = (is_ultralightc) ? MIFARE_ULTRALIGHT_C : MIFARE_ULTRALIGHT; tag->free_tag = mifare_ultralightc_tag_free; tag->device = device; @@ -351,13 +350,13 @@ mifare_ultralightc_authenticate (FreefareTag tag, const MifareDESFireKey key) bool is_mifare_ultralight (FreefareTag tag) { - return !MIFARE_ULTRALIGHT(tag)->is_ultralightc; + return tag->type == MIFARE_ULTRALIGHT; } bool is_mifare_ultralightc (FreefareTag tag) { - return MIFARE_ULTRALIGHT(tag)->is_ultralightc; + return tag->type == MIFARE_ULTRALIGHT_C; } /*