On Mon, 11 Feb, at 03:01:09PM, Al Viro wrote: > > Yecchhh... How about > static const char dashes[GUID_LEN] = { > [8] = 1, [13] = 1, [18] = 1, [23] = 1 > }; > const char *s = str + len - GUID_LEN; > int i; > /* > * We need a GUID, plus at least one letter for the variable name, > * plus the '-' separator > */ > if (len < GUID_LEN + 2) > return 0; > > /* GUID should be right after the first '-' */ > if (s - 1 != strchr(str, '-')) > return 0; > > /* > * Validate that 's' is of the correct format, e.g. > * > * 12345678-1234-1234-1234-123456789abc > */ > for (i = 0; i < GUID_LEN; i++) { > if (dashes[i]) { > if (*s++ != '-') > return 0; > } else { > if (!isxdigit(*s++)) > return 0; > } > } > return 1; > > instead? Sure, that's a nice improvement. Also, I did have a version of this patch that returned a boolean, but that seems to have been lost in one of my topic branches. I'll respind this, thanks Al. -- Matt Fleming, Intel Open Source Technology Center -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html