From: Christian Egli <christian.egli@alumni.ethz.ch>
To: emacs-orgmode@gnu.org
Cc: Christian Egli <christian.egli@sbszh.ch>
Subject: [PATCH 1/3] Replace recursive implementation with an iterative one
Date: Mon, 21 Mar 2011 16:11:06 +0100 [thread overview]
Message-ID: <1300720268-9375-2-git-send-email-christian.egli@alumni.ethz.ch> (raw)
In-Reply-To: <1300720268-9375-1-git-send-email-christian.egli@alumni.ethz.ch>
From: Christian Egli <christian.egli@sbszh.ch>
* org-taskjuggler.el (org-taskjuggler-assign-resource-ids): Replace
recursive implementation with an iterative one.
That way we can avoid to have ask users to increase
`max-lisp-eval-depth'.
---
lisp/org-taskjuggler.el | 16 +++++++---------
1 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/lisp/org-taskjuggler.el b/lisp/org-taskjuggler.el
index 9c88f5d..279f46d 100644
--- a/lisp/org-taskjuggler.el
+++ b/lisp/org-taskjuggler.el
@@ -418,15 +418,13 @@ deeper), then it's not a leaf."
(defun org-taskjuggler-assign-resource-ids (resources)
"Given a list of resources return the same list, assigning a
unique id to each resource."
- (cond
- ((null resources) nil)
- (t
- (let* ((resource (car resources))
- (unique-id (org-taskjuggler-get-unique-id resource unique-ids)))
- (push (cons "unique-id" unique-id) resource)
- (cons resource
- (org-taskjuggler-assign-resource-ids (cdr resources)
- (cons unique-id unique-ids)))))))
+ (let (unique-ids new-list)
+ (dolist (resource resources new-list)
+ (let ((unique-id (org-taskjuggler-get-unique-id resource unique-ids)))
+ (push (cons "unique-id" unique-id) resource)
+ (push unique-id unique-ids)
+ (push resource new-list)))
+ (nreverse new-list)))
(defun org-taskjuggler-resolve-dependencies (tasks)
(let ((previous-level 0)
--
1.7.1
next prev parent reply other threads:[~2011-03-21 15:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-21 15:11 [PATCH 0/3] Small fixes to taskjuggler export Christian Egli
2011-03-21 15:11 ` Christian Egli [this message]
2011-03-22 9:44 ` [Accepted] [O, 1/3] Replace recursive implementation with an iterative one Bastien Guerry
2011-03-22 9:46 ` Bastien Guerry
2011-03-21 15:11 ` [PATCH 2/3] Fix allocations handling for tj3 Christian Egli
2011-03-22 9:47 ` [Accepted] [O,2/3] " Bastien Guerry
2011-03-21 15:11 ` [PATCH 3/3] Fix a typo in the commentary Christian Egli
2011-03-22 9:47 ` [Accepted] [O,3/3] " Bastien Guerry
2011-03-22 9:49 ` [PATCH 0/3] Small fixes to taskjuggler export Bastien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1300720268-9375-2-git-send-email-christian.egli@alumni.ethz.ch \
--to=christian.egli@alumni.ethz.ch \
--cc=christian.egli@sbszh.ch \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).