From 3dda9d2701a34f02058425eea25431122283177c Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Thu, 1 Jul 2021 17:48:21 +0200 Subject: Use strcasecmp instead of copying and lower-casing string in irecv_devices_get_device_by_hardware_model() --- src/libirecovery.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src/libirecovery.c') 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; } -- cgit v1.1-32-gdbae