diff options
author | Nikias Bassen | 2021-07-01 17:48:21 +0200 |
---|---|---|
committer | Nikias Bassen | 2021-07-01 17:48:21 +0200 |
commit | 3dda9d2701a34f02058425eea25431122283177c (patch) | |
tree | f73e0f8a828537441ea5853a21a4847b3e491d8d /src | |
parent | 47f6aec37c2df467bc705b4aaee5cefa0835c131 (diff) | |
download | libirecovery-3dda9d2701a34f02058425eea25431122283177c.tar.gz libirecovery-3dda9d2701a34f02058425eea25431122283177c.tar.bz2 |
Use strcasecmp instead of copying and lower-casing string in irecv_devices_get_device_by_hardware_model()
Diffstat (limited to 'src')
-rw-r--r-- | src/libirecovery.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/src/libirecovery.c b/src/libirecovery.c index 1defaac..2219f36 100644 --- a/src/libirecovery.c +++ b/src/libirecovery.c @@ -3271,14 +3271,8 @@ IRECV_API irecv_error_t irecv_devices_get_device_by_hardware_model(const char* h *device = NULL; - /* lowercase hardware_model string for proper lookup */ - char model[8]; - strcpy(model, hardware_model); - char *p = model; - for (; *p; ++p) *p = tolower(*p); - for (i = 0; irecv_devices[i].hardware_model != NULL; i++) { - if (!strcmp(model, irecv_devices[i].hardware_model)) { + if (!strcasecmp(hardware_model, irecv_devices[i].hardware_model)) { *device = &irecv_devices[i]; return IRECV_E_SUCCESS; } |