From: Matthias Braun Date: Tue, 29 Jun 2004 12:12:24 +0000 (+0000) Subject: use a more efficient datastructure in lisp_free X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=fac2546d12241f0c8c4c9cf5a81bc766147f0843;p=supertux.git use a more efficient datastructure in lisp_free SVN-Revision: 1519 --- diff --git a/src/lispreader.cpp b/src/lispreader.cpp index 83b4fbfce..3750b1cf5 100644 --- a/src/lispreader.cpp +++ b/src/lispreader.cpp @@ -21,7 +21,7 @@ * Boston, MA 02111-1307, USA. */ #include -#include +#include #include #include #include @@ -509,12 +509,12 @@ lisp_free (lisp_object_t *obj) /** We have to use this iterative code, because the recursive function * produces a stack overflow and crashs on OSX 10.2 */ - std::queue objs; - objs.push(obj); + std::vector objs; + objs.push_back(obj); while(!objs.empty()) { - lisp_object_t* obj = objs.front(); - objs.pop(); + lisp_object_t* obj = objs.back(); + objs.pop_back(); switch (obj->type) { case LISP_TYPE_INTERNAL : @@ -530,14 +530,14 @@ lisp_free (lisp_object_t *obj) case LISP_TYPE_CONS : case LISP_TYPE_PATTERN_CONS : if(obj->v.cons.car) - objs.push(obj->v.cons.car); + objs.push_back(obj->v.cons.car); if(obj->v.cons.cdr) - objs.push(obj->v.cons.cdr); + objs.push_back(obj->v.cons.cdr); break; case LISP_TYPE_PATTERN_VAR : if(obj->v.pattern.sub) - objs.push(obj->v.pattern.sub); + objs.push_back(obj->v.pattern.sub); break; }