gentoo/dev-tcltk/tclreadline/files/tclreadline-2.1.0-alloc-free.patch
Robin H. Johnson 56bd759df1
proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.

This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.

Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
2015-08-08 17:38:18 -07:00

122 lines
3.3 KiB
Diff

diff -ur a/tclreadline.c b/tclreadline.c
--- a/tclreadline.c 2000-09-20 19:44:34.000000000 +0200
+++ b/tclreadline.c 2013-11-18 10:35:13.889610060 +0100
@@ -343,7 +343,9 @@
return TCL_ERROR;
} else if (3 == objc) {
- if (tclrl_custom_completer)
+ if (tclrl_custom_completer) {
- FREE(tclrl_custom_completer);
+ free(tclrl_custom_completer);
+ tclrl_custom_completer = NULL;
+ }
if (!blank_line(Tcl_GetStringFromObj(objv[2], 0)))
tclrl_custom_completer =
stripwhite(strdup(Tcl_GetStringFromObj(objv[2], 0)));
@@ -378,7 +380,9 @@
return TCL_ERROR;
} else if (3 == objc) {
- if (tclrl_eof_string)
+ if (tclrl_eof_string) {
- FREE(tclrl_eof_string);
+ free(tclrl_eof_string);
+ tclrl_eof_string = NULL;
+ }
if (!blank_line(Tcl_GetStringFromObj(objv[2], 0)))
tclrl_eof_string =
stripwhite(strdup(Tcl_GetStringFromObj(objv[2], 0)));
@@ -506,10 +510,16 @@
if (status >= 1) {
/* TODO: make this a valid tcl output */
printf("%s\n", expansion);
+ free(ptr);
+ free(expansion);
+ return;
} else if (-1 == status) {
Tcl_AppendResult
(tclrl_interp, "error in history expansion\n", (char*) NULL);
TclReadlineTerminate(TCL_ERROR);
+ free(ptr);
+ free(expansion);
+ return;
}
/**
* TODO: status == 2 ...
@@ -544,8 +554,8 @@
* tell the calling routines to terminate.
*/
TclReadlineTerminate(LINE_COMPLETE);
- FREE(ptr);
- FREE(expansion);
+ free(ptr);
+ free(expansion);
}
}
@@ -673,7 +683,7 @@
strcpy(rl_line_buffer, expansion);
rl_end = strlen(expansion);
rl_point += strlen(expansion) - oldlen;
- FREE(expansion);
+ free(expansion);
/*
* TODO:
* because we return 0 == matches,
@@ -682,7 +690,8 @@
*/
return matches;
}
- FREE(expansion);
+ free(expansion);
+ expansion = NULL;
}
if (tclrl_custom_completer) {
@@ -699,15 +710,19 @@
state = Tcl_VarEval(tclrl_interp, tclrl_custom_completer,
" \"", quoted_text, "\" ", start_s, " ", end_s,
" \"", quoted_rl_line_buffer, "\"", (char*) NULL);
- FREE(quoted_text);
- FREE(quoted_rl_line_buffer);
if (TCL_OK != state) {
Tcl_AppendResult (tclrl_interp, " `", tclrl_custom_completer,
" \"", quoted_text, "\" ", start_s, " ", end_s,
" \"", quoted_rl_line_buffer, "\"' failed.", (char*) NULL);
TclReadlineTerminate(state);
+ free(quoted_text);
+ free(quoted_rl_line_buffer);
return matches;
}
+ free(quoted_text);
+ quoted_text = NULL;
+ free(quoted_rl_line_buffer);
+ quoted_rl_line_buffer = NULL;
obj = Tcl_GetObjResult(tclrl_interp);
status = Tcl_ListObjGetElements(tclrl_interp, obj, &objc, &objv);
if (TCL_OK != status)
@@ -715,12 +732,12 @@
if (objc) {
int i, length;
- matches = (char**) MALLOC(sizeof(char*) * (objc + 1));
+ matches = (char**) malloc(sizeof(char*) * (objc + 1));
for (i = 0; i < objc; i++) {
matches[i] = strdup(Tcl_GetStringFromObj(objv[i], &length));
if (1 == objc && !strlen(matches[i])) {
- FREE(matches[i]);
+ free(matches[i]);
- FREE(matches);
+ free(matches);
Tcl_ResetResult(tclrl_interp); /* clear result space */
return (char**) NULL;
}
@@ -735,7 +752,7 @@
*/
if (2 == objc && !strlen(matches[1])) {
i--;
- FREE(matches[1]);
+ free(matches[1]);
rl_completion_append_character = '\0';
}