summaryrefslogtreecommitdiff
path: root/dtc.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2017-10-29 18:56:03 +0100
committerDavid Gibson <david@gibson.dropbear.id.au>2017-11-11 19:36:14 +1100
commitfca296445eabf3cfe986e89dd8711c0be583036d (patch)
tree568b6a37bcfed0bf80d11613a17f16605ee9bfe7 /dtc.h
parentcc392f089007873734ae2fbfb384df7acb4fe3c6 (diff)
downloaddevice-tree-compiler-fca296445eabf3cfe986e89dd8711c0be583036d.tar.gz
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 <david@gibson.dropbear.id.au>
Diffstat (limited to 'dtc.h')
-rw-r--r--dtc.h1
1 files changed, 1 insertions, 0 deletions
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))