Bug #2665 ยป too-short.patch
| usr.bin/patch/patch.c | ||
|---|---|---|
|
LINENUM pat_lines = pch_ptrn_lines() - fuzz;
|
||
|
const char *ilineptr;
|
||
|
const char *plineptr;
|
||
|
short plinelen;
|
||
|
size_t plinelen;
|
||
|
for (iline = base + offset + fuzz; pline <= pat_lines; pline++, iline++) {
|
||
|
ilineptr = ifetch(iline, offset >= 0);
|
||
| usr.bin/patch/pch.c | ||
|---|---|---|
|
static LINENUM p_context = 3; /* # of context lines */
|
||
|
static LINENUM p_input_line = 0; /* current line # from patch file */
|
||
|
static char **p_line = NULL;/* the text of the hunk */
|
||
|
static short *p_len = NULL; /* length of each line */
|
||
|
static size_t *p_len = NULL; /* length of each line */
|
||
|
static char *p_char = NULL; /* +, -, and ! */
|
||
|
static int hunkmax = INITHUNKMAX; /* size of above arrays to begin with */
|
||
|
static int p_indent; /* indent to patch */
|
||
| ... | ... | |
|
if (p_line == NULL)
|
||
|
p_line = calloc((size_t) hunkmax, sizeof(char *));
|
||
|
if (p_len == NULL)
|
||
|
p_len = calloc((size_t) hunkmax, sizeof(short));
|
||
|
p_len = calloc((size_t) hunkmax, sizeof(size_t));
|
||
|
if (p_char == NULL)
|
||
|
p_char = calloc((size_t) hunkmax, sizeof(char));
|
||
|
}
|
||
| ... | ... | |
|
{
|
||
|
int new_hunkmax;
|
||
|
char **new_p_line;
|
||
|
short *new_p_len;
|
||
|
size_t *new_p_len;
|
||
|
char *new_p_char;
|
||
|
new_hunkmax = hunkmax * 2;
|
||
| ... | ... | |
|
if (new_p_line == NULL)
|
||
|
free(p_line);
|
||
|
new_p_len = realloc(p_len, new_hunkmax * sizeof(short));
|
||
|
new_p_len = realloc(p_len, new_hunkmax * sizeof(size_t));
|
||
|
if (new_p_len == NULL)
|
||
|
free(p_len);
|
||
| ... | ... | |
|
pch_swap(void)
|
||
|
{
|
||
|
char **tp_line; /* the text of the hunk */
|
||
|
short *tp_len; /* length of each line */
|
||
|
size_t *tp_len; /* length of each line */
|
||
|
char *tp_char; /* +, -, and ! */
|
||
|
LINENUM i;
|
||
|
LINENUM n;
|
||
| ... | ... | |
|
/*
|
||
|
* Return the length of a particular patch line.
|
||
|
*/
|
||
|
short
|
||
|
size_t
|
||
|
pch_line_len(LINENUM line)
|
||
|
{
|
||
|
return p_len[line];
|
||
| usr.bin/patch/pch.h | ||
|---|---|---|
|
bool another_hunk(void);
|
||
|
bool pch_swap(void);
|
||
|
char *pfetch(LINENUM);
|
||
|
short pch_line_len(LINENUM);
|
||
|
size_t pch_line_len(LINENUM);
|
||
|
LINENUM pch_first(void);
|
||
|
LINENUM pch_ptrn_lines(void);
|
||
|
LINENUM pch_newfirst(void);
|
||