Mercurial > hg > xemacs-beta
diff src/text.c @ 3462:6c7605dfcf07
[xemacs-hg @ 2006-06-19 18:19:33 by james]
Fix various problems found by static checkers: use of uninitialized values,
dereferencing pointers before checking whether they are NULL, memory leaks,
and incomplete checking of return values. <m3k67gpyhk.fsf@jerrypc.cs.usu.edu>
author | james |
---|---|
date | Mon, 19 Jun 2006 18:19:38 +0000 |
parents | ee35a8fdcfcd |
children | b03fc4eae965 |
line wrap: on
line diff
--- a/src/text.c Mon Jun 19 18:10:19 2006 +0000 +++ b/src/text.c Mon Jun 19 18:19:38 2006 +0000 @@ -2138,7 +2138,11 @@ Bytecount len, Charcount charlen, const Ibyte *data, const Eistring *ei2, int is_ascii, int fold_case) { + assert ((data == 0) != (ei == 0)); + assert ((is_ascii != 0) == (data != 0)); + assert (fold_case >= 0 && fold_case <= 2); assert ((off < 0) != (charoff < 0)); + if (off < 0) { off = charcount_to_bytecount (ei->data_, charoff); @@ -2152,9 +2156,6 @@ assert (off >= 0 && off <= ei->bytelen_); assert (len >= 0 && off + len <= ei->bytelen_); - assert ((data == 0) != (ei == 0)); - assert ((is_ascii != 0) == (data != 0)); - assert (fold_case >= 0 && fold_case <= 2); { Bytecount dstlen;