nfc_device_get_information_about() now allocates returned string.

Note: must be freed by free().
This commit is contained in:
Romuald Conty 2012-09-17 13:47:30 +00:00
parent 2aba0f962a
commit de827ab583
6 changed files with 17 additions and 11 deletions

View file

@ -2925,8 +2925,12 @@ pn53x_get_supported_baud_rate(nfc_device *pnd, const nfc_modulation_type nmt, co
}
int
pn53x_get_information_about(nfc_device *pnd, char *buf, size_t buflen)
pn53x_get_information_about(nfc_device *pnd, char **pbuf)
{
size_t buflen = 2048;
*pbuf = malloc(buflen);
char *buf = *pbuf;
int res;
if ((res = snprintf(buf, buflen, "chip: %s\n", CHIP_DATA(pnd)->firmware_text)) < 0) {
return NFC_ESOFT;

View file

@ -388,7 +388,7 @@ int pn53x_check_error_frame(struct nfc_device *pnd, const uint8_t *pbtRxFrame
int pn53x_build_frame(uint8_t *pbtFrame, size_t *pszFrame, const uint8_t *pbtData, const size_t szData);
int pn53x_get_supported_modulation(nfc_device *pnd, const nfc_mode mode, const nfc_modulation_type **const supported_mt);
int pn53x_get_supported_baud_rate(nfc_device *pnd, const nfc_modulation_type nmt, const nfc_baud_rate **const supported_br);
int pn53x_get_information_about(nfc_device *pnd, char *buf, size_t buflen);
int pn53x_get_information_about(nfc_device *pnd, char **pbuf);
void pn53x_data_new(struct nfc_device *pnd, const struct pn53x_io *io);
void pn53x_data_free(struct nfc_device *pnd);