Deduplicate tag type tracking.

It's available through tag->type.
This commit is contained in:
Romain Tartière 2016-01-18 16:58:59 +01:00
parent ee628f7ec5
commit 99fe8c1682
2 changed files with 2 additions and 4 deletions

View file

@ -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;
};
/*

View file

@ -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;
}
/*