Changeset: 7fa672c93447 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7fa672c93447
Modified Files:
tools/merovingian/daemon/argvcmds.c
Branch: Aug2011
Log Message:
command_get: avoid usage of alloca
diffs (33 lines):
diff --git a/tools/merovingian/daemon/argvcmds.c
b/tools/merovingian/daemon/argvcmds.c
--- a/tools/merovingian/daemon/argvcmds.c
+++ b/tools/merovingian/daemon/argvcmds.c
@@ -150,6 +150,7 @@ command_get(confkeyval *ckv, int argc, c
char *property = NULL;
char *value;
char buf[512];
+ char vbuf[512];
confkeyval *kv;
if (argc < 2 || argc > 3) {
@@ -171,15 +172,17 @@ command_get(confkeyval *ckv, int argc, c
if (strcmp(property, "all") == 0) {
size_t off = 0;
kv = ckv;
- property = alloca(sizeof(char) * 512);
+ property = vbuf;
/* hardwired read-only properties */
- off += snprintf(property, 512,
"hostname,dbfarm,status,mserver");
+ off += snprintf(property, sizeof(vbuf),
+ "hostname,dbfarm,status,mserver");
while (kv->key != NULL) {
- off += snprintf(property + off, 512 - off, ",%s",
kv->key);
+ off += snprintf(property + off, sizeof(vbuf) - off,
+ ",%s", kv->key);
kv++;
}
/* deduced read-only properties */
- off += snprintf(property + off, 512 - off,
+ off += snprintf(property + off, sizeof(vbuf) - off,
",mapisock,controlsock");
}
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list