* strends - Does this string end with this postfix? * @str: string to test * @postfix: postfix to look for at end of str * * Example: * if (strends(somestring, "foo")) * printf("String %s end with 'foo'!\n", somestring); */
| 41 | * printf("String %s end with 'foo'!\n", somestring); |
| 42 | */ |
| 43 | static inline bool strends(const char *str, const char *postfix) |
| 44 | { |
| 45 | if (strlen(str) < strlen(postfix)) |
| 46 | return false; |
| 47 | |
| 48 | return streq(str + strlen(str) - strlen(postfix), postfix); |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * stringify - Turn expression into a string literal |
no outgoing calls