From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 3FFCB45C304 for ; Tue, 15 Dec 2020 01:54:07 +0300 (MSK) From: Vladislav Shpilevoy References: <20201210161832.729439-1-gorcunov@gmail.com> <20201210161832.729439-2-gorcunov@gmail.com> Message-ID: <78cabca8-0c39-92a6-61e9-7faa77f71c6a@tarantool.org> Date: Mon, 14 Dec 2020 23:54:04 +0100 MIME-Version: 1.0 In-Reply-To: <20201210161832.729439-2-gorcunov@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH v4 1/4] util: introduce strlcpy helper List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cyrill Gorcunov , tml Cc: Mons Anderson 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. >