using 'as' as name for array size is confusing a lot. Better name is ARRAY_SIZE. Note, that 'as' has wrongly parentheses around sizeof(ar[0]).
Signed-off-by: Nikola Pajkovsky <n.pajk...@gmail.com> --- src/drv_imap.c | 6 +++--- src/drv_maildir.c | 6 +++--- src/isync.h | 2 +- src/sync.c | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/drv_imap.c b/src/drv_imap.c index 3e10897..e4dd74c 100644 --- a/src/drv_imap.c +++ b/src/drv_imap.c @@ -685,7 +685,7 @@ parse_fetch( imap_store_t *ctx, list_t *list ) status |= M_RECENT; goto flagok; } - for (i = 0; i < as(Flags); i++) + for (i = 0; i < ARRAY_SIZE(Flags); i++) if (!strcmp( Flags[i], flags->val + 1 )) { mask |= 1 << i; goto flagok; @@ -777,7 +777,7 @@ parse_capability( imap_store_t *ctx, char *cmd ) ctx->caps = 0x80000000; while ((arg = next_arg( &cmd ))) - for (i = 0; i < as(cap_list); i++) + for (i = 0; i < ARRAY_SIZE(cap_list); i++) if (!strcmp( cap_list[i], arg )) ctx->caps |= 1 << i; } @@ -1658,7 +1658,7 @@ imap_make_flags( int flags, char *buf ) const char *s; unsigned i, d; - for (i = d = 0; i < as(Flags); i++) + for (i = d = 0; i < ARRAY_SIZE(Flags); i++) if (flags & (1 << i)) { buf[d++] = ' '; buf[d++] = '\\'; diff --git a/src/drv_maildir.c b/src/drv_maildir.c index 4807e75..47e7874 100644 --- a/src/drv_maildir.c +++ b/src/drv_maildir.c @@ -91,7 +91,7 @@ maildir_parse_flags( const char *base ) flags = 0; if ((s = strstr( base, ":2," ))) - for (s += 3, i = 0; i < as(Flags); i++) + for (s += 3, i = 0; i < ARRAY_SIZE(Flags); i++) if (strchr( s, Flags[i] )) flags |= (1 << i); return flags; @@ -1139,7 +1139,7 @@ maildir_make_flags( int flags, char *buf ) buf[0] = ':'; buf[1] = '2'; buf[2] = ','; - for (d = 3, i = 0; i < as(Flags); i++) + for (d = 3, i = 0; i < ARRAY_SIZE(Flags); i++) if (flags & (1 << i)) buf[d++] = Flags[i]; buf[d] = 0; @@ -1261,7 +1261,7 @@ maildir_set_flags( store_t *gctx, message_t *gmsg, int uid, int add, int del, if ((s = strstr( nbuf + bl, ":2," ))) { s += 3; fl = ol - (s - (nbuf + bl)); - for (i = 0; i < as(Flags); i++) { + for (i = 0; i < ARRAY_SIZE(Flags); i++) { if ((p = strchr( s, Flags[i] ))) { if (del & (1 << i)) { memcpy( p, p + 1, fl - (p - s) ); diff --git a/src/isync.h b/src/isync.h index ef6759e..84f9b84 100644 --- a/src/isync.h +++ b/src/isync.h @@ -26,7 +26,7 @@ #include <stdarg.h> #include <stdio.h> -#define as(ar) (sizeof(ar)/sizeof(ar[0])) +#define ARRAY_SIZE(ar) (sizeof(ar) / sizeof((ar)[0])) #define __stringify(x) #x #define stringify(x) __stringify(x) diff --git a/src/sync.c b/src/sync.c index 9b6dab1..2e87ab4 100644 --- a/src/sync.c +++ b/src/sync.c @@ -71,7 +71,7 @@ parse_flags( const char *buf ) { unsigned flags, i, d; - for (flags = i = d = 0; i < as(Flags); i++) + for (flags = i = d = 0; i < ARRAY_SIZE(Flags); i++) if (buf[d] == Flags[i]) { flags |= (1 << i); d++; @@ -84,7 +84,7 @@ make_flags( int flags, char *buf ) { unsigned i, d; - for (i = d = 0; i < as(Flags); i++) + for (i = d = 0; i < ARRAY_SIZE(Flags); i++) if (flags & (1 << i)) buf[d++] = Flags[i]; buf[d] = 0; -- 1.8.0.2 ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122412 _______________________________________________ isync-devel mailing list isync-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/isync-devel