[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r7996 - in GNUnet/src: applications/dv/module include
From: |
gnunet |
Subject: |
[GNUnet-SVN] r7996 - in GNUnet/src: applications/dv/module include |
Date: |
Mon, 8 Dec 2008 19:16:33 -0700 (MST) |
Author: grothoff
Date: 2008-12-08 19:16:33 -0700 (Mon, 08 Dec 2008)
New Revision: 7996
Modified:
GNUnet/src/applications/dv/module/dv.c
GNUnet/src/include/dv.h
Log:
comments for Nate
Modified: GNUnet/src/applications/dv/module/dv.c
===================================================================
--- GNUnet/src/applications/dv/module/dv.c 2008-12-08 17:01:23 UTC (rev
7995)
+++ GNUnet/src/applications/dv/module/dv.c 2008-12-09 02:16:33 UTC (rev
7996)
@@ -38,15 +38,22 @@
* (more likely sending and receiving incrementally) and . ? . ? .
*/
+// CG: if you must have globals, you MUST make them
+// all "static", we do not want to have
+// a global symbol "closing"!
unsigned long long fisheye_depth;
unsigned long long max_table_size;
unsigned int send_interval = 1000;
+
+// CG: all static/global variables are initially
+// set to zero, so = 0 is superfluous.
unsigned int curr_neighbor_table_size = 0;
unsigned int curr_connected_neighbor_table_size = 0;
unsigned short closing = 0;
static struct GNUNET_ThreadHandle *connectionThread;
+// CG: document each struct
struct GNUNET_dv_neighbor
{
/**
@@ -71,7 +78,6 @@
unsigned int cost;
};
-
struct GNUNET_dv_neighbor *neighbors;
struct GNUNET_dv_neighbor *connected_neighbors;
@@ -419,6 +425,9 @@
return NULL;
}
+// CG: unless defined in a header and used by
+// other C source files (or used with dlsym),'
+// make sure all of your functions are declared "static"
struct GNUNET_dv_neighbor *
chooseToNeighbor ()
{
Modified: GNUnet/src/include/dv.h
===================================================================
--- GNUnet/src/include/dv.h 2008-12-08 17:01:23 UTC (rev 7995)
+++ GNUnet/src/include/dv.h 2008-12-09 02:16:33 UTC (rev 7996)
@@ -41,6 +41,7 @@
* Reserved (for alignment).
*/
unsigned int reserved;
+ // CG: you are not aligning here -- header is 4 bytes!
/**
* Cost from received from node to neighbor node, takes distance into account
@@ -54,14 +55,22 @@
} p2p_dv_MESSAGE_NeighborInfo;
+// CG: not sure any of these prototypes should live
+// here; you need to add comments
+// describing the functions and arguments
+// name all arguments in prototypes, even
+// if C does not require you to do so.
struct GNUNET_dv_neighbor *findNeighbor (const GNUNET_PeerIdentity *, short);
+// CG: NEVER EVER put a "static" function
+// prototype into any header anywhere!
static int
addUpdateNeighbor (const GNUNET_PeerIdentity *, const GNUNET_PeerIdentity *,
unsigned int);
static void initialAddNeighbor (const GNUNET_PeerIdentity *, void *);
+// CG: If a prototype has no arguments, put "void"
struct GNUNET_dv_neighbor *chooseToNeighbor ();
struct GNUNET_dv_neighbor *chooseAboutNeighbor ();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r7996 - in GNUnet/src: applications/dv/module include,
gnunet <=