]> git.saurik.com Git - cycript.git/blobdiff - List.hpp
Drop support for ObjC @implementation expressions.
[cycript.git] / List.hpp
index e4a767e5c02884944cf4af03cce88109b45eec11..30390eb0786795a40f065eabc2088ac85398d8cf 100644 (file)
--- a/List.hpp
+++ b/List.hpp
@@ -1,5 +1,5 @@
 /* Cycript - Optimizing JavaScript Compiler/Runtime
- * Copyright (C) 2009-2014  Jay Freeman (saurik)
+ * Copyright (C) 2009-2015  Jay Freeman (saurik)
 */
 
 /* GNU Affero General Public License, Version 3 {{{ */
@@ -53,14 +53,14 @@ Type_ *&CYSetLast(Type_ *&list) {
 }
 
 template <typename Type_>
-Type_ *CYGetLast(Type_ *list) {
+Type_ *&CYGetLast(Type_ *&list) {
     if (list == NULL)
-        return NULL;
+        return list;
 
-    Type_ *next(list);
-    while (next->next_ != NULL)
-        next = next->next_;
-    return next;
+    Type_ **next(&list);
+    while ((*next)->next_ != NULL)
+        next = &(*next)->next_;
+    return *next;
 }
 
 #define CYForEach(value, list) \