]> git.eshelyaron.com Git - emacs.git/commitdiff
Prefer NILP (x) to EQ (x, Qnil)
authorStefan Kangas <stefankangas@gmail.com>
Thu, 4 Jan 2024 00:49:34 +0000 (01:49 +0100)
committerEshel Yaron <me@eshelyaron.com>
Thu, 4 Jan 2024 21:15:47 +0000 (22:15 +0100)
* src/image.c (anim_prune_animation_cache):
Prefer NILP (x) to EQ (x, Qnil).
* admin/coccinelle/nilp.cocci: Semantic patch for above change.

(cherry picked from commit 88ed501abe9666fced46703613c000c26e450ad8)

admin/coccinelle/nilp.cocci [new file with mode: 0644]
src/image.c

diff --git a/admin/coccinelle/nilp.cocci b/admin/coccinelle/nilp.cocci
new file mode 100644 (file)
index 0000000..ccebbbe
--- /dev/null
@@ -0,0 +1,6 @@
+// Prefer NILP (x) to EQ (x, Qnil)
+@@
+expression X;
+@@
+- EQ (X, Qnil)
++ NILP (X)
index f09552c40179fdb3ba6a692f46b93c998e4099d3..dea2730832b69d18d14ce2df6370f4d122dbc2e1 100644 (file)
@@ -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)