summaryrefslogtreecommitdiff
path: root/src/ustr.c
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2010-08-21 13:52:25 +0000
committerLucas De Marchi <lucas.demarchi@profusion.mobi>2010-08-21 13:52:25 +0000
commite14093a9f933fef1826d4036bf9991387020405d (patch)
tree2cf94275779e4b455c48438c717806426b1f9595 /src/ustr.c
parent503ac8ec06eda77e117dea0e7e23f76e956b3733 (diff)
downloadlibast-e14093a9f933fef1826d4036bf9991387020405d.tar.gz
Convert (hopefully) all comparisons to NULL
Apply badzero.cocci, badnull.coci and badnull2.cocci This should convert all cases where there's a comparison to NULL to simpler forms. This patch applies the following transformations: code before patch ||code after patch =============================================================== return a == NULL; return !a; return a != NULL; return !!a; func(a == NULL); func(!a); func(a != NULL); func(!!a); b = a == NULL; b = !a; b = a != NULL; b = !!a; b = a == NULL ? c : d; b = !a ? c : d; b = a != NULL ? c : d; b = a ? c : d; other cases: a == NULL !a a != NULL a SVN revision: 51487
Diffstat (limited to 'src/ustr.c')
-rw-r--r--src/ustr.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/ustr.c b/src/ustr.c
index 35c80ab..4fb8e91 100644
--- a/src/ustr.c
+++ b/src/ustr.c
@@ -230,8 +230,7 @@ spif_ustr_init_from_fp(spif_ustr_t self, FILE *fp)
self->s = (spif_charptr_t) MALLOC(self->size);
for (p = self->s; fgets((char *)p, buff_inc, fp); p += buff_inc) {
- if ((end = (spif_charptr_t)
- strchr((const char *)p, '\n')) == NULL) {
+ if (!(end = (spif_charptr_t)strchr((const char *)p, '\n'))) {
self->size += buff_inc;
self->s = (spif_charptr_t) REALLOC(self->s, self->size);
} else {