Skip to content

Commit

Permalink
vpatch: fix problems reported by valgrind.
Browse files Browse the repository at this point in the history
test code isn't much good if you don't run it...

I ran 'make vtest' and fixed the problems reported.

Signed-off-by: NeilBrown <[email protected]>
  • Loading branch information
neilbrown committed Aug 29, 2020
1 parent 567852f commit 340562c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ QUIET_CLEAN = $(Q:@=@echo ' CLEAN '$@;)


$(BIN)/wiggle : $(BOBJ) $(O)/libwiggle.a
$(QUIET_LINK)$(CC) $^ $(LDLIBS) -o $@
$(QUIET_LINK)$(CC) $(CFLAGS) $^ $(LDLIBS) -o $@

$(O)/libwiggle.a : $(BLIBOBJ)
$(QUIET_AR)ar cr $@ $^
Expand Down
2 changes: 1 addition & 1 deletion dovtest
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ do
else $VG $WIGGLE -B orig
fi
if grep 'ERROR SUMMARY: [1-9]' $vallog > /dev/null 2>&1
then msg="VALGRIND ERRORS"; xit=1
then msg="VALGRIND ERRORS"; xit=1 ; mv $vallog $vallog-${dir////-}
else msg="SUCCESS"; xit=0
fi
echo $path $msg
Expand Down
4 changes: 3 additions & 1 deletion vpatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -1619,6 +1619,7 @@ static int merge_window(struct plist *p, FILE *f, int reverse, int replace,
while (spos.p.m >= 0 && spos.state != 0)
prev_mline(&spos, fm, fb, fa, ci.merger, smode);
while (!same_mpos(spos, tpos) &&
spos.p.m >= 0 &&
ci.merger[spos.p.m].type != End)
next_mline(&spos, fm, fb, fa, ci.merger, smode);

Expand All @@ -1636,7 +1637,8 @@ static int merge_window(struct plist *p, FILE *f, int reverse, int replace,
blank(i--, 0, cols, a_void);
tpos = spos;
for (i = srow;
i < rows && ci.merger[tpos.p.m].type != End;
i < rows && tpos.p.m >= 0 &&
ci.merger[tpos.p.m].type != End;
i++) {
draw_mline(smode, i, start, cols, fm, fb, fa, ci.merger,
tpos,
Expand Down
2 changes: 1 addition & 1 deletion wiggle.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct stream {
* elmnt at the start of each hunk which starts with '\0' and
* records the line offsets of the hunk. These are 20+ bytes long.
* "\0\d{5} \d{5} \d{5}{SP funcname}?\n\0"
* The 3 numbers are: chunk number, starting line, number if lines.
* The 3 numbers are: chunk number, starting line, number of lines.
* An element with len==0 marks EOF.
*/
struct elmnt {
Expand Down

0 comments on commit 340562c

Please sign in to comment.