Convert by value passing of nfc_target to pointer for str_nfc_target and nfc_initiator_target_is_present

This becomes more consistent with all other pass by pointer of most structures.
Additionally, this should lessen stack memory usage, as building strings with str_nfc_target would push the target (283 bytes) plus then a copy of the info objects (up to 275) onto the stack as it dives into the sprintf functions.

Lastly, this makes my attempt at a .NET wrapper easier, as I can make passing by pointer work, but passing by value seems to bomb on the interop right now.
This commit is contained in:
Alex Lian 2013-03-03 23:40:07 -05:00 committed by Philippe Teuwen
parent a262be5633
commit c72846e3c6
16 changed files with 156 additions and 154 deletions

View file

@ -1668,10 +1668,10 @@ pn53x_initiator_deselect_target(struct nfc_device *pnd)
}
int
pn53x_initiator_target_is_present(struct nfc_device *pnd, const nfc_target nt)
pn53x_initiator_target_is_present(struct nfc_device *pnd, const nfc_target *pnt)
{
// Check if the argument target nt is equals to current saved target
if (!pn53x_current_target_is(pnd, &nt)) {
if (!pn53x_current_target_is(pnd, pnt)) {
return NFC_ETGRELEASED;
}

View file

@ -337,7 +337,7 @@ int pn53x_initiator_transceive_bits_timed(struct nfc_device *pnd, const uint8
int pn53x_initiator_transceive_bytes_timed(struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx,
uint8_t *pbtRx, const size_t szRx, uint32_t *cycles);
int pn53x_initiator_deselect_target(struct nfc_device *pnd);
int pn53x_initiator_target_is_present(struct nfc_device *pnd, const nfc_target nt);
int pn53x_initiator_target_is_present(struct nfc_device *pnd, const nfc_target *pnt);
// NFC device as Target functions
int pn53x_target_init(struct nfc_device *pnd, nfc_target *pnt, uint8_t *pbtRx, const size_t szRxLen, int timeout);