[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gpsd-dev
Subject:    [Gpsd-dev] [PATCH] Move the "sub == NULL" check to have all
From:       Beat Bolli <bbolli () ewanet ! ch>
Date:       2010-05-27 13:41:12
Message-ID: 1274967672-3204-1-git-send-email-bbolli () ewanet ! ch
[Download RAW message or body]

I'm not sure about the placement of the nullderef splint directive, though.
---
 gpsd.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gpsd.c b/gpsd.c
index 1480eaa..6f1d3aa 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -1856,15 +1856,15 @@ int main(int argc, char *argv[])
 
 		/* update all subscribers associated with this device */
 		for (sub = subscribers; sub < subscribers + MAXSUBSCRIBERS; sub++) {
-		    if (sub->active == 0)
+		    /*@-nullderef@*/
+		    if (sub == NULL || sub->active == 0)
 			continue;
 
 		    /* report raw packets to users subscribed to those */
 		    raw_report(sub, device);
 
 		    /* some listeners may be in watcher mode */
-		    /*@-nullderef@*/
-		    if (sub != NULL && sub->policy.watcher) {
+		    if (sub->policy.watcher) {
 			if (changed & DATA_IS) {
 			    gpsd_report(LOG_PROG,
 					"Changed mask: %s with %sreliable cycle detection\n",
@@ -1880,7 +1880,7 @@ int main(int argc, char *argv[])
 				json_report(sub, changed, device);
 			}
 		    }
-		    /*@-nullderef@*/
+		    /*@+nullderef@*/
 		} /* subscribers */
 	    }
 	} /* devices */
-- 
1.7.1
_______________________________________________
Gpsd-dev mailing list
Gpsd-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/gpsd-dev
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic