On Mon, Jan 21, 2013 at 1:11 AM, Enlightenment SVN
<[email protected]> wrote:
> +#define EINA_COW_WRITE_BEGIN(Cow, Read, Write_Type, Write)             \
> +  do                                                                   \
> +    {                                                                  \
> +      Write_Type *Write;                                               \
> +                                                                       \
> +      Write = eina_cow_write(Cow, ((const Eina_Cow_Data**)&(Read)));
> +
> +#define EINA_COW_WRITE_END(Cow, Read, Write)                           \
> +      eina_cow_done(Cow, ((const Eina_Cow_Data**)&(Read)), Write);     \
> +    }                                                                  \
> +  while (0);
> +

Found a (possibly) better way to perform this without pesky BEGIN/END macros:

#define EINA_COW_WRITE(Cow, Read, Write) \
   for (eina_cow_write(Cow, ((const Eina_Cow_Data**)&(Read))); \
        eina_cow_is_done_writing(Cow); \
        eina_cow_done(Cow, ((const Eina_Cow_Data**)&(Read)), Write))

You'll have to declare the variable outside, but the usage ends up
being a lot simpler:

int r, w;

EINA_COW_WRITE(cow, r, w)
   {
       do_whatever(r);
       do_another_thing(w);
   }

Not sure how to implement eina_cow_is_done_writing(), though. Any clues?


    Leandro

------------------------------------------------------------------------------
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. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to