Mercurial > pidgin.yaz
changeset 26935:55a8fe9d8247
add an ARRAY_LENGTH macro to find out length of static arrays
author | Ka-Hing Cheung <khc@hxbc.us> |
---|---|
date | Sun, 10 May 2009 22:23:52 +0000 |
parents | 0b97f73fa3d2 |
children | 88f1db1da582 |
files | libpurple/internal.h |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/internal.h Sun May 10 22:06:08 2009 +0000 +++ b/libpurple/internal.h Sun May 10 22:23:52 2009 +0000 @@ -256,6 +256,10 @@ #endif +#ifndef ARRAY_LENGTH +#define ARRAY_LENGTH(arr) (sizeof(arr) / sizeof(*arr)) +#endif + /* Safer ways to work with static buffers. When using non-static * buffers, either use g_strdup_* functions (preferred) or use * g_strlcpy/g_strlcpy directly. */