updated on Fri Jan 13 20:02:10 UTC 2012
[aur-mirror.git] / tclreadline / threads.patch
blobb900a8b2462666b9abe8da2f152424deb7a40754
1 --- tclreadline.c 2000-09-20 13:44:34.000000000 -0400
2 +++ tclreadline_fix.c 2006-06-07 13:13:49.000000000 -0400
3 @@ -49,9 +49,6 @@
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; }
10 enum {
11 _CMD_SET = (1 << 0),
12 _CMD_GET = (1 << 1)
13 @@ -343,7 +340,7 @@
14 return TCL_ERROR;
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)));
22 @@ -378,7 +375,7 @@
23 return TCL_ERROR;
24 } else if (3 == objc) {
25 if (tclrl_eof_string)
26 - FREE(tclrl_eof_string);
27 + free(tclrl_eof_string);
28 if (!blank_line(Tcl_GetStringFromObj(objv[2], 0)))
29 tclrl_eof_string =
30 stripwhite(strdup(Tcl_GetStringFromObj(objv[2], 0)));
31 @@ -544,8 +541,8 @@
32 * tell the calling routines to terminate.
34 TclReadlineTerminate(LINE_COMPLETE);
35 - FREE(ptr);
36 - FREE(expansion);
37 + free(ptr);
38 + free(expansion);
42 @@ -673,7 +670,7 @@
43 strcpy(rl_line_buffer, expansion);
44 rl_end = strlen(expansion);
45 rl_point += strlen(expansion) - oldlen;
46 - FREE(expansion);
47 + free(expansion);
49 * TODO:
50 * because we return 0 == matches,
51 @@ -682,7 +679,7 @@
53 return matches;
55 - FREE(expansion);
56 + free(expansion);
59 if (tclrl_custom_completer) {
60 @@ -699,8 +696,8 @@
61 state = Tcl_VarEval(tclrl_interp, tclrl_custom_completer,
62 " \"", quoted_text, "\" ", start_s, " ", end_s,
63 " \"", quoted_rl_line_buffer, "\"", (char*) NULL);
64 - FREE(quoted_text);
65 - FREE(quoted_rl_line_buffer);
66 + free(quoted_text);
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,
71 @@ -715,12 +712,12 @@
73 if (objc) {
74 int i, length;
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])) {
80 - FREE(matches[i]);
81 - FREE(matches);
82 + free(matches[i]);
83 + free(matches);
84 Tcl_ResetResult(tclrl_interp); /* clear result space */
85 return (char**) NULL;
87 @@ -735,7 +732,7 @@
89 if (2 == objc && !strlen(matches[1])) {
90 i--;
91 - FREE(matches[1]);
92 + free(matches[1]);
93 rl_completion_append_character = '\0';
96 @@ -775,7 +772,7 @@
98 case _CMD_SET:
100 - new = (cmds_t *) MALLOC(sizeof(cmds_t));
101 + new = (cmds_t *) malloc(sizeof(cmds_t));
102 new->next = (cmds_t *) NULL;
104 if (!cmds) {
105 @@ -790,7 +787,7 @@
106 tmp = strdup(text);
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];