[libvirt] [PATCH 3/3] vsh: remove namespace poisoning

Laine Stump laine at laine.org
Mon Jun 20 18:01:20 UTC 2016


On 06/20/2016 11:28 AM, Ján Tomko wrote:
> We already have a syntax-check to prohibit direct use of these
> allocation functions.

Yep. This was added in commit d9adac in 2010, well before we had such 
syntax rules, but it's pointless now.

ACK.

> ---
>   tools/vsh.c |  6 ------
>   tools/vsh.h | 10 ----------
>   2 files changed, 16 deletions(-)
>
> diff --git a/tools/vsh.c b/tools/vsh.c
> index 8649305..2b78919 100644
> --- a/tools/vsh.c
> +++ b/tools/vsh.c
> @@ -71,9 +71,6 @@
>   const vshCmdGrp *cmdGroups;
>   const vshCmdDef *cmdSet;
>   
> -/* Bypass header poison */
> -#undef strdup
> -
>   
>   /* simple handler for oom conditions */
>   static void
> @@ -164,9 +161,6 @@ _vshStrdup(vshControl *ctl, const char *s, const char *filename, int line)
>       exit(EXIT_FAILURE);
>   }
>   
> -/* Poison the raw allocating identifiers in favor of our vsh variants.  */
> -#define strdup use_vshStrdup_instead_of_strdup
> -
>   int
>   vshNameSorter(const void *a, const void *b)
>   {
> diff --git a/tools/vsh.h b/tools/vsh.h
> index f738a6f..8d67397 100644
> --- a/tools/vsh.h
> +++ b/tools/vsh.h
> @@ -453,16 +453,6 @@ char *_vshStrdup(vshControl *ctl, const char *s, const char *filename,
>                    int line);
>   # define vshStrdup(_ctl, _s)    _vshStrdup(_ctl, _s, __FILE__, __LINE__)
>   
> -/* Poison the raw allocating identifiers in favor of our vsh variants.  */
> -# undef malloc
> -# undef calloc
> -# undef realloc
> -# undef strdup
> -# define malloc use_vshMalloc_instead_of_malloc
> -# define calloc use_vshCalloc_instead_of_calloc
> -# define realloc use_vshRealloc_instead_of_realloc
> -# define strdup use_vshStrdup_instead_of_strdup
> -
>   /* Macros to help dealing with mutually exclusive options. */
>   
>   /* VSH_EXCLUSIVE_OPTIONS_EXPR:





More information about the libvir-list mailing list