aboutsummaryrefslogtreecommitdiffstats
path: root/options.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1998-10-08 05:31:22 +0000
committerEric S. Raymond <esr@thyrsus.com>1998-10-08 05:31:22 +0000
commit632f1335893998041f66a25d3809ad719f8557b7 (patch)
tree4530ed420648800a93d1ccded966c7ef941eb3a6 /options.c
parente5cbf59f31c46a8da51b71b16674474be9fe319b (diff)
downloadfetchmail-632f1335893998041f66a25d3809ad719f8557b7.tar.gz
fetchmail-632f1335893998041f66a25d3809ad719f8557b7.tar.bz2
fetchmail-632f1335893998041f66a25d3809ad719f8557b7.zip
Use alloca where possible.
svn path=/trunk/; revision=2076
Diffstat (limited to 'options.c')
-rw-r--r--options.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/options.c b/options.c
index 6ae2f61e..aa63002b 100644
--- a/options.c
+++ b/options.c
@@ -7,6 +7,13 @@
#include "config.h"
#include <stdio.h>
+#if defined(HAVE_ALLOCA_H)
+#include <alloca.h>
+#else
+#ifdef _AIX
+ #pragma alloca
+#endif
+#endif
#include <pwd.h>
#include <string.h>
#include <errno.h>
@@ -406,18 +413,17 @@ struct query *ctl; /* option record to be initialized */
break;
case 'r':
case LA_FOLDER:
- buf = xmalloc(strlen(optarg));
+ buf = alloca(strlen(optarg));
strcpy(buf, optarg);
cp = strtok(buf, ",");
do {
save_str(&ctl->mailboxes, cp, 0);
} while
((cp = strtok((char *)NULL, ",")));
- free(buf);
break;
case 'S':
case LA_SMTPHOST:
- buf = xmalloc(strlen(optarg));
+ buf = alloca(strlen(optarg));
strcpy(buf, optarg);
cp = strtok(buf, ",");
do {
@@ -425,7 +431,6 @@ struct query *ctl; /* option record to be initialized */
} while
((cp = strtok((char *)NULL, ",")));
ocount++;
- free(buf);
break;
case 'D':
case LA_SMTPADDR:
@@ -433,7 +438,7 @@ struct query *ctl; /* option record to be initialized */
break;
case 'Z':
case LA_ANTISPAM:
- buf = xmalloc(strlen(optarg));
+ buf = alloca(strlen(optarg));
strcpy(buf, optarg);
cp = strtok(buf, ",");
do {
@@ -442,7 +447,6 @@ struct query *ctl; /* option record to be initialized */
idp->val.status.num = atoi(cp);
} while
((cp = strtok((char *)NULL, ",")));
- free(buf);
break;
case 'b':
case LA_BATCHLIMIT: