From fca296445eabf3cfe986e89dd8711c0be583036d Mon Sep 17 00:00:00 2001 From: David Gibson Date: Sun, 29 Oct 2017 18:56:03 +0100 Subject: Add strstarts() helper function nodename_from_path() in flattree.c uses strneq() to test that one string starts with another. This is, in fact, the only correct usage of strneq() in the entire tree. To make things harder to confuse, add a strstarts() function for this purpose. Signed-off-by: David Gibson --- dtc.h | 1 + 1 file changed, 1 insertion(+) (limited to 'dtc.h') diff --git a/dtc.h b/dtc.h index 760f9e3..bb0b91b 100644 --- a/dtc.h +++ b/dtc.h @@ -68,6 +68,7 @@ typedef uint32_t cell_t; #define streq(a, b) (strcmp((a), (b)) == 0) #define strneq(a, b, n) (strncmp((a), (b), (n)) == 0) +#define strstarts(s, prefix) (strncmp((s), (prefix), strlen(prefix)) == 0) #define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) -- cgit v1.2.1