summaryrefslogtreecommitdiff
path: root/src/lib-popt/popthelp.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-12-02 07:08:49 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-12-02 07:08:49 +0000
commitcfd50ce9cdbeab86ac5d25499f081326481584fc (patch)
tree6eda91182e7993b670225c44c6a99a5fd97b156e /src/lib-popt/popthelp.c
parent32790f15151664d7869f4e898c833f1ede81c0f9 (diff)
downloadirssi-cfd50ce9cdbeab86ac5d25499f081326481584fc.zip
..and removed the rest of the alloca()s too
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@918 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/lib-popt/popthelp.c')
-rw-r--r--src/lib-popt/popthelp.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/lib-popt/popthelp.c b/src/lib-popt/popthelp.c
index 7d1567c4..493726e0 100644
--- a/src/lib-popt/popthelp.c
+++ b/src/lib-popt/popthelp.c
@@ -6,10 +6,6 @@
#include "common.h"
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
#include "popt.h"
#include "poptint.h"
@@ -66,7 +62,7 @@ static void singleOptionHelp(FILE * f, int maxLeftCol,
int helpLength;
const char * ch;
char format[10];
- char * left = alloca(maxLeftCol + 1);
+ char * left = malloc(maxLeftCol + 1);
const char * argDescrip = getArgDescrip(opt, translation_domain);
*left = '\0';
@@ -76,7 +72,10 @@ static void singleOptionHelp(FILE * f, int maxLeftCol,
sprintf(left, "-%c", opt->shortName);
else if (opt->longName)
sprintf(left, "--%s", opt->longName);
- if (!*left) return ;
+ if (!*left) {
+ free(left);
+ return;
+ }
if (argDescrip) {
strcat(left, "=");
strcat(left, argDescrip);
@@ -86,9 +85,12 @@ static void singleOptionHelp(FILE * f, int maxLeftCol,
fprintf(f," %-*s ", maxLeftCol, left);
else {
fprintf(f," %s\n", left);
+ free(left);
return;
}
+ free(left);
+
helpLength = strlen(help);
while (helpLength > lineLength) {
ch = help + lineLength - 1;