[PATCH:libFS 6/7] Replace malloc(strlen + 1); strcpy() with strdup()

Jasper St. Pierre jstpierre at mecheye.net
Tue Jan 7 21:38:55 PST 2014


Does FSmalloc do anything special, or is it just a wrapper for historical
reasons?


On Tue, Jan 7, 2014 at 7:02 PM, Alan Coopersmith <
alan.coopersmith at oracle.com> wrote:

> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
>  src/FSOpenServ.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/FSOpenServ.c b/src/FSOpenServ.c
> index b8ccb2f..faebe13 100644
> --- a/src/FSOpenServ.c
> +++ b/src/FSOpenServ.c
> @@ -127,10 +127,9 @@ FSOpenServer(const char *server)
>         return (FSServer *) NULL;
>      }
>
> -    if ((svr->server_name = FSmalloc(strlen(server) + 1)) == NULL) {
> +    if ((svr->server_name = strdup(server)) == NULL) {
>         goto fail;
>      }
> -    (void) strcpy(svr->server_name, server);
>
>      if ((svr->trans_conn = _FSConnectServer(svr->server_name)) == NULL) {
>         goto fail;
> --
> 1.7.9.2
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>



-- 
  Jasper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg-devel/attachments/20140108/994463c4/attachment.html>


More information about the xorg-devel mailing list