On Aug 15, 2014, at 11:23 AM, Alan M. Carroll <a...@network-geographics.com> 
wrote:

> This came up yesterday on the IRC. The problem is that every call to 
> TSMimeHdrFieldNext allocates a MIME field handle which gets very slow if you 
> use the function heavily. One suggested approach was to switch the allocator 
> from a global to a per thread.
> 
> I think it might be better to add TSMimeHdrFieldHandleNext() which updates 
> the MIME field handle in place. Does this seem like a reasonable API addition?
> 


Hmmm, I don’t think I’ve ever used this API. Reading the comment, it even asks 
“Why would anyone use this?”… :) Looking at our code, we use it very sparingly, 
and perhaps even wrongly in a few cases (the typically used API is 
TSMimeHdrFieldNextDup() ).

Is the goal here to iterate over all headers? If so, maybe some sort of 
iterator functionality would be more appropriate, similar to how we added the 
iterator (with a callback) for lib records (i.e. TSRecordDump() )? Can that 
help simplifying / improve such operations?

Cheers,

— Leif

Reply via email to