From 632f1335893998041f66a25d3809ad719f8557b7 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 8 Oct 1998 05:31:22 +0000 Subject: Use alloca where possible. svn path=/trunk/; revision=2076 --- options.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'options.c') 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 +#if defined(HAVE_ALLOCA_H) +#include +#else +#ifdef _AIX + #pragma alloca +#endif +#endif #include #include #include @@ -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: -- cgit v1.2.3