This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
Re: PATCH: Remove strdup use in libgui
- To: Mo DeJong <mdejong at cygnus dot com>
- Subject: Re: PATCH: Remove strdup use in libgui
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Fri, 03 Aug 2001 18:26:01 -0400
- Cc: insight at sources dot redhat dot com
- References: <Pine.SOL.3.91.1010803144824.23102E-100000@cse.cygnus.com>
> - hdata->filename = strdup (argv[2]);
> - hdata->header_filename = strdup (argv[3]);
> + hdata->filename = malloc (strlen (argv[2]) + 1);
> + strcpy (hdata->filename, argv[2]);
> + hdata->header_filename = malloc (strlen (argv[3]) + 1);
> + strcpy (hdata->header_filename, argv[3]);
> return TCL_OK;
Mo, I'm puzzled. Why do this? What is wrong with strdup()?
Andrew