1999-08-03 Norbert Warmuth <nwarmuth@privat.circular.de>

* src/poptalloca.h: New file with definitions for alloca. Note: alloca
is defined as malloc on systems which fail to support alloca. Don't
include this file if you frequently use alloca.

* src/findme.c, src/popt*.c: include poptalloca.h

* src/Makefile.in: added poptalloca.h

* src/menu.c (create_menu): set minimum menu width to 20 characters as
it used to be (this was part of davids patches but I haven't
applied it, yet).
This commit is contained in:
Norbert Warmuth 1999-08-03 05:17:47 +00:00
parent 5ddaf9b10c
commit fb16422da4
9 changed files with 66 additions and 35 deletions

View File

@ -1,3 +1,17 @@
1999-08-03 Norbert Warmuth <nwarmuth@privat.circular.de>
* poptalloca.h: New file with definitions for alloca. Note: alloca
is defined as malloc on systems which fail to support alloca. Don't
include this file if you frequently use alloca.
* findme.c, popt*.c: include poptalloca.h
* Makefile.in: added poptalloca.h
* menu.c (create_menu): set minimum menu width to 20 characters as
it used to be (this was part of davids patches but I haven't
applied it, yet).
1999-08-01 David Martin <dmartina@usa.net>
* menu.c (create_menu, menubar_drop_compute, menubar_paint_idx):

View File

@ -36,7 +36,7 @@ HDRS = color.h file.h mouse.h user.h dialog.h find.h main.h \
myslang.h command.h cmd.h tty.h fs.h panelize.h achown.h \
learn.h listmode.h features.inc background.h \
x.h textconf.h i18n.h findme.h popt.h filegui.h keys.h xtty.h \
poptint.h fileopctx.h treestore.h
poptint.h poptalloca.h fileopctx.h treestore.h
OBJS = dir.o util.o screen.o dialog.o key.o keyxdef.o menu.o \
file.o win.o color.o help.o find.o profile.o user.o view.o \

View File

@ -6,6 +6,7 @@
#include "config.h"
#endif
#include "poptalloca.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -16,10 +17,6 @@
#include <libc.h>
#endif
#if HAVE_ALLOCA_H
# include <alloca.h>
#endif
#include "findme.h"
char * findProgramPath(char * argv0) {

View File

@ -54,7 +54,7 @@ Menu create_menu (char *name, menu_entry *entries, int count)
menu = (Menu) g_malloc (sizeof (*menu));
menu->count = count;
menu->max_entry_len = 0;
menu->max_entry_len = 20;
menu->entries = entries;
#ifdef ENABLE_NLS

View File

@ -6,6 +6,7 @@
#include "config.h"
#endif
#include "poptalloca.h"
#include <errno.h>
#include <ctype.h>
#include <fcntl.h>
@ -15,10 +16,6 @@
#include <string.h>
#include <unistd.h>
#if HAVE_ALLOCA_H
# include <alloca.h>
#endif
#include "findme.h"
#include "popt.h"
#include "poptint.h"

46
src/poptalloca.h Normal file
View File

@ -0,0 +1,46 @@
/* Definitions for alloca (mostly extracted from AC_FUNC_ALLOCA). According
to the autoconf manual in dome versions of AIX the declaration of alloca
has to precede everything else execept comments and prepocessor directives,
i.e. including this file has to preceed anything else.
NOTE: alloca is redefined as malloc on systems which fail to support alloca.
Don't include this header if you frequently use alloca in order to avoid an
unlimited amount of memory leaks.
popt uses alloca only during program startup, i.e. the memory leaks caused
by this redefinition are limited.
*/
#ifndef POPTALLOCA_H
#define POPTALLOCA_H
/* AIX requires this to be the first thing in the file. */
#ifdef __GNUC__
# define alloca __builtin_alloca
#else
# ifdef _MSC_VER
# include <malloc.h>
# define alloca _alloca
# else
# if HAVE_ALLOCA_H
# include <alloca.h>
# else
# ifdef _AIX
#pragma alloca
# else
# ifndef alloca /* predefined by HP cc +Olibcalls */
char *alloca ();
# endif
# endif
# endif
# endif
#endif
#ifndef HAVE_ALLOCA
# include <stdlib.h>
# ifdef HAVE_MALLOC_H
# include <malloc.h>
# endif
# define alloca malloc
#endif
#endif

View File

@ -6,6 +6,7 @@
#include "config.h"
#endif
#include "poptalloca.h"
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
@ -13,10 +14,6 @@
#include <string.h>
#include <unistd.h>
#if HAVE_ALLOCA_H
# include <alloca.h>
#endif
#include "popt.h"
#include "poptint.h"

View File

@ -13,10 +13,6 @@
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
#include "popt.h"
#include "poptint.h"

View File

@ -6,27 +6,11 @@
#include "config.h"
#endif
#include "poptalloca.h"
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
/* AIX requires this to be the first thing in the file. */
#ifndef __GNUC__
# if HAVE_ALLOCA_H
# include <alloca.h>
# else
# ifdef _AIX
#pragma alloca
# else
# ifndef alloca /* predefined by HP cc +Olibcalls */
char *alloca ();
# endif
# endif
# endif
#elif defined(__GNUC__) && defined(__STRICT_ANSI__)
#define alloca __builtin_alloca
#endif
#include "popt.h"
#define POPT_ARGV_ARRAY_GROW_DELTA 5