Changeset: 3144006dac47 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3144006dac47
Modified Files:
clients/mapiclient/ReadlineTools.c
Branch: Feb2013
Log Message:
Don't use so many overly large buffers on the stack.
diffs (57 lines):
diff --git a/clients/mapiclient/ReadlineTools.c
b/clients/mapiclient/ReadlineTools.c
--- a/clients/mapiclient/ReadlineTools.c
+++ b/clients/mapiclient/ReadlineTools.c
@@ -228,7 +228,7 @@ static char *mal_commands[] = {
static int
mal_help(int cnt, int key)
{
- char *name, *c, buf[BUFSIZ];
+ char *name, *c, buf[512];
int seekpos = 0, rowcount;
MapiHdl table_hdl;
@@ -240,7 +240,7 @@ mal_help(int cnt, int key)
c--;
while (c > rl_line_buffer && !isspace(*c))
c--;
- snprintf(buf, BUFSIZ, "manual.help(\"%s\");", c);
+ snprintf(buf, sizeof(buf), "manual.help(\"%s\");", c);
if ((table_hdl = mapi_query(_mid, buf)) == NULL || mapi_error(_mid)) {
if (table_hdl) {
mapi_explain_query(table_hdl, stderr);
@@ -271,7 +271,7 @@ mal_command_generator(const char *text,
static int idx;
static int seekpos, len, rowcount;
static MapiHdl table_hdl;
- char *name, buf[BUFSIZ];
+ char *name, buf[512];
/* we pick our own portion of the linebuffer */
text = rl_line_buffer + strlen(rl_line_buffer) - 1;
@@ -295,20 +295,19 @@ mal_command_generator(const char *text,
}
/* try the server to answer */
if (!state) {
- char cmd[BUFSIZ], *c;
+ char *c;
c = strstr(text, ":=");
if (c)
text = c + 2;
while (isspace((int) *text))
text++;
- c = strchr(text, '.');
- if (c == NULL)
- snprintf(cmd, BUFSIZ, "%s.*(", text);
+ if (strchr(text, '.') == NULL)
+ snprintf(buf, sizeof(buf),
+ "manual.completion(\"%s.*(\");", text);
else
- snprintf(cmd, BUFSIZ, "%s(", text);
+ snprintf(buf, sizeof(buf),
+ "manual.completion(\"%s(\");", text);
seekpos = 0;
- len = strlen(cmd);
- snprintf(buf, BUFSIZ, "manual.completion(\"%s\");", cmd);
if ((table_hdl = mapi_query(_mid, buf)) == NULL ||
mapi_error(_mid)) {
if (table_hdl) {
mapi_explain_query(table_hdl, stderr);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list