]> git.ozlabs.org Git - ccan/commitdiff
bytestring: Use CONST_FUNCTION
authorDavid Gibson <david@gibson.dropbear.id.au>
Sat, 11 Oct 2014 16:47:28 +0000 (18:47 +0200)
committerDavid Gibson <david@gibson.dropbear.id.au>
Thu, 30 Oct 2014 14:05:00 +0000 (01:05 +1100)
The bytestring() constructor function satisfies the constraints of
CONST_FUNCTION, so mark it as such.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
ccan/bytestring/_info
ccan/bytestring/bytestring.h

index f68a4c73393c956251f680836fc9ec5ac1aab607..34b0d1290c1e6bf7fb9035ea7d61ccc73b75120a 100644 (file)
@@ -36,6 +36,7 @@ int main(int argc, char *argv[])
        if (strcmp(argv[1], "depends") == 0) {
                printf("ccan/array_size\n");
                printf("ccan/mem\n");
+               printf("ccan/compiler\n");
                return 0;
        }
 
index 0d1c929e599564d92984c836b9f434b5195dbd1e..fd5187701b3430bd03f5cc60be080f0dfdc57b49 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <ccan/array_size/array_size.h>
 #include <ccan/mem/mem.h>
+#include <ccan/compiler/compiler.h>
 
 struct bytestring {
        const char *ptr;
@@ -29,7 +30,8 @@ struct bytestring {
  *     struct bytestring bs = bytestring(x, 5);
  *     assert(bs.len == 5);
  */
-static inline struct bytestring bytestring(const char *p, size_t l)
+static inline CONST_FUNCTION struct bytestring
+bytestring(const char *p, size_t l)
 {
        struct bytestring bs = {
                .ptr = p,