On Wed, Feb 14, 2018 at 06:40:44PM +0100, Cédric Bosdonnat wrote:
+static char * +to_utf8 (guestfs_h *g, char *input)
What you might want to do to simplify this is to factor out the function local_string_to_utf8 from common/utils/libxml2-utils.c. First patch would move local_string_to_utf8 into common/utils/utils.c (making it non-static). Unfortunately there's a small difference in error handling, because your function is calling perrorf, and functions in common/utils/utils.c are not allowed to use the guestfs handle. However it's not a huge problem, you'll just have to call perrorf() from the caller in this file, ie here:
+ /* Try (not too hard) to get UTF-8 */ + if (summary_raw) + summary = to_utf8(g, summary_raw); ^^^ space + if (description_raw) + description = to_utf8(g, description_raw); ^^^ space
The rest of the patch looks fine to me. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW