diff options
author | Richard Basch <probe@mit.edu> | 1997-02-18 07:31:49 +0000 |
---|---|---|
committer | Richard Basch <probe@mit.edu> | 1997-02-18 07:31:49 +0000 |
commit | 66890465be761445e3f9929e9d24f3f4dbb580bc (patch) | |
tree | 70f523809420e402f06234afad131c22f9738515 /src/util/et/error_message.c | |
parent | 10601b6d6928dea0f56a5cfe7a90469d0c26d76d (diff) | |
download | krb5-66890465be761445e3f9929e9d24f3f4dbb580bc.tar.gz krb5-66890465be761445e3f9929e9d24f3f4dbb580bc.tar.xz krb5-66890465be761445e3f9929e9d24f3f4dbb580bc.zip |
Because you cannot call malloc() during DLL initialization under win16,
we must pre-allocate an array sufficiently large to hold several error
tables.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9895 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util/et/error_message.c')
-rw-r--r-- | src/util/et/error_message.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/util/et/error_message.c b/src/util/et/error_message.c index 0241409363..e24bb2ced7 100644 --- a/src/util/et/error_message.c +++ b/src/util/et/error_message.c @@ -168,6 +168,10 @@ add_error_table(et) const struct error_table FAR * et; { struct et_list *el = _et_list; +#ifdef _MSDOS + static struct et_list etl[32]; + static int etl_used = 0; +#endif while (el) { if (el->table->base == et->base) @@ -175,8 +179,18 @@ add_error_table(et) el = el->next; } - if (! (el = (struct et_list *)malloc(sizeof(struct et_list)))) - return ENOMEM; +#ifdef _MSDOS + /* + * Win16 applications cannot call malloc while the DLL is being + * initialized... To get around this, we pre-allocate an array + * sufficient to hold several error tables. + */ + if (etl_used < sizeof(etl)/sizeof(struct et_list)) + el = &etl[etl_used++]; + else +#endif + if (!(el = (struct et_list *)malloc(sizeof(struct et_list)))) + return ENOMEM; el->table = et; el->next = _et_list; |