Browse Source

bytestring: Use CONST_FUNCTION

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>
David Gibson 11 years ago
parent
commit
846f605e6e
2 changed files with 4 additions and 1 deletions
  1. 1 0
      ccan/bytestring/_info
  2. 3 1
      ccan/bytestring/bytestring.h

+ 1 - 0
ccan/bytestring/_info

@@ -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;
 	}
 

+ 3 - 1
ccan/bytestring/bytestring.h

@@ -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,