Hi, 2012/8/1 Charles, Daniel <daniel.char...@intel.com>:
>> No need to change anything in this hunk. > > ok, I guess you want to keep indentation here. Hmmm, yes, but also because it's not related to what this patch was about. :) >>> diff --git a/va/va.c b/va/va.c >>> index 1bbe047..6adf821 100644 >>> --- a/va/va.c >>> +++ b/va/va.c >>> @@ -105,21 +105,24 @@ int vaDisplayIsValid(VADisplay dpy) >>> >>> void va_errorMessage(const char *msg, ...) >>> { >>> + char buffer[1024]; >>> va_list args; >>> >>> - fprintf(stderr, "libva error: "); >>> va_start(args, msg); >>> - vfprintf(stderr, msg, args); >>> + vsnprintf(buffer, 1024, msg, args); >> >> Several errors: use sizeof, and check return value. If undersized, >> allocate a new buffer. >> Same for va_infoMessage(). > > Someone recommended offline to use vasnprintf, it will avoid check > plus re-allocate, the chances to re-size are really high here. vasnprintf() is still a GNU libc extension IIRC. Please stick to vsnprintf() with local buffer (up to 512 or 1024 bytes) + dynamic buffer if needed. The former will cover most cases so that you avoid memory allocation (and deallocation). Thanks, Gwenole. _______________________________________________ Libva mailing list Libva@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libva