[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new module 'strlcpy'

From: Paul Eggert
Subject: Re: new module 'strlcpy'
Date: Wed, 27 Sep 2017 16:27:01 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

I'd really rather not promote the use of strlcpy in GNU code, as it is contrary to GNU style. Plus, I'm not a fan of __warn_unused_result__; in my experience it's too often more trouble than it's worth, and I expect this trouble would occur with strlcpy if we started using it.

That being said, I take your point that I should not have used strncpy to pacify GCC in that test case: I plead guilty to being lazy because the test-case code already has arbitrary limits.

Anyway, strlcpy is overkill here, as snprintf does the job just as well here, and is already standard and supported by Gnulib. So I propose the attached simpler patch instead.

Attachment: 0001-duplocale-tests-use-snprintf-not-strncpy.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]