+2001-08-03 Mo DeJong <mdejong@redhat.com>
+
+ * src/subcommand.c:
+ * src/tclgetdir.c:
+ * src/tclhelp.c:
+ * src/tclmain.c:
+ * src/tclmsgbox.c:
+ * src/tclsizebox.c:
+ * src/tclwinmode.c:
+ * src/tclwinpath.c:
+ * src/tclwinprint.c:
+ * src/tkWinPrintCanvas.c:
+ * src/tkWinPrintText.c:
+ Use ckalloc/ckfree instead of Tcl_Alloc/Tcl_Free
+ or malloc/free so that allocations will
+ be marked with file positions when Tcl mem
+ debug is activated.
+
2001-08-02 Mo DeJong <mdejong@redhat.com>
* src/tkWinPrintCanvas.c (PrintCanvasCmd):
if (data->delete)
(*data->delete) (data->subdata);
- Tcl_Free ((char *) data);
+ ckfree ((char *) data);
}
/* This function implements any Tcl command registered as having
}
}
- data = (struct subcommand_clientdata *) Tcl_Alloc (sizeof *data);
+ data = (struct subcommand_clientdata *) ckalloc (sizeof *data);
data->commands = table;
data->subdata = subdata;
data->delete = delete;
re-eval. This is a lot less efficient, but it doesn't really
matter. */
- new_args = (char **) Tcl_Alloc ((argc + 2) * sizeof (char *));
+ new_args = (char **) ckalloc ((argc + 2) * sizeof (char *));
new_args[0] = "tk_getOpenFile";
new_args[1] = "-choosedir";
merge = Tcl_Merge (argc + 2, new_args);
result = Tcl_GlobalEval (interp, merge);
- Tcl_Free (merge);
- Tcl_Free ((char *) new_args);
+ ckfree (merge);
+ ckfree ((char *) new_args);
return result;
}
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
{
struct help_command_data *hdata = (struct help_command_data *) cd;
- hdata->filename = malloc (strlen (argv[2]) + 1);
+ hdata->filename = ckalloc (strlen (argv[2]) + 1);
strcpy (hdata->filename, argv[2]);
- hdata->header_filename = malloc (strlen (argv[3]) + 1);
+ hdata->header_filename = ckalloc (strlen (argv[3]) + 1);
strcpy (hdata->header_filename, argv[3]);
return TCL_OK;
}
{
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;
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)
- free (hdata->help_dir);
+ 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. */
{
struct help_command_data *hdata = (struct help_command_data *) cd;
- hdata->filename = malloc (strlen (argv[2]) + 1);
+ hdata->filename = ckalloc (strlen (argv[2]) + 1);
strcpy (hdata->filename, argv[2]);
- hdata->header_filename = malloc (strlen (argv[3]) + 1);
+ hdata->header_filename = ckalloc (strlen (argv[3]) + 1);
strcpy (hdata->header_filename, argv[3]);
- hdata->help_dir = malloc (strlen (argv[4]) + 1);
+ hdata->help_dir = ckalloc (strlen (argv[4]) + 1);
strcpy (hdata->help_dir, argv[4]);
return TCL_OK;
}
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)
{
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;
args = Tcl_Merge (argc - 1, argv + 1);
Tcl_SetVar (interp, "argv", args, TCL_GLOBAL_ONLY);
- Tcl_Free (args);
+ ckfree (args);
sprintf (buf, "%d", argc-1);
Tcl_SetVar (interp, "argc", buf, TCL_GLOBAL_ONLY);
return DefWindowProc (hwnd, message, wparam, lparam);
/* Queue up a Tcl event. */
- me = (struct msgbox_event *) Tcl_Alloc (sizeof *me);
+ me = (struct msgbox_event *) ckalloc (sizeof *me);
me->header.proc = msgbox_eventproc;
me->md = (struct msgbox_data *) lparam;
Tcl_QueueEvent ((Tcl_Event *) me, TCL_QUEUE_TAIL);
/* We are now done with the msgbox_data structure, so we can free
the fields and the structure itself. */
- Tcl_Free (me->md->code);
- Tcl_Free (me->md->message);
- Tcl_Free (me->md->title);
- Tcl_Free ((char *) me->md);
+ ckfree (me->md->code);
+ ckfree (me->md->message);
+ ckfree (me->md->title);
+ ckfree ((char *) me->md);
if (ret != TCL_OK)
Tcl_BackgroundError (me->md->interp);
msgbox_init ();
- md = (struct msgbox_data *) Tcl_Alloc (sizeof *md);
+ md = (struct msgbox_data *) ckalloc (sizeof *md);
md->interp = interp;
- md->code = Tcl_Alloc (strlen (code) + 1);
+ md->code = ckalloc (strlen (code) + 1);
strcpy (md->code, code);
md->hidden_hwnd = hidden_hwnd;
md->hwnd = hWnd;
- md->message = Tcl_Alloc (strlen (message) + 1);
+ md->message = ckalloc (strlen (message) + 1);
strcpy (md->message, message);
- md->title = Tcl_Alloc (strlen (title) + 1);
+ md->title = ckalloc (strlen (title) + 1);
strcpy (md->title, title);
md->flags = flags | modal;
su = (struct sizebox_userdata *) GetWindowLong (hwnd, GWL_USERDATA);
SetWindowLong (hwnd, GWL_USERDATA, 0);
SetWindowLong (hwnd, GWL_WNDPROC, (LONG) su->wndproc);
- Tcl_Free ((char *) su);
+ ckfree ((char *) su);
DestroyWindow (hwnd);
}
}
pt.x, pt.y, Tk_Width (tkwin), Tk_Height (tkwin),
parhwnd, NULL, Tk_GetHINSTANCE (), NULL);
- su = (struct sizebox_userdata *) Tcl_Alloc (sizeof *su);
+ su = (struct sizebox_userdata *) ckalloc (sizeof *su);
su->tkwin = tkwin;
su->wndproc = (WNDPROC) GetWindowLong (hwnd, GWL_WNDPROC);
SetWindowLong (hwnd, GWL_USERDATA, (LONG) su);
{
Tcl_AppendResult (interp, "unrecognized key \"", list[i],
"\"", (char *) NULL);
- Tcl_Free ((char *) list);
+ ckfree ((char *) list);
return TCL_ERROR;
}
}
- Tcl_Free ((char *) list);
+ ckfree ((char *) list);
val = SetErrorMode (val);
char *buf;
size = cygwin32_posix_to_win32_path_list_buf_size (argv[2]);
- buf = Tcl_Alloc (size);
+ buf = ckalloc (size);
cygwin32_posix_to_win32_path_list (argv[2], buf);
Tcl_SetResult (interp, buf, TCL_DYNAMIC);
return TCL_OK;
char *buf;
size = cygwin32_win32_to_posix_path_list_buf_size (argv[2]);
- buf = Tcl_Alloc (size);
+ buf = ckalloc (size);
cygwin32_win32_to_posix_path_list (argv[2], buf);
Tcl_SetResult (interp, buf, TCL_DYNAMIC);
return TCL_OK;
{
/* FIXME: I don't know if we are supposed to free the hDevMode
and hDevNames fields. */
- Tcl_Free ((char *) wd->page_setup);
+ ckfree ((char *) wd->page_setup);
}
- Tcl_Free ((char *) wd);
+ ckfree ((char *) wd);
}
/* Implement ide_winprint page_setup. */
}
if (wd->page_setup == NULL)
- wd->page_setup = (PAGESETUPDLG *) Tcl_Alloc (sizeof (PAGESETUPDLG));
+ wd->page_setup = (PAGESETUPDLG *) ckalloc (sizeof (PAGESETUPDLG));
*wd->page_setup = psd;
{
struct winprint_data *wd;
- wd = (struct winprint_data *) Tcl_Alloc (sizeof *wd);
+ wd = (struct winprint_data *) ckalloc (sizeof *wd);
wd->page_setup = NULL;
wd->aborted = 0;
int tiles_wide,tiles_high;
int tile_y, tile_x;
int screenX1, screenX2, screenY1, screenY2, width, height;
- DOCINFO *lpdi = malloc(sizeof(DOCINFO));
+ DOCINFO *lpdi = (DOCINFO *) ckalloc(sizeof(DOCINFO));
if (argc < 2) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
memset(lpdi,0,sizeof(DOCINFO));
lpdi->cbSize=sizeof(DOCINFO);
- lpdi->lpszDocName=malloc(255);
+ lpdi->lpszDocName= (LPCSTR) ckalloc(255);
sprintf((char*)lpdi->lpszDocName,"SN - Printing\0");
lpdi->lpszOutput=NULL;
EndDoc(pd.hDC);
done:
- free ((char*) lpdi->lpszDocName);
- free (lpdi);
+ ckfree ((char*) lpdi->lpszDocName);
+ ckfree ((char*) lpdi);
return TCL_OK;
error:
- free ((char*) lpdi->lpszDocName);
- free (lpdi);
+ ckfree ((char*) lpdi->lpszDocName);
+ ckfree ((char*) lpdi);
return TCL_ERROR;
}
Pixmap pixmap;
int bottomY = 0; /* Initialization needed only to stop
* compiler warnings. */
- DOCINFO *lpdi = malloc(sizeof(DOCINFO));
+ DOCINFO *lpdi = (DOCINFO *) ckalloc(sizeof(DOCINFO));
TkTextIndex first, last;
int numLines;
HDC hDCpixmap;
memset(lpdi,0,sizeof(DOCINFO));
lpdi->cbSize=sizeof(DOCINFO);
- lpdi->lpszDocName=malloc(255);
+ lpdi->lpszDocName = (LPCSTR) ckalloc(255);
sprintf((char*)lpdi->lpszDocName,"SN - Printing\0");
lpdi->lpszOutput=NULL;
textPtr->dInfoPtr->flags|=DINFO_OUT_OF_DATE;
done:
- free ((char*) lpdi->lpszDocName);
- free (lpdi);
+ ckfree ((char*) lpdi->lpszDocName);
+ ckfree ((char*) lpdi);
return TCL_OK;
error:
- free ((char*) lpdi->lpszDocName);
- free (lpdi);
+ ckfree ((char*) lpdi->lpszDocName);
+ ckfree ((char*) lpdi);
return TCL_ERROR;
}