const char **entry_ptr;
char *trimmed_dmi;
size_t n;
+ int found = 0;
if (!start) return 0;
while (isspace(*start)) start++;
n = strlen(start);
while (n > 0 && isspace(start[n-1])) --n;
- trimmed_dmi = strndupa(start, n);
+ trimmed_dmi = strndup(start, n);
/* find trimmed value */
for (entry_ptr = table_entries; *entry_ptr; entry_ptr++) {
- const int found = fnmatch(*entry_ptr, trimmed_dmi, 0) == 0;
+ found = fnmatch(*entry_ptr, trimmed_dmi, 0) == 0;
/* fprintf(stderr, "find_dmi_string('%s', '%s'->'%s')=%i\n", *entry_ptr, dmi_value, trimmed_dmi, found); */
if (found)
- return 1;
+ break;
}
- return 0;
+
+ free(trimmed_dmi);
+
+ return found;
}
/*