[Tarantool-patches] [PATCH v4 1/4] util: introduce strlcpy helper

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Tue Dec 15 01:54:04 MSK 2020


Hi! Thanks for the patch!

> diff --git a/src/trivia/util.h b/src/trivia/util.h
> index da5a3705e..8dcc48ada 100644
> --- a/src/trivia/util.h
> +++ b/src/trivia/util.h
> @@ -450,6 +450,21 @@ fpconv_strtod(const char *nptr, char **endptr)
>  	return strtod(nptr, endptr);
>  }
>  
> +#ifndef HAVE_STRLCPY
> +/**
> + * Copy string. Unlike \a strncpy the result string

Please, use @, not \. We use it in all new code.
https://github.com/tarantool/tarantool/wiki/Code-review-procedure#code-style

> + * is always null-terminated.
> + *
> + * @param dst destination buffer.
> + * @param src source string.
> + * @param size destination buffer size.
> + *
> + * @return size of \a src string.
> + */
> +size_t
> +strlcpy(char *dst, const char *src, size_t size);
> +#endif
> +
>  /**
>   * Check that @a str is valid utf-8 sequence and can be printed
>   * unescaped.
> 


More information about the Tarantool-patches mailing list