OSDN Git Service

* src/subcommand.c:
authormdejong <mdejong>
Fri, 3 Aug 2001 23:01:54 +0000 (23:01 +0000)
committermdejong <mdejong>
Fri, 3 Aug 2001 23:01:54 +0000 (23:01 +0000)
* 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.

12 files changed:
libgui/ChangeLog
libgui/src/subcommand.c
libgui/src/tclgetdir.c
libgui/src/tclhelp.c
libgui/src/tclmain.c
libgui/src/tclmsgbox.c
libgui/src/tclsizebox.c
libgui/src/tclwinmode.c
libgui/src/tclwinpath.c
libgui/src/tclwinprint.c
libgui/src/tkWinPrintCanvas.c
libgui/src/tkWinPrintText.c

index 0e7c81c..aa2985c 100644 (file)
@@ -1,3 +1,21 @@
+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):
index 29e7ea1..2ec51d3 100644 (file)
@@ -26,7 +26,7 @@ subcommand_deleted (ClientData cd)
 
   if (data->delete)
     (*data->delete) (data->subdata);
-  Tcl_Free ((char *) data);
+  ckfree ((char *) data);
 }
 
 /* This function implements any Tcl command registered as having
@@ -113,7 +113,7 @@ ide_create_command_with_subcommands (Tcl_Interp *interp, char *name,
        }
     }
 
-  data = (struct subcommand_clientdata *) Tcl_Alloc (sizeof *data);
+  data = (struct subcommand_clientdata *) ckalloc (sizeof *data);
   data->commands = table;
   data->subdata = subdata;
   data->delete = delete;
index 7d70aef..f3b662f 100644 (file)
@@ -237,7 +237,7 @@ get_directory_command (ClientData cd, Tcl_Interp *interp, int argc,
      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";
@@ -249,8 +249,8 @@ get_directory_command (ClientData cd, Tcl_Interp *interp, int argc,
   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;
 }
index d0a2355..8603b69 100644 (file)
@@ -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,9 +223,9 @@ help_initialize_command (ClientData cd, Tcl_Interp *interp, int argc,
 {
   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;
 }
@@ -348,7 +348,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;
@@ -389,16 +389,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)
-    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.  */
@@ -409,11 +409,11 @@ help_initialize_command (ClientData cd, Tcl_Interp *interp, int argc,
 {
   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;
 }
@@ -434,7 +434,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)
@@ -567,7 +567,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;
index 1a96254..28c2b8e 100644 (file)
@@ -47,7 +47,7 @@ ide_main (int argc, char *argv[], Tcl_AppInitProc *appInitProc)
 
   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);
index 8db081f..918363b 100644 (file)
@@ -155,7 +155,7 @@ msgbox_wndproc (HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
     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);
@@ -202,10 +202,10 @@ msgbox_eventproc (Tcl_Event *event, int flags)
 
   /* 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);
@@ -401,15 +401,15 @@ msgbox_internal (ClientData clientData, Tcl_Interp *interp, int argc,
 
       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;
 
index 9a8d305..c10e2e3 100644 (file)
@@ -112,7 +112,7 @@ sizebox_event_proc (ClientData cd, XEvent *event_ptr)
       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);
     }
 }
@@ -149,7 +149,7 @@ sizebox_create (Tk_Window tkwin, Window parent, ClientData cd)
                       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);
index 958d5c9..69c6c80 100644 (file)
@@ -61,11 +61,11 @@ seterrormode_command (ClientData cd, Tcl_Interp *interp,
        {
          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);
 
index 2f9d5bd..ce75ab0 100644 (file)
@@ -133,7 +133,7 @@ path_posix_to_win32_path_list (ClientData cd, Tcl_Interp *interp, int argc,
   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;
@@ -149,7 +149,7 @@ path_win32_to_posix_path_list (ClientData cd, Tcl_Interp *interp, int argc,
   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;
index 221cc14..0284349 100644 (file)
@@ -126,10 +126,10 @@ winprint_command_deleted (ClientData cd)
     {
       /* 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.  */
@@ -216,7 +216,7 @@ winprint_page_setup_command (ClientData cd, Tcl_Interp *interp, int argc,
     }
 
   if (wd->page_setup == NULL)
-    wd->page_setup = (PAGESETUPDLG *) Tcl_Alloc (sizeof (PAGESETUPDLG));
+    wd->page_setup = (PAGESETUPDLG *) ckalloc (sizeof (PAGESETUPDLG));
 
   *wd->page_setup = psd;
 
@@ -916,7 +916,7 @@ ide_create_winprint_command (Tcl_Interp *interp)
 {
   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;
   
index 0dbf92e..029c668 100644 (file)
@@ -52,7 +52,7 @@ PrintCanvasCmd(clientData, interp, argc, argv)
     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 \"",
@@ -74,7 +74,7 @@ PrintCanvasCmd(clientData, interp, argc, argv)
 
     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;
 
@@ -164,12 +164,12 @@ PrintCanvasCmd(clientData, interp, argc, argv)
     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;
 }
 
index 6f4accf..88ed8b8 100644 (file)
@@ -249,7 +249,7 @@ PrintTextCmd(clientData, interp, argc, argv)
     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;
@@ -291,7 +291,7 @@ PrintTextCmd(clientData, interp, argc, argv)
 
     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;
 
@@ -446,12 +446,12 @@ PrintTextCmd(clientData, interp, argc, argv)
     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;
 }