diff options
author | Lucas De Marchi <lucas.demarchi@profusion.mobi> | 2010-08-21 13:52:25 +0000 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@profusion.mobi> | 2010-08-21 13:52:25 +0000 |
commit | e14093a9f933fef1826d4036bf9991387020405d (patch) | |
tree | 2cf94275779e4b455c48438c717806426b1f9595 /src/ustr.c | |
parent | 503ac8ec06eda77e117dea0e7e23f76e956b3733 (diff) | |
download | libast-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.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -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 { |