From 87b5e13465752d5e42b97a910d23426565ded4d9 Mon Sep 17 00:00:00 2001
From: Binbin <binloveplay1314@qq.com>
Date: Tue, 15 Oct 2024 10:29:52 +0800
Subject: [PATCH] Use listLast to replace listIndex -1 (#1163)

Minor cleanup, listLast do the same thing and is widely used
and easier to understand (less code).

Signed-off-by: Binbin <binloveplay1314@qq.com>
---
 src/aof.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/aof.c b/src/aof.c
index bc29bb0d9..e0ca6fbb6 100644
--- a/src/aof.c
+++ b/src/aof.c
@@ -476,7 +476,7 @@ sds getLastIncrAofName(aofManifest *am) {
     }
 
     /* Or return the last one. */
-    listNode *lastnode = listIndex(am->incr_aof_list, -1);
+    listNode *lastnode = listLast(am->incr_aof_list);
     aofInfo *ai = listNodeValue(lastnode);
     return ai->file_name;
 }