summaryrefslogtreecommitdiff
path: root/libgui/src/tclhelp.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgui/src/tclhelp.c')
-rw-r--r--libgui/src/tclhelp.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/libgui/src/tclhelp.c b/libgui/src/tclhelp.c
index 199cff77d2e..d3f057a145e 100644
--- a/libgui/src/tclhelp.c
+++ b/libgui/src/tclhelp.c
@@ -109,12 +109,12 @@ help_command_deleted (ClientData cd)
Tcl_DeleteExitHandler (help_command_atexit, cd);
if (hdata->filename != NULL)
- free (hdata->filename);
+ ckfree (hdata->filename);
if (hdata->header_filename != NULL)
- free (hdata->header_filename);
+ ckfree (hdata->header_filename);
if (hdata->hash_initialized)
Tcl_DeleteHashTable (&hdata->topic_hash);
- Tcl_Free ((char *) hdata);
+ ckfree ((char *) hdata);
}
/* Initialize the help system: choose a window, and set up the topic
@@ -223,8 +223,10 @@ help_initialize_command (ClientData cd, Tcl_Interp *interp, int argc,
{
struct help_command_data *hdata = (struct help_command_data *) cd;
- hdata->filename = strdup (argv[2]);
- hdata->header_filename = strdup (argv[3]);
+ hdata->filename = ckalloc (strlen (argv[2]) + 1);
+ strcpy (hdata->filename, argv[2]);
+ hdata->header_filename = ckalloc (strlen (argv[3]) + 1);
+ strcpy (hdata->header_filename, argv[3]);
return TCL_OK;
}
@@ -301,7 +303,8 @@ help_display_file_command (ClientData cd, Tcl_Interp *interp, int argc, char **a
{
struct help_command_data *hdata = (struct help_command_data *) cd;
FILE *e;
- DWORD topic_id = 0; /* default topic id is 0 which brings up the find dialog */
+ int id = 0;
+ DWORD topic_id; /* default topic id is 0 which brings up the find dialog */
/* We call Help initialize just to make sure the window handle is setup */
/* We don't care about the finding the main help file and checking the */
@@ -322,10 +325,11 @@ help_display_file_command (ClientData cd, Tcl_Interp *interp, int argc, char **a
fclose (e);
if (argc > 3)
{
- if ( Tcl_GetInt (interp, argv[3], &topic_id) != TCL_OK )
+ if ( Tcl_GetInt (interp, argv[3], &id) != TCL_OK )
return TCL_ERROR;
}
+ topic_id = (DWORD) id;
if (! WinHelp (hdata->window, argv[2], HELP_CONTEXT, topic_id))
{
char buf[200];
@@ -346,7 +350,7 @@ hdata_initialize ()
{
struct help_command_data *hdata;
- hdata = (struct help_command_data *) Tcl_Alloc (sizeof *hdata);
+ hdata = (struct help_command_data *) ckalloc (sizeof *hdata);
hdata->filename = NULL;
hdata->header_filename = NULL;
@@ -387,14 +391,16 @@ help_command_deleted (ClientData cd)
struct help_command_data *hdata = (struct help_command_data *) cd;
if (hdata->filename != NULL)
- free (hdata->filename);
+ ckfree (hdata->filename);
if (hdata->header_filename != NULL)
- free (hdata->header_filename);
+ ckfree (hdata->header_filename);
+ if (hdata->help_dir != NULL)
+ ckfree (hdata->help_dir);
if (hdata->hash_initialized)
Tcl_DeleteHashTable (&hdata->topic_hash);
if (hdata->memory_block != NULL)
- free (hdata->memory_block);
- Tcl_Free ((char *) hdata);
+ ckfree (hdata->memory_block);
+ ckfree ((char *) hdata);
}
/* Implement the ide_help initialize command. */
@@ -405,9 +411,12 @@ help_initialize_command (ClientData cd, Tcl_Interp *interp, int argc,
{
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 = ckalloc (strlen (argv[2]) + 1);
+ strcpy (hdata->filename, argv[2]);
+ hdata->header_filename = ckalloc (strlen (argv[3]) + 1);
+ strcpy (hdata->header_filename, argv[3]);
+ hdata->help_dir = ckalloc (strlen (argv[4]) + 1);
+ strcpy (hdata->help_dir, argv[4]);
return TCL_OK;
}
@@ -427,7 +436,7 @@ help_initialize (Tcl_Interp *interp, struct help_command_data *hdata)
FILE *e;
char buf[200], *block_start;
- block_start = hdata->memory_block = malloc(6000);
+ block_start = hdata->memory_block = ckalloc(6000);
e = fopen (hdata->header_filename, "r");
if (e == NULL)
@@ -560,7 +569,7 @@ hdata_initialize ()
{
struct help_command_data *hdata;
- hdata = (struct help_command_data *) Tcl_Alloc (sizeof *hdata);
+ hdata = (struct help_command_data *) ckalloc (sizeof *hdata);
hdata->filename = NULL;
hdata->help_dir = NULL;