coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] maint: prohibit use of strncpy


From: Eric Blake
Subject: Re: [PATCH] maint: prohibit use of strncpy
Date: Fri, 25 May 2012 08:31:30 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

On 05/24/2012 08:23 AM, Jim Meyering wrote:
> The use of strncpy is so seldom justifiable, that it is best
> just to avoid it altogether.  Thus, we should enforce that:
> 
>>From 22695d676de21d0af6d50ca8218eeb49b45608ab Mon Sep 17 00:00:00 2001
> From: Jim Meyering <address@hidden>
> Date: Thu, 24 May 2012 16:21:34 +0200
> Subject: [PATCH] maint: prohibit use of strncpy
> 
> * cfg.mk (sc_prohibit_strncpy): New syntax-check rule.
> Exempt pinky.c and who.c, at least for now.
> ---
>  cfg.mk | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/cfg.mk b/cfg.mk
> index 7a86c2a..ff5d996 100644
> --- a/cfg.mk
> +++ b/cfg.mk
> @@ -403,6 +403,12 @@ sc_prohibit_strncmp:
>         { echo '$(ME): use STREQ_LEN or STRPREFIX instead of str''ncmp' \
>               1>&2; exit 1; } || :
> 
> +# Really.  You don't want to use this function.
> +sc_prohibit_strncpy:
> +     @prohibit='\<str''ncpy *\('                                     \
> +     halt='do not use str''ncpy, period'                             \
> +       $(_sc_search_regexp)


This seems like it is worth floating into gnulib's maint.mk.

-- 
Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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