From 6d59c8510ced655b88a325542130870359657ba0 Mon Sep 17 00:00:00 2001 From: kaoru Date: Fri, 1 Jan 2010 12:09:40 +0000 Subject: [PATCH] * pldap.el (ldap-search-entries): Don't use `function' for lambda. (ldap-add-entries, ldap-modify-entries): Use `mapc' instead of `mapcar'. (ldap-delete-entries): Use `mapc' instead of `mapcar'. Don't use `function' for lambda. --- elmo/ChangeLog | 5 ++++ elmo/pldap.el | 85 ++++++++++++++++++++++++++++---------------------------- 2 files changed, 48 insertions(+), 42 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 316fee4..3b4ecc9 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,5 +1,10 @@ 2010-01-01 TAKAHASHI Kaoru + * pldap.el (ldap-search-entries): Don't use `function' for lambda. + (ldap-add-entries, ldap-modify-entries): Use `mapc' instead of `mapcar'. + (ldap-delete-entries): Use `mapc' instead of `mapcar'. Don't use + `function' for lambda. + * modb-standard.el (modb-standard-cleanup-stale-entities): Use `string-to-number' instead of `string-to-int'. diff --git a/elmo/pldap.el b/elmo/pldap.el index b6ae29a..540a2e3 100644 --- a/elmo/pldap.el +++ b/elmo/pldap.el @@ -930,10 +930,10 @@ entry according to the value of WITHDN." (set-buffer-multibyte nil) (if ldap-ignore-attribute-codings result - (mapcar (function - (lambda (record) - (mapcar 'ldap-decode-attribute record))) - result))))) + (mapcar + (lambda (record) + (mapcar 'ldap-decode-attribute record)) + result))))) (defun ldap-add-entries (entries &optional host binddn passwd) "Add entries to an LDAP directory. @@ -961,22 +961,22 @@ PASSWD is the corresponding password" (setq ldap (ldap-open host host-plist)) (if ldap-verbose (message "Adding LDAP entries...")) - (mapcar (lambda (thisentry) - (setcdr thisentry - (mapcar - (lambda (add-spec) - (setq add-spec (ldap-encode-attribute - (list (car add-spec) - (cdr add-spec)))) - (cons (nth 0 add-spec) - (nth 1 add-spec))) - (cdr thisentry))) - (setq thisentry (ldap-encode-attribute thisentry)) - (ldap-add ldap (car thisentry) (cdr thisentry)) - (if ldap-verbose - (message "%d added" i)) - (setq i (1+ i))) - entries) + (mapc (lambda (thisentry) + (setcdr thisentry + (mapcar + (lambda (add-spec) + (setq add-spec (ldap-encode-attribute + (list (car add-spec) + (cdr add-spec)))) + (cons (nth 0 add-spec) + (nth 1 add-spec))) + (cdr thisentry))) + (setq thisentry (ldap-encode-attribute thisentry)) + (ldap-add ldap (car thisentry) (cdr thisentry)) + (if ldap-verbose + (message "%d added" i)) + (setq i (1+ i))) + entries) (ldap-close ldap))) (defun ldap-modify-entries (entry-mods &optional host binddn passwd) @@ -1009,21 +1009,22 @@ PASSWD is the corresponding password" (setq ldap (ldap-open host host-plist)) (if ldap-verbose (message "Modifying LDAP entries...")) - (mapcar (lambda (thisentry) - (setcdr thisentry - (mapcar - (lambda (mod-spec) - (if (or (eq (car mod-spec) 'add) - (eq (car mod-spec) 'replace)) - (append (list (nth 0 mod-spec)) - (ldap-encode-attribute - (cdr mod-spec))))) - (cdr thisentry))) - (ldap-modify ldap (car thisentry) (cdr thisentry)) - (if ldap-verbose - (message "%d modified" i)) - (setq i (1+ i))) - entry-mods) + (mapc + (lambda (thisentry) + (setcdr thisentry + (mapcar + (lambda (mod-spec) + (if (or (eq (car mod-spec) 'add) + (eq (car mod-spec) 'replace)) + (append (list (nth 0 mod-spec)) + (ldap-encode-attribute + (cdr mod-spec))))) + (cdr thisentry))) + (ldap-modify ldap (car thisentry) (cdr thisentry)) + (if ldap-verbose + (message "%d modified" i)) + (setq i (1+ i))) + entry-mods) (ldap-close ldap))) (defun ldap-delete-entries (dn &optional host binddn passwd) @@ -1051,13 +1052,13 @@ PASSWD is the corresponding password." (let ((i 1)) (if ldap-verbose (message "Deleting LDAP entries...")) - (mapcar (function - (lambda (thisdn) - (ldap-delete ldap thisdn) - (if ldap-verbose - (message "%d deleted" i)) - (setq i (1+ i)))) - dn)) + (mapc + (lambda (thisdn) + (ldap-delete ldap thisdn) + (if ldap-verbose + (message "%d deleted" i)) + (setq i (1+ i))) + dn)) (if ldap-verbose (message "Deleting LDAP entry...")) (ldap-delete ldap dn)) -- 1.7.10.4