This is the mail archive of the insight@sources.redhat.com mailing list for the Insight project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: Remove strdup use in libgui


Hi all.

Here is a little change I checked into src/tclhelp.c that gets
rid of the last use of strcpy in libgui. This should not change
the functionality of any code in Insight.

cheers
Mo

2001-08-02  Mo DeJong  <mdejong@redhat.com>

	* config.h.in: Regen.
	* configure: Regen.
	* configure.in: Don't check for strdup since it
	is no longer used in libgui.
	* src/tclhelp.c (help_initialize_command): Replace
	use of strdup with calls to malloc and strcpy.

Index: configure.in
===================================================================
RCS file: /cvs/src/src/libgui/configure.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- configure.in        2001/04/10 20:08:25     1.3
+++ configure.in        2001/08/02 21:48:17     1.4
@@ -15,7 +15,7 @@
 
 AC_FUNC_ALLOCA
 AC_HAVE_HEADERS(stddef.h stdlib.h getopt.h unistd.h fcntl.h sys/file.h sys/wait.h string.h strings.h)
-AC_CHECK_FUNCS(raise strdup)
+AC_CHECK_FUNCS(raise)
 
 AC_ARG_ENABLE(ide, [  --enable-ide            Enable IDE support],
 [case "${enableval}" in
Index: tclhelp.c
===================================================================
RCS file: /cvs/src/src/libgui/src/tclhelp.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- tclhelp.c   2001/08/02 21:12:52     1.2
+++ tclhelp.c   2001/08/02 21:48:17     1.3
@@ -223,8 +223,10 @@
 {
   struct help_command_data *hdata = (struct help_command_data *) cd;
 
-  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;
 }
 
@@ -407,9 +409,12 @@
 {
   struct help_command_data *hdata = (struct help_command_data *) cd;
 
-  hdata->filename = strdup (argv[2]);
-  hdata->header_filename = strdup (argv[3]);
-  hdata->help_dir = strdup (argv[4]);
+  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]);
+  hdata->help_dir = malloc (strlen (argv[4]) + 1);
+  strcpy (hdata->help_dir, argv[4]);
   return TCL_OK;
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]