summaryrefslogtreecommitdiff
path: root/Build/source/texk/kpathsea
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2010-03-08 09:07:54 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2010-03-08 09:07:54 +0000
commit7bc3d71af69b04734daa32de9bbfd2f9cddfeac4 (patch)
treeb6c9569c4987ba10f8425eb9c6d176ab4bded2e1 /Build/source/texk/kpathsea
parentc6c24f795f2c8af90de7efd8f6438d864b4c1177 (diff)
more robust mf.ch, xcalloc.c, and xrealloc.c
git-svn-id: svn://tug.org/texlive/trunk@17381 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/kpathsea')
-rw-r--r--Build/source/texk/kpathsea/ChangeLog5
-rw-r--r--Build/source/texk/kpathsea/texmf.cnf2
-rw-r--r--Build/source/texk/kpathsea/xcalloc.c4
-rw-r--r--Build/source/texk/kpathsea/xrealloc.c4
4 files changed, 10 insertions, 5 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog
index 847c52ec1b2..d61ba8d0667 100644
--- a/Build/source/texk/kpathsea/ChangeLog
+++ b/Build/source/texk/kpathsea/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-08 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * xrealloc.c (xrealloc): Allocate 1 byte if passed size 0.
+ * xcalloc.c (xcalloc): Use 1 if passed nelem 0 or elsize 0.
+
2010-03-05 Peter Breitenlohner <peb@mppmu.mpg.de>
* texmf.cnf (line_length, max_rows, max_cols): GFtype parameters
diff --git a/Build/source/texk/kpathsea/texmf.cnf b/Build/source/texk/kpathsea/texmf.cnf
index 501640a0da8..d8824c718a5 100644
--- a/Build/source/texk/kpathsea/texmf.cnf
+++ b/Build/source/texk/kpathsea/texmf.cnf
@@ -694,4 +694,4 @@ screen_depth = 1200
% GFtype only.
line_length = 500
max_rows = 8191
-max_cols = 8191 \ No newline at end of file
+max_cols = 8191
diff --git a/Build/source/texk/kpathsea/xcalloc.c b/Build/source/texk/kpathsea/xcalloc.c
index e01eb9c8da4..0d01c1bcd15 100644
--- a/Build/source/texk/kpathsea/xcalloc.c
+++ b/Build/source/texk/kpathsea/xcalloc.c
@@ -1,6 +1,6 @@
/* xcalloc.c: calloc with error checking.
- Copyright 1992, 1993, 2008 Karl Berry.
+ Copyright 1992, 1993, 2008, 2010 Karl Berry.
Copyright 2005 Olaf Weber.
This library is free software; you can redistribute it and/or
@@ -22,7 +22,7 @@
void *
xcalloc (unsigned nelem, unsigned elsize)
{
- void *new_mem = (void*)calloc(nelem, elsize);
+ void *new_mem = (void*)calloc(nelem ? nelem : 1, elsize ? elsize : 1);
if (new_mem == NULL) {
fprintf(stderr,
diff --git a/Build/source/texk/kpathsea/xrealloc.c b/Build/source/texk/kpathsea/xrealloc.c
index 0bafda049c7..516ad4463ec 100644
--- a/Build/source/texk/kpathsea/xrealloc.c
+++ b/Build/source/texk/kpathsea/xrealloc.c
@@ -1,6 +1,6 @@
/* xrealloc.c: realloc with error checking.
- Copyright 1992, 1993, 2008 Karl Berry.
+ Copyright 1992, 1993, 2008, 2010 Karl Berry.
Copyright 2005 Olaf Weber.
This library is free software; you can redistribute it and/or
@@ -28,7 +28,7 @@ xrealloc (void *old_ptr, unsigned size)
if (old_ptr == NULL) {
new_mem = xmalloc(size);
} else {
- new_mem = (void *)realloc(old_ptr, size);
+ new_mem = (void *)realloc(old_ptr, size ? size : 1);
if (new_mem == NULL) {
/* We used to print OLD_PTR here using %x, and casting its
value to unsigned, but that lost on the Alpha, where