mirror of
https://github.com/irssi/irssi.git
synced 2026-08-20 09:02:13 +02:00
..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
This commit is contained in:
parent
32790f1515
commit
cfd50ce9cd
4 changed files with 21 additions and 25 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue