Deduplicate tag type tracking.
It's available through tag->type.
This commit is contained in:
parent
ee628f7ec5
commit
99fe8c1682
2 changed files with 2 additions and 4 deletions
|
@ -261,7 +261,6 @@ struct mifare_ultralight_tag {
|
||||||
/* mifare_ultralight_read() reads 4 pages at a time (wrapping) */
|
/* mifare_ultralight_read() reads 4 pages at a time (wrapping) */
|
||||||
MifareUltralightPage cache[MIFARE_ULTRALIGHT_MAX_PAGE_COUNT + 3];
|
MifareUltralightPage cache[MIFARE_ULTRALIGHT_MAX_PAGE_COUNT + 3];
|
||||||
uint8_t cached_pages[MIFARE_ULTRALIGHT_MAX_PAGE_COUNT];
|
uint8_t cached_pages[MIFARE_ULTRALIGHT_MAX_PAGE_COUNT];
|
||||||
bool is_ultralightc;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -121,7 +121,6 @@ _mifare_ultralightc_tag_new (nfc_device *device, nfc_target target, bool is_ultr
|
||||||
FreefareTag tag;
|
FreefareTag tag;
|
||||||
|
|
||||||
if ((tag = malloc (sizeof (struct mifare_ultralight_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->type = (is_ultralightc) ? MIFARE_ULTRALIGHT_C : MIFARE_ULTRALIGHT;
|
||||||
tag->free_tag = mifare_ultralightc_tag_free;
|
tag->free_tag = mifare_ultralightc_tag_free;
|
||||||
tag->device = device;
|
tag->device = device;
|
||||||
|
@ -351,13 +350,13 @@ mifare_ultralightc_authenticate (FreefareTag tag, const MifareDESFireKey key)
|
||||||
bool
|
bool
|
||||||
is_mifare_ultralight (FreefareTag tag)
|
is_mifare_ultralight (FreefareTag tag)
|
||||||
{
|
{
|
||||||
return !MIFARE_ULTRALIGHT(tag)->is_ultralightc;
|
return tag->type == MIFARE_ULTRALIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
is_mifare_ultralightc (FreefareTag tag)
|
is_mifare_ultralightc (FreefareTag tag)
|
||||||
{
|
{
|
||||||
return MIFARE_ULTRALIGHT(tag)->is_ultralightc;
|
return tag->type == MIFARE_ULTRALIGHT_C;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue