summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2012-09-22 19:49:04 +0200
committerPali Rohár <pali.rohar@gmail.com>2012-09-22 19:49:04 +0200
commit1a89112c254590ee14f6999022bc443fa77db141 (patch)
tree74a7ada0c36a1b1ce43e02089d96333ae6851f11
parent10a2bc6319682db8a2fc0b799675553251013916 (diff)
download0xFFFF-1a89112c254590ee14f6999022bc443fa77db141.tar.bz2
image: Implement image_hwrev_is_valid
-rw-r--r--src/image.c21
-rw-r--r--src/image.h2
2 files changed, 7 insertions, 16 deletions
diff --git a/src/image.c b/src/image.c
index b66e788..d9f4f13 100644
--- a/src/image.c
+++ b/src/image.c
@@ -540,26 +540,17 @@ const char * image_type_to_string(enum image_type type) {
}
-int image_hwrev_is_valid(struct image * image, const char * hwrev) {
+int image_hwrev_is_valid(struct image * image, int16_t hwrev) {
-/* const char * ptr = image->hwrevs;
- const char * oldptr = ptr;
+ struct device_list * device_ptr = image->devices;
- if ( ! hwrev || ! ptr )
- return 1;
-
- while ( (ptr = strchr(ptr, ',')) ) {
- if ( strncmp(hwrev, oldptr, ptr-oldptr) == 0 )
+ while ( device_ptr ) {
+ if ( hwrev_is_valid(device_ptr->hwrevs, hwrev) )
return 1;
- ++ptr;
- oldptr = ptr;
+ device_ptr = device_ptr->next;
}
- if ( strcmp(hwrev, oldptr) == 0 )
- return 1;
- else
- return 0;*/
- return 1;
+ return 0;
}
diff --git a/src/image.h b/src/image.h
index f601273..648a090 100644
--- a/src/image.h
+++ b/src/image.h
@@ -78,6 +78,6 @@ enum image_type image_type_from_data(struct image * image);
char * image_name_alloc_from_values(struct image * image);
enum image_type image_type_from_string(const char * type);
const char * image_type_to_string(enum image_type type);
-int image_hwrev_is_valid(struct image * image, const char * hwrev);
+int image_hwrev_is_valid(struct image * image, int16_t hwrev);
#endif