24-03-2009 Dominique Pelle <[email protected]>:
> 
> Some remarks (besides what Andreas already mentioned):
> 
>   STRNCPY(NameBuff, bname, MAXPATHL);
> 
> ... could be written safer as:
> 
>   vim_strncpy(NameBuff, bname, MAXPATHL - 1);

Done.

> 2/ I see several times things like this:
> 
>   if (bname)
>      vim_free(bname);
> 
> The test for NULL pointer can safely be removed, i.e. just write:
> 
>   vim_free(bname);
> 
> ... since vim_free(...) takes care of testing for NULL pointer.
> 
> Even standard C function free() do nothing if pointer is NULL
> by the way (at least on Linux, not sure how portable this is).
> Quoting "man 3 free":
> 
>   "If ptr is NULL, no operation is performed."

As a matter of fact, such behaviour is guaranteed by the C standard (C89
AFAIR). However, my feeling was that Vim's source code does not rely on
any compiler being standard compliant. Plus I did not have a look at
what's inside vim_free(). My fault.

Thank you for your suggestions + the documentation patch.

Waiting for more comments.

-- 
Cheers,
Lech

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui