nsc: Turn common patterns into CA_IS_ARRAY() and CA_ARRAY_LEN()

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2014-02-02 10:13:41 +01:00
parent 143a4e4e6f
commit b6775d1c9b
4 changed files with 15 additions and 11 deletions

View file

@ -235,7 +235,11 @@ struct castr {
int ca_flags;
};
/* variables using the above */
/* Is CA an array? */
#define CA_IS_ARRAY(ca) ((ca)->ca_type != NSC_STRINGY && (ca)->ca_len != 0)
/* If CA is an array, return its length, else zero */
#define CA_ARRAY_LEN(ca) ((ca)->ca_type != NSC_STRINGY ? (ca)->ca_len : 0)
extern struct castr ichr_ca[];
extern struct castr pchr_ca[];