Parse bison output to prevent LexSetRegExp mistakes.
[cycript.git] / List.hpp
index f4762f224875a291ffdffaad9cb30b20995de0ec..6fd07312729b054a8486cfe9123baadb4ee5d4ae 100644 (file)
--- a/List.hpp
+++ b/List.hpp
@@ -42,15 +42,25 @@ struct CYNext {
 };
 
 template <typename Type_>
-Type_ *&CYLast(Type_ *&list) {
+Type_ *&CYSetLast(Type_ *&list) {
     if (list == NULL)
         return list;
-    else {
-        Type_ *next(list);
-        while (next->next_ != NULL)
-            next = next->next_;
-        return next->next_;
-    }
+
+    Type_ *next(list);
+    while (next->next_ != NULL)
+        next = next->next_;
+    return next->next_;
+}
+
+template <typename Type_>
+Type_ *CYGetLast(Type_ *list) {
+    if (list == NULL)
+        return NULL;
+
+    Type_ *next(list);
+    while (next->next_ != NULL)
+        next = next->next_;
+    return next;
 }
 
 #define CYForEach(value, list) \