]> git.ozlabs.org Git - ccan/commit - ccan/bytestring/bytestring.h
bytestring: Add initializer macro
authorDavid Gibson <david@gibson.dropbear.id.au>
Sat, 11 Oct 2014 16:46:57 +0000 (18:46 +0200)
committerDavid Gibson <david@gibson.dropbear.id.au>
Thu, 30 Oct 2014 14:05:00 +0000 (01:05 +1100)
commit2ecae4f3ae8880196794704029c90d0285c8cb80
tree296d370b4a220238b319df545d65af06787ecd17
parent846f605e6ed459f1276c218cb1421514d6b43c90
bytestring: Add initializer macro

The BYTESTRING macro is constant, since it's designed to take a string
literal, but it doesn't count as constant since it involves an (inlined)
function call.  That means it can't be used in a static storage duration
initializer.

Unfortunately, I can't see a portable way to make something which can be
used as an initializer, but which can also be used in other contexts where
BYTESTRING() can be used, so this patch introduces BYTESTRING_INIT() which
is similar to BYTESTRING() but produces an initializer.

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