From: Shraddha Barke <shraddha.6596@gmail.com>
To: Samuel Thibault <samuel.thibault@ens-lyon.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Julia Lawall <Julia.Lawall@lip6.fr>
Cc: speakup@linux-speakup.org, linux-kernel@vger.kernel.org,
Shraddha Barke <shraddha.6596@gmail.com>
Subject: [PATCH v2 01/16] Staging: speakup: varhandlers.c: Remove explicit NULL comparison
Date: Fri, 11 Sep 2015 11:32:29 +0530 [thread overview]
Message-ID: <1441951349-5562-4-git-send-email-shraddha.6596@gmail.com> (raw)
In-Reply-To: <1441951349-5562-1-git-send-email-shraddha.6596@gmail.com>
Remove explicit NULL comparison and write it in its simpler form.
Replacement done with coccinelle:
@replace_rule@
expression e;
@@
-e == NULL
+ !e
Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
Change in v2-
Considering cases with != NULL also
drivers/staging/speakup/varhandlers.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/speakup/varhandlers.c b/drivers/staging/speakup/varhandlers.c
index 75bf40c..b2afec6 100644
--- a/drivers/staging/speakup/varhandlers.c
+++ b/drivers/staging/speakup/varhandlers.c
@@ -90,7 +90,7 @@ void speakup_register_var(struct var_t *var)
struct st_var_header *p_header;
BUG_ON(!var || var->var_id < 0 || var->var_id >= MAXVARS);
- if (var_ptrs[0] == NULL) {
+ if (!var_ptrs[0]) {
for (i = 0; i < MAXVARS; i++) {
p_header = &var_headers[i];
var_ptrs[p_header->var_id] = p_header;
@@ -130,7 +130,7 @@ struct st_var_header *spk_get_var_header(enum var_id_t var_id)
if (var_id < 0 || var_id >= MAXVARS)
return NULL;
p_header = var_ptrs[var_id];
- if (p_header->data == NULL)
+ if (!p_header->data)
return NULL;
return p_header;
}
@@ -163,7 +163,7 @@ struct punc_var_t *spk_get_punc_var(enum var_id_t var_id)
struct punc_var_t *where;
where = punc_vars;
- while ((where->var_id != -1) && (rv == NULL)) {
+ while ((where->var_id != -1) && (!rv)) {
if (where->var_id == var_id)
rv = where;
else
@@ -183,7 +183,7 @@ int spk_set_num_var(int input, struct st_var_header *var, int how)
char *cp;
struct var_t *var_data = var->data;
- if (var_data == NULL)
+ if (!var_data)
return -ENODATA;
if (how == E_NEW_DEFAULT) {
@@ -221,9 +221,9 @@ int spk_set_num_var(int input, struct st_var_header *var, int how)
if (var_data->u.n.multiplier != 0)
val *= var_data->u.n.multiplier;
val += var_data->u.n.offset;
- if (var->var_id < FIRST_SYNTH_VAR || synth == NULL)
+ if (var->var_id < FIRST_SYNTH_VAR || !synth)
return ret;
- if (synth->synth_adjust != NULL) {
+ if (synth->synth_adjust) {
int status = synth->synth_adjust(var);
return (status != 0) ? status : ret;
@@ -247,7 +247,7 @@ int spk_set_string_var(const char *page, struct st_var_header *var, int len)
{
struct var_t *var_data = var->data;
- if (var_data == NULL)
+ if (!var_data)
return -ENODATA;
if (len > MAXVARLEN)
return -E2BIG;
@@ -288,7 +288,7 @@ int spk_set_mask_bits(const char *input, const int which, const int how)
if (*cp < SPACE)
break;
if (mask < PUNC) {
- if (!(spk_chartab[*cp]&PUNC))
+ if (!(spk_chartab[*cp] & PUNC))
break;
} else if (spk_chartab[*cp]&B_NUM)
break;
@@ -313,7 +313,7 @@ char *spk_strlwr(char *s)
{
char *p;
- if (s == NULL)
+ if (!s)
return NULL;
for (p = s; *p; p++)
--
2.1.4
prev parent reply other threads:[~2015-09-11 6:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-11 6:02 [PATCH v2 02/16] Staging: speakup: devsynth.c: Remove explicit NULL comparison Shraddha Barke
2015-09-11 6:02 ` [PATCH v2 03/16] Staging: speakup: serialio.c: " Shraddha Barke
2015-09-11 6:02 ` [PATCH v2 04/16] Staging: speakup: kobjects.c: " Shraddha Barke
2015-09-11 6:02 ` Shraddha Barke [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1441951349-5562-4-git-send-email-shraddha.6596@gmail.com \
--to=shraddha.6596@gmail.com \
--cc=Julia.Lawall@lip6.fr \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=samuel.thibault@ens-lyon.org \
--cc=speakup@linux-speakup.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).