Gnus development mailing list
 help / color / mirror / Atom feed
From: Christoph Conrad <christoph.conrad@gmx.de>
To: Justus@piater.name
Cc: ding@gnus.org
Subject: Re: nnir.el cleanup
Date: Tue, 22 Apr 2008 19:52:58 +0200	[thread overview]
Message-ID: <87hcdtep8k.fsf@ID-24456.user.uni-berlin.de> (raw)
In-Reply-To: <v9bq44i9b7.fsf@marauder.physik.uni-ulm.de>

Hi Reiner,

> I'm not sure that I understand what you have in mind. Could you
> provide a patch that fixes/silences the Emacs 23 compiler warnings?

See below. One warning remains, i don't understand why.

In nnir-run-namazu:
nnir.el:1475:28:Warning: reference to free variable `dirnam'
nnir.el:1475:28:Warning: reference to free variable `artno'

Possibly it has to do with the usage of nnir-add-result, a macro, but i
don't understand why.

Changelog entry proposal:
Fixed byte compiler warnings, deleted unnecessary code.

I also deleted superfluous settings of variables to nil in a let binding.

I also see some suspicious and potentially dangerous code: the
nnir-run-* functions not supporting the &optional group all define a
local group variable in a let binding with default value nil which
occlude the variable of the parameter list. This is IMHO unnecessary
cause they throw an error at the beginning of the same function when the
group parameter is not nil.

With kind regards,
Christoph

===================================================================
RCS file: /usr/local/cvsroot/gnus/contrib/nnir.el,v
retrieving revision 7.30
diff -u -b -B -w -d -r7.30 nnir.el
--- nnir.el	21 Apr 2008 16:37:45 -0000	7.30
+++ nnir.el	22 Apr 2008 17:47:50 -0000
@@ -760,15 +760,8 @@
 (deffoo nnir-retrieve-headers (articles &optional group server fetch-old)
   (save-excursion
     (let ((artlist (copy-sequence articles))
-          (art nil)
-          (artitem nil)
-          (artgroup nil) (artno nil)
-          (artrsv nil)
-          (artfullgroup nil)
-          (novitem nil)
-          (novdata nil)
-          (foo nil)
-	  server)
+          art artitem artgroup artno artrsv artfullgroup
+          novitem novdata foo server)
       (while (not (null artlist))
         (setq art (car artlist))
         (or (numberp art)
@@ -822,7 +815,7 @@
         (setq artlist (cdr artlist)))
       (setq novdata (nreverse novdata))
       (set-buffer nntp-server-buffer) (erase-buffer)
-      (mapcar 'nnheader-insert-nov novdata)
+      (mapc 'nnheader-insert-nov novdata)
       'nov)))
 
 (deffoo nnir-request-article (article
@@ -879,9 +872,9 @@
 
     ;; Set group to dirnam without any leading dots or slashes,
     ;; and with all subsequent slashes replaced by dots
-    (setq group (gnus-replace-in-string
+    (let ((group (gnus-replace-in-string
                  (gnus-replace-in-string dirnam "^[./\\]" "" t)
-                 "[/\\]" "." t))
+                 "[/\\]" "." t)))
 
     (vector (nnir-group-full-name group server)
 	    (if (string= server "nnmaildir:")
@@ -889,7 +882,7 @@
 		 (substring article 0 (string-match ":" article))
 		 group nil)
 	      (string-to-number article))
-	    (string-to-number score))))
+              (string-to-number score)))))
 
 ;;; Search Engine Interfaces:
 
@@ -902,8 +895,7 @@
   (save-excursion
     (let ((qstring (cdr (assq 'query query)))
 	  (prefix (nnir-read-server-parm 'nnir-wais-remove-prefix server))
-          (artlist nil)
-          (score nil) (artno nil) (dirnam nil) (group nil))
+          artlist score artno dirnam group)
       (set-buffer (get-buffer-create nnir-tmp-buffer))
       (erase-buffer)
       (message "Doing WAIS query %s..." query)
@@ -971,7 +963,7 @@
             (let ((arts 0)
                   (mbx (gnus-group-real-name group)))
               (when (imap-mailbox-select mbx nil buf)
-                (mapcar
+                (mapc
                  (lambda (artnum)
                    (push (vector group artnum 1) artlist)
                    (setq arts (1+ arts)))
@@ -1176,7 +1168,7 @@
     (let ( (qstring (cdr (assq 'query query)))
 	   (groupspec (cdr (assq 'group query)))
 	   (prefix (nnir-read-server-parm 'nnir-swish++-remove-prefix server))
-           (artlist nil)
+           artlist
 	   ;; nnml-use-compressed-files might be any string, but probably this
 	   ;; is sufficient.  Note that we can't only use the value of
 	   ;; nnml-use-compressed-files because old articles might have been
@@ -1184,7 +1176,7 @@
 	   (article-pattern (if (string= server "nnmaildir:")
 				":[0-9]+"
 			      "^[0-9]+\\(\\.[a-z0-9]+\\)?$"))
-           (score nil) (artno nil) (dirnam nil) (group nil) )
+           score artno dirnam group filenam )
 
       (when (equal "" qstring)
         (error "swish++: You didn't enter anything."))
@@ -1266,8 +1258,7 @@
 	  (prefix
 	   (or (nnir-read-server-parm 'nnir-swish-e-remove-prefix server)
 	       (error "Missing parameter `nnir-swish-e-remove-prefix'")))
-	  (artlist nil)
-	  (score nil) (artno nil) (dirnam nil) (group nil) )
+          artlist score artno dirnam group )
 
       (when (equal "" qstring)
         (error "swish-e: You didn't enter anything."))
@@ -1431,18 +1422,13 @@
   (when group
     (error "The Namazu backend cannot search specific groups"))
   (save-excursion
-    (let (
-	  (article-pattern (if (string= server "nnmaildir:")
+    (let ((article-pattern (if (string= server "nnmaildir:")
 			       ":[0-9]+"
 			     "^[0-9]+$"))
-          (artlist nil)
-          (qstring (cdr (assq 'query query)))
+          artlist (qstring (cdr (assq 'query query)))
 	  (prefix (nnir-read-server-parm 'nnir-namazu-remove-prefix server))
-          (score nil)
-          (group nil)
-          (article nil)
-	  (process-environment (copy-sequence process-environment))
-          )
+          score group article
+          (process-environment (copy-sequence process-environment)))
       (setenv "LC_MESSAGES" "C")
       (set-buffer (get-buffer-create nnir-tmp-buffer))
       (erase-buffer)
@@ -1672,7 +1658,7 @@
     ;; from each artitem, extract group component
     (setq with-dups (mapcar 'nnir-artitem-group artlist))
     ;; remove duplicates from above
-    (mapcar (function (lambda (x) (add-to-list 'res x)))
+    (mapc (function (lambda (x) (add-to-list 'res x)))
             with-dups)
     res))
 



  reply	other threads:[~2008-04-22 17:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87y77fiszu.fsf@ID-24456.user.uni-berlin.de>
     [not found] ` <87lk3fvw4l.fsf@ID-24456.user.uni-berlin.de>
     [not found]   ` <873apmapq9.fsf_-_@ID-24456.user.uni-berlin.de>
     [not found]     ` <x8tfxtm2mqc.fsf@tool.montefiore.ulg.ac.be>
2008-04-16 10:50       ` FIX Christoph Conrad
2008-04-16 18:22         ` nnir.el swish++ interface broken (was: FIX) Reiner Steib
2008-04-17  7:20           ` nnir.el swish++ interface broken Justus-bulk
2008-04-17  7:37             ` Christoph Conrad
2008-04-17 18:01               ` Christoph Conrad
2008-04-19 17:36             ` Reiner Steib
2008-04-20  7:48               ` nnir.el cleanup (was Re: nnir.el swish++ interface broken) Justus
2008-04-20 10:09                 ` nnir.el cleanup Reiner Steib
2008-04-20 15:39                   ` Christoph Conrad
2008-04-20 20:02                     ` Reiner Steib
2008-04-22 17:52                       ` Christoph Conrad [this message]
2008-04-24 18:06                         ` Reiner Steib
2008-04-24 18:34                           ` Christoph Conrad
2008-04-24 18:17                         ` Compiler warnings in nnir.el (was: nnir.el cleanup) Reiner Steib
2008-04-25  2:27                           ` Compiler warnings in nnir.el Stefan Monnier
2008-04-20 11:03                 ` nnir.el cleanup (was Re: nnir.el swish++ interface broken) Christoph Conrad
2008-04-21 13:40                 ` Christoph Conrad

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87hcdtep8k.fsf@ID-24456.user.uni-berlin.de \
    --to=christoph.conrad@gmx.de \
    --cc=Justus@piater.name \
    --cc=ding@gnus.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.
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 NNTP newsgroup(s).