On Thu, 2016-12-15 at 08:54 -0500, Ted Ross wrote: > I have a map, held in a pn_data_t structure. I want to replace the > value of one of the entries in the map with a new value. Is there a > way > to do this in-place or do I need to create a new pn_data_t and copy > the > old into the new, replacing the value I want to replace?
In principle, the current pn_data_t datastructure does allow you to do this by using pn_data_next until you find the element then pn_data_put_xx to replace. There is no path based navigation, although there seems to be (an unused) way to directly search symbols or strings. HOWEVER (big however!) Currently there is *no* code that actually modifies the middle of pn_data_t in place. Code only decodes AMQP data bytes then reads the data structure from the pn_data_t or creates the pn_data_t and writes the bytes. The pn_data_t code is complex and the structure is much larger and more complex (and hance almost certainly slower) than 2 different structures one specialised for read and one for write would be. Given this it has been in mind for a while now to transition the use of pn_data_t to 2 new read and write only structures. So I'd really appreciate it if you just copy the pn_data_t changing the element you need to change on the way! From what I can see of the API this is hardly less time efficient anyway, but may use more space due to needing a pn_data_t to copy into. HTH Andrew --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
