Mercurial > hg > xemacs-beta
comparison 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 |
comparison
equal
deleted
inserted
replaced
3461:fd2936bbfc5f | 3462:6c7605dfcf07 |
---|---|
2136 int | 2136 int |
2137 eicmp_1 (Eistring *ei, Bytecount off, Charcount charoff, | 2137 eicmp_1 (Eistring *ei, Bytecount off, Charcount charoff, |
2138 Bytecount len, Charcount charlen, const Ibyte *data, | 2138 Bytecount len, Charcount charlen, const Ibyte *data, |
2139 const Eistring *ei2, int is_ascii, int fold_case) | 2139 const Eistring *ei2, int is_ascii, int fold_case) |
2140 { | 2140 { |
2141 assert ((data == 0) != (ei == 0)); | |
2142 assert ((is_ascii != 0) == (data != 0)); | |
2143 assert (fold_case >= 0 && fold_case <= 2); | |
2141 assert ((off < 0) != (charoff < 0)); | 2144 assert ((off < 0) != (charoff < 0)); |
2145 | |
2142 if (off < 0) | 2146 if (off < 0) |
2143 { | 2147 { |
2144 off = charcount_to_bytecount (ei->data_, charoff); | 2148 off = charcount_to_bytecount (ei->data_, charoff); |
2145 if (charlen < 0) | 2149 if (charlen < 0) |
2146 len = -1; | 2150 len = -1; |
2150 if (len < 0) | 2154 if (len < 0) |
2151 len = ei->bytelen_ - off; | 2155 len = ei->bytelen_ - off; |
2152 | 2156 |
2153 assert (off >= 0 && off <= ei->bytelen_); | 2157 assert (off >= 0 && off <= ei->bytelen_); |
2154 assert (len >= 0 && off + len <= ei->bytelen_); | 2158 assert (len >= 0 && off + len <= ei->bytelen_); |
2155 assert ((data == 0) != (ei == 0)); | |
2156 assert ((is_ascii != 0) == (data != 0)); | |
2157 assert (fold_case >= 0 && fold_case <= 2); | |
2158 | 2159 |
2159 { | 2160 { |
2160 Bytecount dstlen; | 2161 Bytecount dstlen; |
2161 const Ibyte *src = ei->data_, *dst; | 2162 const Ibyte *src = ei->data_, *dst; |
2162 | 2163 |