Hi,
before I file a bug I would like to ask whether I'm missing anything
here. I thought I'll use this code snippet:

-------------------------------------------------------------------
   struct SPropTagArray *array;

   array = talloc_zero (mem_ctx, struct SPropTagArray);
   if (a)
      SPropTagArray_add (mem_ctx, array, PidTag...);
   if (b)
      SPropTagArray_add (mem_ctx, array, PidTag...);

-------------------------------------------------------------------

but it doesn't work, my PidTag is not added. I checked the content of
SPropTagArray_add() and it tests whether the array is not empty, and when
it is it claims the array is invalid. I do not think it's an issue, just
the opposite, as it's quite useful to be able to create an empty array
and fill it later on demand, rather then workaround it like this:

-------------------------------------------------------------------
   struct SPropTagArray *array = NULL;

   #define add(x) {\
      if (!array) \
         array = set_SPropTagArray (mem_ctx, 0x1, x); \
      else \
         SPropTagArray_add (mem_ctx, array, x); } \

   if (a)
      add (PidTag...);
   if (b)
      add (PidTag...);

   #undef add

   if (!array)
      array = talloc_zero (mem_ctx, struct SPropTagArray);

-------------------------------------------------------------------


Do  I miss anything here? Because when I remove the test from
SPropTagArray_add() then it works as expected, as far as I can tell.
        Thanks and bye,
        Milan

_______________________________________________
devel mailing list
devel@lists.openchange.org
http://mailman.openchange.org/listinfo/devel

Reply via email to