Hi,
On 09.02.2009, Sascha Wilde wrote:
Timo Sirainen tss@iki.fi writes: [...]
How about instead of
array_append(rights, &imap_acl_letter_map[8].name
something like:
str = MAIL_ACL_CREATE; array_append(rights, &str
I gave it a try in the attached patch. Actually I considered that my self but I'm (still) not sure if this is 100% legal according to the standard.
After a bit of googling around, I'm now quite sure that it is legal.
MAIL_ACL_CREATE expands to a string literal, and array_append puts the
address of that literal into the array (by memcpy-ing what &str points to).
According to a draft copy of the C89 standard sting literals have static
storage (quoting from [1], section 3.1.4):
Semantics
A character string literal has static storage duration and type
``array of char ,'' and is initialized with the given characters.
So storing the address of the literal in the array is legal.
BTW, the OpenPGP signature on Sascha's mail was broken, probable because of this mailman bug: https://bugs.launchpad.net/mailman/+bug/265967
Bernhard
[1] ANSI C89 draft: http://flash-gordon.me.uk/ansi.c.txt linked to from http://en.wikipedia.org/wiki/ANSI_C
-- Bernhard Herzog | ++49-541-335 08 30 | http://www.intevation.de/ Intevation GmbH, Neuer Graben 17, 49074 Osnabrück | AG Osnabrück, HR B 18998 Geschäftsführer: Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner