diff options
author | Robin Krahl <robin.krahl@ireas.org> | 2020-01-28 17:56:53 +0100 |
---|---|---|
committer | Robin Krahl <robin.krahl@ireas.org> | 2020-02-03 11:31:21 +0100 |
commit | d905aafe208536203dd319e5dc48bd250180a8ef (patch) | |
tree | 15566bcd7ff23f940a2782e077f8f93a7bd44e84 /tests/device.rs | |
parent | 4fb865af37093d9b0ee039d8ae48fb2a820f3760 (diff) | |
download | nitrokey-rs-d905aafe208536203dd319e5dc48bd250180a8ef.tar.gz nitrokey-rs-d905aafe208536203dd319e5dc48bd250180a8ef.tar.bz2 |
Refactor string handling in util
The util module provides helper methods to deal with the C strings
returned by libnitrokey. The current implementation has to problems:
- It causes unnecessary allocations if we only want to look at the
string, for example in get_serial_number.
- If the conversion from a CStr to a String fails, the string pointer
is not freed.
Therefore this patch introduces the run_with_str function that executes
a function with the string returned by libnitrokey and then makes sure
that the pointer is freed correctly.
Diffstat (limited to 'tests/device.rs')
0 files changed, 0 insertions, 0 deletions