diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2010-03-23 15:46:33 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2010-03-23 15:46:33 +0000 |
commit | 22780f70b0a868b2b458fa5177c8100498b4d2b2 (patch) | |
tree | 080f251c04b61d8c370432c8067002186955ff16 /Build/source/texk/web2c/cpascal.h | |
parent | 2a08f5f488ae9ed06fa49478c2c386a7813f1228 (diff) |
bibtex: more dynamic memory allocation
git-svn-id: svn://tug.org/texlive/trunk@17536 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/cpascal.h')
-rw-r--r-- | Build/source/texk/web2c/cpascal.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Build/source/texk/web2c/cpascal.h b/Build/source/texk/web2c/cpascal.h index 7232af19523..63078cceb37 100644 --- a/Build/source/texk/web2c/cpascal.h +++ b/Build/source/texk/web2c/cpascal.h @@ -166,19 +166,21 @@ typedef unsigned char *pointertobyte; rely on stringification, or we could avoid the ARRAY_NAME arg. Actually allocate one more than requests, so we can index the last entry, as Pascal wants to do. */ -#define BIBXRETALLOC(array_name, array_var, type, size_var, new_size) do { \ +#define BIBXRETALLOCNOSET(array_name, array_var, type, size_var, new_size) \ fprintf (logfile, "Reallocated %s (elt_size=%d) to %ld items from %ld.\n", \ array_name, (int) sizeof (type), new_size, size_var); \ - XRETALLOC (array_var, new_size + 1, type); \ + XRETALLOC (array_var, new_size + 1, type) +/* Same as above, but also increase SIZE_VAR when no more arrays + with the same size parameter will be resized. */ +#define BIBXRETALLOC(array_name, array_var, type, size_var, new_size) do { \ + BIBXRETALLOCNOSET(array_name, array_var, type, size_var, new_size); \ size_var = new_size; \ } while (0) -/* Same as above, but don't increase SIZE_VAR when additional arrays - with the same size parameter will be resized. */ -#define BIBXRETALLOCNOSET(array_name, array_var, type, size_var, new_size) do { \ +/* Same as above, but for the pseudo-TYPE ASCII_code[LENGTH+1]. */ +#define BIBXRETALLOCSTRING(array_name, array_var, length, size_var, new_size) \ fprintf (logfile, "Reallocated %s (elt_size=%d) to %ld items from %ld.\n", \ - array_name, (int) sizeof (type), new_size, size_var); \ - XRETALLOC (array_var, new_size + 1, type); \ -} while (0) + array_name, (int) (length + 1), new_size, size_var); \ + XRETALLOC (array_var, new_size * (length + 1), ASCIIcode) /* Need precisely int for getopt, etc. */ #define cinttype int |