On Wed, Aug 27, 2014 at 11:03 AM, David Woodhouse <dwmw2 at infradead.org> wrote: >> So you mean to keep openconnect_strdup() and rename it to >> openconnect_set_form_field()? If combined with your earlier proposal >> to change ABI and have the main functions clean of any allocation it >> would be pretty ok. > Well, it wouldn't just be a rename of the function. It would actually > *set* the field. The caller wouldn't do the direct assignment to > opt->value, but would call a function such as: > openconnect_set_option_value(struct oc_form_opt *opt, const char *value); > > I might even *rename* opt->value, to make sure they use the function. Or > maybe even make 'struct oc_form_opt' an opaque structure and make them > do *everything* with accessor functions. > And then yes, the whole API would all be clean of any allocation; no > strings would need to cross the boundary between libraries. Which not > only fixes the Windows situation but is also a fairly nice cleanup. I > think that's probably worth an ABI break, and I can probably fix it up > with wrappers to provide compatibility with the previous soname, like I > did once for libopenconnect.so.1 after libopenconnect.so.2 was > introduced. Some proposed changes attached. They are not thoroughly tested, but demonstrate the idea. regards, Nikos -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-do-not-take-ownership-of-any-of-the-provided-strings.patch Type: text/x-diff Size: 10517 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/openconnect-devel/attachments/20140827/a5e511ac/attachment-0002.bin> -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-define-openconnect_set_option_value-to-set-the-value.patch Type: text/x-diff Size: 6939 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/openconnect-devel/attachments/20140827/a5e511ac/attachment-0003.bin>