[ntp:bk-ntp-dev-send] BitKeeper diffs

Harlan Stenn stenn at whimsy.udel.edu
Thu Jun 14 15:45:48 PDT 2007


#### ChangeSet ####
2007-06-14 18:42:17-04:00, stenn at whimsy.udel.edu 
  [Bug 853] get_node() must return a pointer to maximally-aligned memory

==== ChangeLog ====
2007-06-14 18:41:59-04:00, stenn at whimsy.udel.edu +1 -0
  [Bug 853] get_node() must return a pointer to maximally-aligned memory

--- 1.68/ChangeLog	2007-06-14 01:39:42 -04:00
+++ 1.69/ChangeLog	2007-06-14 18:41:59 -04:00
@@ -1,3 +1,4 @@
+* [Bug 853] get_node() must return a pointer to maximally-aligned memory.
 * Leap file fixes from Dave Mills.
 * [Bug 858] Recent leapfile changes broke without OPENSSL.
 * Use a char for DIR_SEP, not a string.

==== include/ntp_data_structures.h ====
2007-06-14 18:42:00-04:00, stenn at whimsy.udel.edu +5 -1
  [Bug 853] get_node() must return a pointer to maximally-aligned memory

--- 1.1/include/ntp_data_structures.h	2007-01-02 23:14:12 -05:00
+++ 1.2/include/ntp_data_structures.h	2007-06-14 18:42:00 -04:00
@@ -19,8 +19,12 @@
  */
 
 typedef struct node {
-    struct node *next;
+	union {
+		struct node *next;
+		double d;
+	} nodeu;
 } node;
+#define node_next nodeu.next
     
 typedef struct Queue {
     int (*get_order)(void *, void *);

==== ntpd/ntp_data_structures.c ====
2007-06-14 18:42:00-04:00, stenn at whimsy.udel.edu +7 -7
  [Bug 853] get_node() must return a pointer to maximally-aligned memory

--- 1.3/ntpd/ntp_data_structures.c	2007-05-16 03:38:44 -04:00
+++ 1.4/ntpd/ntp_data_structures.c	2007-06-14 18:42:00 -04:00
@@ -42,7 +42,7 @@ void destroy_queue(queue *my_queue)
     /* Empty out the queue elements if they are not already empty */
     while (my_queue->front != NULL) {
         temp = my_queue->front;
-        my_queue->front = my_queue->front->next;
+        my_queue->front = my_queue->front->node_next;
         free(temp);
     }
 
@@ -61,7 +61,7 @@ void *get_node(size_t size)
     node *new_node;
     new_node = (node *) malloc(sizeof(node) + size);
     if (new_node != NULL) {
-        new_node->next = NULL; 
+        new_node->node_next = NULL; 
         return new_node + 1;
     }
     else
@@ -94,16 +94,16 @@ queue *enqueue(queue *my_queue, void *my
 
     while (j != NULL && ((*my_queue->get_order)(new_node + 1, j + 1) > 0)) {
         i = j;
-        j = j->next;
+        j = j->node_next;
     }
     
     if (i == NULL) {       /* Insert at beginning of the queue */
-        new_node->next = my_queue->front;
+        new_node->node_next = my_queue->front;
         my_queue->front = new_node;
     }
     else {                /* Insert Elsewhere, including the end */
-        new_node->next = i->next;
-        i->next = new_node;
+        new_node->node_next = i->node_next;
+        i->node_next = new_node;
     }
 
     ++my_queue->no_of_elements;    
@@ -119,7 +119,7 @@ void *dequeue(queue *my_queue)
 {
     node *my_node = my_queue->front;
     if (my_node != NULL) {
-        my_queue->front = my_node->next;
+        my_queue->front = my_node->node_next;
         --my_queue->no_of_elements;    
         return (void *)(my_node + 1);
     }


More information about the bk-ntp-dev-send mailing list