X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/abadba191738e5d27797718fccf50d82ffe7b0b6..1c3dd2c343420160ec2ce76357532f1bf93a5bda:/List.hpp diff --git a/List.hpp b/List.hpp index f4762f2..6fd0731 100644 --- a/List.hpp +++ b/List.hpp @@ -42,15 +42,25 @@ struct CYNext { }; template -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 +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) \