1 --- tclreadline.c 2000-09-20 13:44:34.000000000 -0400
2 +++ tclreadline_fix.c 2006-06-07 13:13:49.000000000 -0400
4 static const char* tclrl_version_str = TCLRL_VERSION_STR;
5 static const char* tclrl_patchlevel_str = TCLRL_PATCHLEVEL_STR;
7 -#define MALLOC(size) Tcl_Alloc((int) size)
8 -#define FREE(ptr) if (ptr) { Tcl_Free((char*) ptr); ptr = 0; }
15 } else if (3 == objc) {
16 if (tclrl_custom_completer)
17 - FREE(tclrl_custom_completer);
18 + free(tclrl_custom_completer);
19 if (!blank_line(Tcl_GetStringFromObj(objv[2], 0)))
20 tclrl_custom_completer =
21 stripwhite(strdup(Tcl_GetStringFromObj(objv[2], 0)));
24 } else if (3 == objc) {
26 - FREE(tclrl_eof_string);
27 + free(tclrl_eof_string);
28 if (!blank_line(Tcl_GetStringFromObj(objv[2], 0)))
30 stripwhite(strdup(Tcl_GetStringFromObj(objv[2], 0)));
32 * tell the calling routines to terminate.
34 TclReadlineTerminate(LINE_COMPLETE);
43 strcpy(rl_line_buffer, expansion);
44 rl_end = strlen(expansion);
45 rl_point += strlen(expansion) - oldlen;
50 * because we return 0 == matches,
59 if (tclrl_custom_completer) {
61 state = Tcl_VarEval(tclrl_interp, tclrl_custom_completer,
62 " \"", quoted_text, "\" ", start_s, " ", end_s,
63 " \"", quoted_rl_line_buffer, "\"", (char*) NULL);
65 - FREE(quoted_rl_line_buffer);
67 + free(quoted_rl_line_buffer);
68 if (TCL_OK != state) {
69 Tcl_AppendResult (tclrl_interp, " `", tclrl_custom_completer,
70 " \"", quoted_text, "\" ", start_s, " ", end_s,
75 - matches = (char**) MALLOC(sizeof(char*) * (objc + 1));
76 + matches = (char**) malloc(sizeof(char*) * (objc + 1));
77 for (i = 0; i < objc; i++) {
78 matches[i] = strdup(Tcl_GetStringFromObj(objv[i], &length));
79 if (1 == objc && !strlen(matches[i])) {
84 Tcl_ResetResult(tclrl_interp); /* clear result space */
89 if (2 == objc && !strlen(matches[1])) {
93 rl_completion_append_character = '\0';
100 - new = (cmds_t *) MALLOC(sizeof(cmds_t));
101 + new = (cmds_t *) malloc(sizeof(cmds_t));
102 new->next = (cmds_t *) NULL;
107 argc = TclReadlineParse(args, sizeof(args), tmp);
109 - new->cmd = (char**) MALLOC(sizeof(char*) * (argc + 1));
110 + new->cmd = (char**) malloc(sizeof(char*) * (argc + 1));
112 for (i = 0; i < argc; i++)
113 new->cmd[i] = args[i];