Hi, just to recap what I said on IRC:
On Thu, Jun 9, 2011 at 6:27 AM, Anton Khirnov <[email protected]> wrote: > +int av_opt_apply_dict(void *obj, AVDictionary **options) [..] > + av_dict_copy(&tmp, *options, 0); [..] > + av_dict_free(options); > + *options = tmp; This isn't a good idea. Imagine a caller being like this: function innocent_caller(AVDictionary *dict, otherargs) { av_opt_apply_dict(&dict, ...); } And guess what: the caller of innocent_caller() is now screwed. I don't see why we need to copy the dict and then free it. All of this smells funny. I expect an API like this: void av_opt_apply_dict(obj *o, (const?) AVDictionary *d); No copies, no frees. If a caller needs something more elaborate than this, like what Stefano says, he can just reproduce the loop in his own code. It's not that long. Also we can always extend the API later on if there's a particular need. We've done that in the past. Ronald _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
