mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-09 03:21:51 +00:00
lib/uuid.c: change prototype of uuid_guid_get_str()
There's no reason to require an appropriately sized output parameter for the string, that's error-prone should the table ever grow an element with a longer string. We can just return the const char* pointer directly. Update the only caller accordingly, and get rid of pointless ifdeffery in the header so that the compiler always sees a declaration and can thus do type-checking, whether or not PARTITION_TYPE_GUID is enabled or not. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
This commit is contained in:
parent
2d572ede11
commit
31ce367cd1
3 changed files with 11 additions and 13 deletions
11
lib/uuid.c
11
lib/uuid.c
|
@ -122,20 +122,19 @@ int uuid_guid_get_bin(const char *guid_str, unsigned char *guid_bin)
|
|||
* uuid_guid_get_str() - this function get string for GUID.
|
||||
*
|
||||
* @param guid_bin - pointer to string with partition type guid [16B]
|
||||
* @param guid_str - pointer to allocated partition type string [7B]
|
||||
*
|
||||
* Returns NULL if the type GUID is not known.
|
||||
*/
|
||||
int uuid_guid_get_str(const unsigned char *guid_bin, char *guid_str)
|
||||
const char *uuid_guid_get_str(const unsigned char *guid_bin)
|
||||
{
|
||||
int i;
|
||||
|
||||
*guid_str = 0;
|
||||
for (i = 0; i < ARRAY_SIZE(list_guid); i++) {
|
||||
if (!memcmp(list_guid[i].guid.b, guid_bin, 16)) {
|
||||
strcpy(guid_str, list_guid[i].string);
|
||||
return 0;
|
||||
return list_guid[i].string;
|
||||
}
|
||||
}
|
||||
return -ENODEV;
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue