Il 17/10/2012 14:56, Markus Armbruster ha scritto: > Duplicates error_set() code without need. How about: > > void error_set_errno(Error **errp, int os_errno, ErrorClass err_class, > const char *fmt, ...) > { > char *msg; > > va_start(ap, fmt); > msg = g_strdup_printf(fmt, ap); > va_end(ap); > if (os_errno) { > error_set(errp, err_class, "%s: %s", msg, strerror(os_errno)); > } else { > error_set(errp, err_class, "%s", msg); > } > g_free(msg); > } > > Sketch, not even compile-tested. > > Or the other way round, implement error_set() in terms of the more > general error_set_errno(): > > void error_set(Error **errp, ErrorClass err_class, const char *fmt, ...) > { > error_set(errp, err_class, 0, fmt, ...); > } > > Except that's not C; real code needs verror_set_errno(). > > As usual, every variadic function sooner or later needs a buddy that > takes a va_list instead.
Indeed... lazy me. Added to my todo list. Paolo