[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 88ed501abe9 1/3: Prefer NILP (x) to EQ (x, Qnil)
From: |
Stefan Kangas |
Subject: |
master 88ed501abe9 1/3: Prefer NILP (x) to EQ (x, Qnil) |
Date: |
Wed, 3 Jan 2024 21:43:13 -0500 (EST) |
branch: master
commit 88ed501abe9666fced46703613c000c26e450ad8
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>
Prefer NILP (x) to EQ (x, Qnil)
* src/image.c (anim_prune_animation_cache):
Prefer NILP (x) to EQ (x, Qnil).
* admin/coccinelle/nilp.cocci: Semantic patch for above change.
---
admin/coccinelle/nilp.cocci | 6 ++++++
src/image.c | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/admin/coccinelle/nilp.cocci b/admin/coccinelle/nilp.cocci
new file mode 100644
index 00000000000..ccebbbe1c80
--- /dev/null
+++ b/admin/coccinelle/nilp.cocci
@@ -0,0 +1,6 @@
+// Prefer NILP (x) to EQ (x, Qnil)
+@@
+expression X;
+@@
+- EQ (X, Qnil)
++ NILP (X)
diff --git a/src/image.c b/src/image.c
index f09552c4017..dea2730832b 100644
--- a/src/image.c
+++ b/src/image.c
@@ -3561,7 +3561,7 @@ anim_prune_animation_cache (Lisp_Object clear)
{
struct anim_cache *cache = *pcache;
if (EQ (clear, Qt)
- || (EQ (clear, Qnil) && timespec_cmp (old, cache->update_time) > 0)
+ || (NILP (clear) && timespec_cmp (old, cache->update_time) > 0)
|| EQ (clear, cache->spec))
{
if (cache->handle)