[or-cvs] mainline branch. Remove some more dead XXXs.

Nick Mathewson nickm at seul.org
Tue Apr 18 03:58:44 UTC 2006


Update of /home/or/cvsroot/tor/src/common
In directory moria:/tmp/cvs-serv5766

Modified Files:
	ht.h log.h util.c 
Log Message:
mainline branch.  Remove some more dead XXXs.

Index: ht.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/ht.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -p -d -r1.6 -r1.7
--- ht.h	13 Mar 2006 15:09:49 -0000	1.6
+++ ht.h	18 Apr 2006 03:58:42 -0000	1.7
@@ -188,7 +188,6 @@ ht_string_hash(const char *s)
                        int (*fn)(struct type *, void *),                \
                        void *data)                                      \
   {                                                                     \
-    /* XXXX use tricks to prevent concurrent mod? */                    \
     unsigned idx;                                                       \
     int remove;                                                         \
     struct type **p, **nextp, *next;                                    \
@@ -262,77 +261,6 @@ ht_string_hash(const char *s)
     }                                                                   \
   }
 
-#if 0
-/* Helpers for an iterator type that saves some mod operations at the expense
- * of many branches. Not worth it, it seems. */
-
-#define HT_ITER(type)                               \
-  struct type##_ITER {                              \
-    struct type **hti_nextp;                        \
-    unsigned hti_bucket;                            \
-  }
-
-  static INLINE void                                                    \
-  name##_HT_ITER_START(struct name *head, struct type##_ITER *iter)     \
-  {                                                                     \
-    /* XXXX Magic to stop modifications? */                             \
-    iter->hti_bucket = 0;                                               \
-    while (iter->hti_bucket < head->hth_table_length) {                 \
-      iter->hti_nextp = &head->hth_table[iter->hti_bucket];             \
-      if (*iter->hti_nextp)                                             \
-        return;                                                         \
-      ++iter->hti_bucket;                                               \
-    }                                                                   \
-    iter->hti_nextp = NULL;                                             \
-  }                                                                     \
-  static INLINE int                                                     \
-  name##_HT_ITER_DONE(struct name *head, struct type##_ITER *iter)      \
-  {                                                                     \
-    return iter->hti_nextp == NULL;                                     \
-  }                                                                     \
-  static INLINE struct type *                                           \
-  name##_HT_ITER_GET(struct name *head, struct type##_ITER *iter)       \
-  {                                                                     \
-    return *iter->hti_nextp;                                            \
-  }                                                                     \
-  static INLINE void                                                    \
-  name##_HT_ITER_NEXT(struct name *head, struct type##_ITER *iter)      \
-  {                                                                     \
-    if (!iter->hti_nextp)                                               \
-      return;                                                           \
-    if ((*iter->hti_nextp)->field.hte_next) {                           \
-      iter->hti_nextp = &(*iter->hti_nextp)->field.hte_next;            \
-      return;                                                           \
-    }                                                                   \
-    while (++iter->hti_bucket < head->hth_table_length) {               \
-      iter->hti_nextp = &head->hth_table[iter->hti_bucket];             \
-      if (*iter->hti_nextp)                                             \
-        return;                                                         \
-      ++iter->hti_bucket;                                               \
-    }                                                                   \
-    iter->hti_nextp = NULL;                                             \
-  }                                                                     \
-  static INLINE void                                                    \
-  name##_HT_ITER_NEXT_RMV(struct name *head, struct type##_ITER *iter)  \
-  {                                                                     \
-    if (!iter->hti_nextp)                                               \
-      return;                                                           \
-    --head->hth_n_entries;                                              \
-    if ((*iter->hti_nextp)->field.hte_next) {                           \
-      *iter->hti_nextp = (*iter->hti_nextp)->field.hte_next;            \
-      if (*iter->hti_nextp)                                             \
-        return;                                                         \
-    }                                                                   \
-    while (++iter->hti_bucket < head->hth_table_length) {               \
-      iter->hti_nextp = &head->hth_table[iter->hti_bucket];             \
-      if (*iter->hti_nextp)                                             \
-        return;                                                         \
-      ++iter->hti_bucket;                                               \
-    }                                                                   \
-    iter->hti_nextp = NULL;                                             \
-  }
-#endif
-
 #define HT_GENERATE(name, type, field, hashfn, eqfn, load, mallocfn,    \
                     reallocfn, freefn)                                  \
   static unsigned name##_PRIMES[] = {                                   \

Index: log.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/log.h,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -p -d -r1.68 -r1.69
--- log.h	13 Mar 2006 00:25:36 -0000	1.68
+++ log.h	18 Apr 2006 03:58:42 -0000	1.69
@@ -23,14 +23,12 @@
        "We aren't prepared to deal with that."
 #endif
 #else
-/* XXXX Note: The code was originally written to refer to severities,
- * with 0 being the least severe; while syslog's logging code refers to
- * priorities, with 0 being the most important.  Thus, all our comparisons
- * needed to be reversed when we added syslog support.
+/* Note: Syslog's logging code refers to priorities, with 0 being the most
+ * important.  Thus, all our comparisons needed to be reversed when we added
+ * syslog support.
  *
- * The upshot of this is that comments about log levels may be messed
- * up: for "maximum severity" read "most severe" and "numerically
- * *lowest* severity".
+ * The upshot of this is that comments about log levels may be messed up: for
+ * "maximum severity" read "most severe" and "numerically *lowest* severity".
  */
 
 /** Debug-level severity: for hyper-verbose messages of no interest to

Index: util.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/util.c,v
retrieving revision 1.254
retrieving revision 1.255
diff -u -p -d -r1.254 -r1.255
--- util.c	3 Apr 2006 00:26:51 -0000	1.254
+++ util.c	18 Apr 2006 03:58:42 -0000	1.255
@@ -131,11 +131,11 @@ _tor_malloc(size_t size DMALLOC_PARAMS)
 
   if (!result) {
     log_err(LD_MM,"Out of memory. Dying.");
-    /* XXX if these functions die within a worker process, they won't
-     * call spawn_exit */
+    /* If these functions die within a worker process, they won't call
+     * spawn_exit, but that's ok, since the parent will run out of memory soon
+     * anyway. */
     exit(1);
   }
-//  memset(result,'X',size); /* deadbeef to encourage bugs */
   return result;
 }
 



More information about the tor-commits mailing list