summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/pch.c11
-rw-r--r--src/pch.h1
2 files changed, 6 insertions, 6 deletions
diff --git a/src/pch.c b/src/pch.c
index 145c4ef..33facd9 100644
--- a/src/pch.c
+++ b/src/pch.c
@@ -158,20 +158,19 @@ open_patch_file (char const *filename)
if (p_filesize != (file_offset) p_filesize)
fatal ("patch file is too long");
next_intuit_at (file_pos, 1);
- set_hunkmax();
}
/* Make sure our dynamically realloced tables are malloced to begin with. */
-void
+static void
set_hunkmax (void)
{
if (!p_line)
- p_line = (char **) malloc (hunkmax * sizeof *p_line);
+ p_line = (char **) xmalloc (hunkmax * sizeof *p_line);
if (!p_len)
- p_len = (size_t *) malloc (hunkmax * sizeof *p_len);
+ p_len = (size_t *) xmalloc (hunkmax * sizeof *p_len);
if (!p_Char)
- p_Char = malloc (hunkmax * sizeof *p_Char);
+ p_Char = xmalloc (hunkmax * sizeof *p_Char);
}
/* Enlarge the arrays containing the current hunk of patch. */
@@ -1173,6 +1172,8 @@ another_hunk (enum diff difftype, bool rev)
char numbuf2[LINENUM_LENGTH_BOUND + 1];
char numbuf3[LINENUM_LENGTH_BOUND + 1];
+ set_hunkmax();
+
while (p_end >= 0) {
if (p_end == p_efake)
p_end = p_bfake; /* don't free twice */
diff --git a/src/pch.h b/src/pch.h
index 0c7ff62..9565ac4 100644
--- a/src/pch.h
+++ b/src/pch.h
@@ -46,7 +46,6 @@ bool pch_rename (void) _GL_ATTRIBUTE_PURE;
void do_ed_script (char const *, char const *, bool *, FILE *);
void open_patch_file (char const *);
void re_patch (void);
-void set_hunkmax (void);
void pch_normalize (enum diff);
XTERN struct timespec p_timestamp[2]; /* timestamps in patch headers */