On Wed, May 25, 2016 at 10:39:21AM +0000, Wang Nan wrote:

SNIP

>  
> +static int string_set_value(struct bt_ctf_field *field, const char *string)
> +{
> +     char *buffer;
> +     size_t len = strlen(string), i, p;
> +     int err;
> +
> +     buffer = zalloc(len * 4 + 2);
> +     if (!buffer)
> +             return bt_ctf_field_string_set_value(field, string);

hope dies last ;-)

> +
> +     for (i = p = 0; i < len; i++) {
> +             if (isprint(string[i])) {
> +                     buffer[p++] = string[i];
> +             } else {
> +                     char numstr[5];
> +
> +                     snprintf(numstr, sizeof(numstr), "\\x%02x",
> +                             (unsigned int)(string[i]) & 0xff);
> +                     strncat(buffer, numstr, 4);
> +                     p = strlen(buffer);

                        p += 4; instead ^^^ ?

other than that:

Acked-by: Jiri Olsa <jo...@kernel.org>

thanks,
jirka

Reply via email to