Commit 846f605e authored by David Gibson's avatar David Gibson

bytestring: Use CONST_FUNCTION

The bytestring() constructor function satisfies the constraints of
CONST_FUNCTION, so mark it as such.
Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
parent 3f60b879
...@@ -36,6 +36,7 @@ int main(int argc, char *argv[]) ...@@ -36,6 +36,7 @@ int main(int argc, char *argv[])
if (strcmp(argv[1], "depends") == 0) { if (strcmp(argv[1], "depends") == 0) {
printf("ccan/array_size\n"); printf("ccan/array_size\n");
printf("ccan/mem\n"); printf("ccan/mem\n");
printf("ccan/compiler\n");
return 0; return 0;
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <ccan/array_size/array_size.h> #include <ccan/array_size/array_size.h>
#include <ccan/mem/mem.h> #include <ccan/mem/mem.h>
#include <ccan/compiler/compiler.h>
struct bytestring { struct bytestring {
const char *ptr; const char *ptr;
...@@ -29,7 +30,8 @@ struct bytestring { ...@@ -29,7 +30,8 @@ struct bytestring {
* struct bytestring bs = bytestring(x, 5); * struct bytestring bs = bytestring(x, 5);
* assert(bs.len == 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 = { struct bytestring bs = {
.ptr = p, .ptr = p,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment