summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2014-04-21 16:00:04 +0000
committerjsing <>2014-04-21 16:00:04 +0000
commit6f6253dccb308bd03c2bc76fc844fe7921d39d7c (patch)
tree62a3c09b7ce2e2a5dfbc08bb696e4b88d12e20e0 /src
parentd1dfa635ce1abedac9b021049b60a56c3911292b (diff)
downloadopenbsd-6f6253dccb308bd03c2bc76fc844fe7921d39d7c.tar.gz
openbsd-6f6253dccb308bd03c2bc76fc844fe7921d39d7c.tar.bz2
openbsd-6f6253dccb308bd03c2bc76fc844fe7921d39d7c.zip
KNF.
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/pqueue/pq_test.c12
-rw-r--r--src/lib/libcrypto/pqueue/pqueue.c137
-rw-r--r--src/lib/libcrypto/pqueue/pqueue.h11
-rw-r--r--src/lib/libssl/src/crypto/pqueue/pq_test.c12
-rw-r--r--src/lib/libssl/src/crypto/pqueue/pqueue.c137
-rw-r--r--src/lib/libssl/src/crypto/pqueue/pqueue.h11
6 files changed, 154 insertions, 166 deletions
diff --git a/src/lib/libcrypto/pqueue/pq_test.c b/src/lib/libcrypto/pqueue/pq_test.c
index 8d496dfc65..4cd785500c 100644
--- a/src/lib/libcrypto/pqueue/pq_test.c
+++ b/src/lib/libcrypto/pqueue/pq_test.c
@@ -1,7 +1,7 @@
1/* crypto/pqueue/pq_test.c */ 1/* crypto/pqueue/pq_test.c */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
5 */ 5 */
6/* ==================================================================== 6/* ====================================================================
7 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 7 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
@@ -11,7 +11,7 @@
11 * are met: 11 * are met:
12 * 12 *
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
15 * 15 *
16 * 2. Redistributions in binary form must reproduce the above copyright 16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in 17 * notice, this list of conditions and the following disclaimer in
@@ -61,7 +61,7 @@
61 61
62int 62int
63main(void) 63main(void)
64 { 64{
65 pitem *item; 65 pitem *item;
66 pqueue pq; 66 pqueue pq;
67 67
@@ -87,9 +87,9 @@ main(void)
87 87
88 pqueue_print(pq); 88 pqueue_print(pq);
89 89
90 for(item = pqueue_pop(pq); item != NULL; item = pqueue_pop(pq)) 90 for (item = pqueue_pop(pq); item != NULL; item = pqueue_pop(pq))
91 pitem_free(item); 91 pitem_free(item);
92 92
93 pqueue_free(pq); 93 pqueue_free(pq);
94 return 0; 94 return 0;
95 } 95}
diff --git a/src/lib/libcrypto/pqueue/pqueue.c b/src/lib/libcrypto/pqueue/pqueue.c
index 3ca8e049e4..5cea75311e 100644
--- a/src/lib/libcrypto/pqueue/pqueue.c
+++ b/src/lib/libcrypto/pqueue/pqueue.c
@@ -1,7 +1,7 @@
1/* crypto/pqueue/pqueue.c */ 1/* crypto/pqueue/pqueue.c */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
5 */ 5 */
6/* ==================================================================== 6/* ====================================================================
7 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 7 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
@@ -11,7 +11,7 @@
11 * are met: 11 * are met:
12 * 12 *
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
15 * 15 *
16 * 2. Redistributions in binary form must reproduce the above copyright 16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in 17 * notice, this list of conditions and the following disclaimer in
@@ -61,190 +61,185 @@
61#include <openssl/bn.h> 61#include <openssl/bn.h>
62#include "pqueue.h" 62#include "pqueue.h"
63 63
64typedef struct _pqueue 64typedef struct _pqueue {
65 {
66 pitem *items; 65 pitem *items;
67 int count; 66 int count;
68 } pqueue_s; 67} pqueue_s;
69 68
70pitem * 69pitem *
71pitem_new(unsigned char *prio64be, void *data) 70pitem_new(unsigned char *prio64be, void *data)
72 { 71{
73 pitem *item = (pitem *) malloc(sizeof(pitem)); 72 pitem *item = (pitem *)malloc(sizeof(pitem));
74 if (item == NULL) return NULL; 73
74 if (item == NULL)
75 return NULL;
75 76
76 memcpy(item->priority,prio64be,sizeof(item->priority)); 77 memcpy(item->priority, prio64be, sizeof(item->priority));
77 78
78 item->data = data; 79 item->data = data;
79 item->next = NULL; 80 item->next = NULL;
80 81
81 return item; 82 return item;
82 } 83}
83 84
84void 85void
85pitem_free(pitem *item) 86pitem_free(pitem *item)
86 { 87{
87 if (item == NULL) return; 88 if (item == NULL)
89 return;
88 90
89 free(item); 91 free(item);
90 } 92}
91 93
92pqueue_s * 94pqueue_s *
93pqueue_new() 95pqueue_new()
94 { 96{
95 pqueue_s *pq = (pqueue_s *) malloc(sizeof(pqueue_s)); 97 pqueue_s *pq = (pqueue_s *)malloc(sizeof(pqueue_s));
96 if (pq == NULL) return NULL; 98
99 if (pq == NULL)
100 return NULL;
97 101
98 memset(pq, 0x00, sizeof(pqueue_s)); 102 memset(pq, 0x00, sizeof(pqueue_s));
99 return pq; 103 return pq;
100 } 104}
101 105
102void 106void
103pqueue_free(pqueue_s *pq) 107pqueue_free(pqueue_s *pq)
104 { 108{
105 if (pq == NULL) return; 109 if (pq == NULL)
110 return;
106 111
107 free(pq); 112 free(pq);
108 } 113}
109 114
110pitem * 115pitem *
111pqueue_insert(pqueue_s *pq, pitem *item) 116pqueue_insert(pqueue_s *pq, pitem *item)
112 { 117{
113 pitem *curr, *next; 118 pitem *curr, *next;
114 119
115 if (pq->items == NULL) 120 if (pq->items == NULL) {
116 {
117 pq->items = item; 121 pq->items = item;
118 return item; 122 return item;
119 } 123 }
120 124
121 for(curr = NULL, next = pq->items; 125 for (curr = NULL, next = pq->items; next != NULL;
122 next != NULL; 126 curr = next, next = next->next) {
123 curr = next, next = next->next)
124 {
125 /* we can compare 64-bit value in big-endian encoding 127 /* we can compare 64-bit value in big-endian encoding
126 * with memcmp:-) */ 128 * with memcmp:-) */
127 int cmp = memcmp(next->priority, item->priority,8); 129 int cmp = memcmp(next->priority, item->priority, 8);
128 if (cmp > 0) /* next > item */ 130 if (cmp > 0) /* next > item */
129 { 131 {
130 item->next = next; 132 item->next = next;
131 133
132 if (curr == NULL) 134 if (curr == NULL)
133 pq->items = item; 135 pq->items = item;
134 else 136 else
135 curr->next = item; 137 curr->next = item;
136 138
137 return item; 139 return item;
138 } 140 } else if (cmp == 0) /* duplicates not allowed */
139
140 else if (cmp == 0) /* duplicates not allowed */
141 return NULL; 141 return NULL;
142 } 142 }
143 143
144 item->next = NULL; 144 item->next = NULL;
145 curr->next = item; 145 curr->next = item;
146 146
147 return item; 147 return item;
148 } 148}
149 149
150pitem * 150pitem *
151pqueue_peek(pqueue_s *pq) 151pqueue_peek(pqueue_s *pq)
152 { 152{
153 return pq->items; 153 return pq->items;
154 } 154}
155 155
156pitem * 156pitem *
157pqueue_pop(pqueue_s *pq) 157pqueue_pop(pqueue_s *pq)
158 { 158{
159 pitem *item = pq->items; 159 pitem *item = pq->items;
160 160
161 if (pq->items != NULL) 161 if (pq->items != NULL)
162 pq->items = pq->items->next; 162 pq->items = pq->items->next;
163 163
164 return item; 164 return item;
165 } 165}
166 166
167pitem * 167pitem *
168pqueue_find(pqueue_s *pq, unsigned char *prio64be) 168pqueue_find(pqueue_s *pq, unsigned char *prio64be)
169 { 169{
170 pitem *next; 170 pitem *next;
171 pitem *found = NULL; 171 pitem *found = NULL;
172 172
173 if ( pq->items == NULL) 173 if (pq->items == NULL)
174 return NULL; 174 return NULL;
175 175
176 for ( next = pq->items; next->next != NULL; next = next->next) 176 for (next = pq->items; next->next != NULL; next = next->next) {
177 { 177 if (memcmp(next->priority, prio64be, 8) == 0) {
178 if ( memcmp(next->priority, prio64be,8) == 0)
179 {
180 found = next; 178 found = next;
181 break; 179 break;
182 }
183 } 180 }
184 181 }
182
185 /* check the one last node */ 183 /* check the one last node */
186 if ( memcmp(next->priority, prio64be,8) ==0) 184 if (memcmp(next->priority, prio64be, 8) ==0)
187 found = next; 185 found = next;
188 186
189 if ( ! found) 187 if (! found)
190 return NULL; 188 return NULL;
191 189
192#if 0 /* find works in peek mode */ 190#if 0 /* find works in peek mode */
193 if ( prev == NULL) 191 if (prev == NULL)
194 pq->items = next->next; 192 pq->items = next->next;
195 else 193 else
196 prev->next = next->next; 194 prev->next = next->next;
197#endif 195#endif
198 196
199 return found; 197 return found;
200 } 198}
201 199
202void 200void
203pqueue_print(pqueue_s *pq) 201pqueue_print(pqueue_s *pq)
204 { 202{
205 pitem *item = pq->items; 203 pitem *item = pq->items;
206 204
207 while(item != NULL) 205 while (item != NULL) {
208 {
209 printf("item\t%02x%02x%02x%02x%02x%02x%02x%02x\n", 206 printf("item\t%02x%02x%02x%02x%02x%02x%02x%02x\n",
210 item->priority[0],item->priority[1], 207 item->priority[0], item->priority[1],
211 item->priority[2],item->priority[3], 208 item->priority[2], item->priority[3],
212 item->priority[4],item->priority[5], 209 item->priority[4], item->priority[5],
213 item->priority[6],item->priority[7]); 210 item->priority[6], item->priority[7]);
214 item = item->next; 211 item = item->next;
215 }
216 } 212 }
213}
217 214
218pitem * 215pitem *
219pqueue_iterator(pqueue_s *pq) 216pqueue_iterator(pqueue_s *pq)
220 { 217{
221 return pqueue_peek(pq); 218 return pqueue_peek(pq);
222 } 219}
223 220
224pitem * 221pitem *
225pqueue_next(pitem **item) 222pqueue_next(pitem **item)
226 { 223{
227 pitem *ret; 224 pitem *ret;
228 225
229 if ( item == NULL || *item == NULL) 226 if (item == NULL || *item == NULL)
230 return NULL; 227 return NULL;
231 228
232
233 /* *item != NULL */ 229 /* *item != NULL */
234 ret = *item; 230 ret = *item;
235 *item = (*item)->next; 231 *item = (*item)->next;
236 232
237 return ret; 233 return ret;
238 } 234}
239 235
240int 236int
241pqueue_size(pqueue_s *pq) 237pqueue_size(pqueue_s *pq)
242{ 238{
243 pitem *item = pq->items; 239 pitem *item = pq->items;
244 int count = 0; 240 int count = 0;
245 241
246 while(item != NULL) 242 while (item != NULL) {
247 {
248 count++; 243 count++;
249 item = item->next; 244 item = item->next;
250 } 245 }
diff --git a/src/lib/libcrypto/pqueue/pqueue.h b/src/lib/libcrypto/pqueue/pqueue.h
index 87fc9037c8..729e9abaf2 100644
--- a/src/lib/libcrypto/pqueue/pqueue.h
+++ b/src/lib/libcrypto/pqueue/pqueue.h
@@ -1,7 +1,7 @@
1/* crypto/pqueue/pqueue.h */ 1/* crypto/pqueue/pqueue.h */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
5 */ 5 */
6/* ==================================================================== 6/* ====================================================================
7 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 7 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
@@ -11,7 +11,7 @@
11 * are met: 11 * are met:
12 * 12 *
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
15 * 15 *
16 * 2. Redistributions in binary form must reproduce the above copyright 16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in 17 * notice, this list of conditions and the following disclaimer in
@@ -66,12 +66,11 @@
66 66
67typedef struct _pqueue *pqueue; 67typedef struct _pqueue *pqueue;
68 68
69typedef struct _pitem 69typedef struct _pitem {
70 {
71 unsigned char priority[8]; /* 64-bit value in big-endian encoding */ 70 unsigned char priority[8]; /* 64-bit value in big-endian encoding */
72 void *data; 71 void *data;
73 struct _pitem *next; 72 struct _pitem *next;
74 } pitem; 73} pitem;
75 74
76typedef struct _pitem *piterator; 75typedef struct _pitem *piterator;
77 76
diff --git a/src/lib/libssl/src/crypto/pqueue/pq_test.c b/src/lib/libssl/src/crypto/pqueue/pq_test.c
index 8d496dfc65..4cd785500c 100644
--- a/src/lib/libssl/src/crypto/pqueue/pq_test.c
+++ b/src/lib/libssl/src/crypto/pqueue/pq_test.c
@@ -1,7 +1,7 @@
1/* crypto/pqueue/pq_test.c */ 1/* crypto/pqueue/pq_test.c */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
5 */ 5 */
6/* ==================================================================== 6/* ====================================================================
7 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 7 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
@@ -11,7 +11,7 @@
11 * are met: 11 * are met:
12 * 12 *
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
15 * 15 *
16 * 2. Redistributions in binary form must reproduce the above copyright 16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in 17 * notice, this list of conditions and the following disclaimer in
@@ -61,7 +61,7 @@
61 61
62int 62int
63main(void) 63main(void)
64 { 64{
65 pitem *item; 65 pitem *item;
66 pqueue pq; 66 pqueue pq;
67 67
@@ -87,9 +87,9 @@ main(void)
87 87
88 pqueue_print(pq); 88 pqueue_print(pq);
89 89
90 for(item = pqueue_pop(pq); item != NULL; item = pqueue_pop(pq)) 90 for (item = pqueue_pop(pq); item != NULL; item = pqueue_pop(pq))
91 pitem_free(item); 91 pitem_free(item);
92 92
93 pqueue_free(pq); 93 pqueue_free(pq);
94 return 0; 94 return 0;
95 } 95}
diff --git a/src/lib/libssl/src/crypto/pqueue/pqueue.c b/src/lib/libssl/src/crypto/pqueue/pqueue.c
index 3ca8e049e4..5cea75311e 100644
--- a/src/lib/libssl/src/crypto/pqueue/pqueue.c
+++ b/src/lib/libssl/src/crypto/pqueue/pqueue.c
@@ -1,7 +1,7 @@
1/* crypto/pqueue/pqueue.c */ 1/* crypto/pqueue/pqueue.c */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
5 */ 5 */
6/* ==================================================================== 6/* ====================================================================
7 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 7 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
@@ -11,7 +11,7 @@
11 * are met: 11 * are met:
12 * 12 *
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
15 * 15 *
16 * 2. Redistributions in binary form must reproduce the above copyright 16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in 17 * notice, this list of conditions and the following disclaimer in
@@ -61,190 +61,185 @@
61#include <openssl/bn.h> 61#include <openssl/bn.h>
62#include "pqueue.h" 62#include "pqueue.h"
63 63
64typedef struct _pqueue 64typedef struct _pqueue {
65 {
66 pitem *items; 65 pitem *items;
67 int count; 66 int count;
68 } pqueue_s; 67} pqueue_s;
69 68
70pitem * 69pitem *
71pitem_new(unsigned char *prio64be, void *data) 70pitem_new(unsigned char *prio64be, void *data)
72 { 71{
73 pitem *item = (pitem *) malloc(sizeof(pitem)); 72 pitem *item = (pitem *)malloc(sizeof(pitem));
74 if (item == NULL) return NULL; 73
74 if (item == NULL)
75 return NULL;
75 76
76 memcpy(item->priority,prio64be,sizeof(item->priority)); 77 memcpy(item->priority, prio64be, sizeof(item->priority));
77 78
78 item->data = data; 79 item->data = data;
79 item->next = NULL; 80 item->next = NULL;
80 81
81 return item; 82 return item;
82 } 83}
83 84
84void 85void
85pitem_free(pitem *item) 86pitem_free(pitem *item)
86 { 87{
87 if (item == NULL) return; 88 if (item == NULL)
89 return;
88 90
89 free(item); 91 free(item);
90 } 92}
91 93
92pqueue_s * 94pqueue_s *
93pqueue_new() 95pqueue_new()
94 { 96{
95 pqueue_s *pq = (pqueue_s *) malloc(sizeof(pqueue_s)); 97 pqueue_s *pq = (pqueue_s *)malloc(sizeof(pqueue_s));
96 if (pq == NULL) return NULL; 98
99 if (pq == NULL)
100 return NULL;
97 101
98 memset(pq, 0x00, sizeof(pqueue_s)); 102 memset(pq, 0x00, sizeof(pqueue_s));
99 return pq; 103 return pq;
100 } 104}
101 105
102void 106void
103pqueue_free(pqueue_s *pq) 107pqueue_free(pqueue_s *pq)
104 { 108{
105 if (pq == NULL) return; 109 if (pq == NULL)
110 return;
106 111
107 free(pq); 112 free(pq);
108 } 113}
109 114
110pitem * 115pitem *
111pqueue_insert(pqueue_s *pq, pitem *item) 116pqueue_insert(pqueue_s *pq, pitem *item)
112 { 117{
113 pitem *curr, *next; 118 pitem *curr, *next;
114 119
115 if (pq->items == NULL) 120 if (pq->items == NULL) {
116 {
117 pq->items = item; 121 pq->items = item;
118 return item; 122 return item;
119 } 123 }
120 124
121 for(curr = NULL, next = pq->items; 125 for (curr = NULL, next = pq->items; next != NULL;
122 next != NULL; 126 curr = next, next = next->next) {
123 curr = next, next = next->next)
124 {
125 /* we can compare 64-bit value in big-endian encoding 127 /* we can compare 64-bit value in big-endian encoding
126 * with memcmp:-) */ 128 * with memcmp:-) */
127 int cmp = memcmp(next->priority, item->priority,8); 129 int cmp = memcmp(next->priority, item->priority, 8);
128 if (cmp > 0) /* next > item */ 130 if (cmp > 0) /* next > item */
129 { 131 {
130 item->next = next; 132 item->next = next;
131 133
132 if (curr == NULL) 134 if (curr == NULL)
133 pq->items = item; 135 pq->items = item;
134 else 136 else
135 curr->next = item; 137 curr->next = item;
136 138
137 return item; 139 return item;
138 } 140 } else if (cmp == 0) /* duplicates not allowed */
139
140 else if (cmp == 0) /* duplicates not allowed */
141 return NULL; 141 return NULL;
142 } 142 }
143 143
144 item->next = NULL; 144 item->next = NULL;
145 curr->next = item; 145 curr->next = item;
146 146
147 return item; 147 return item;
148 } 148}
149 149
150pitem * 150pitem *
151pqueue_peek(pqueue_s *pq) 151pqueue_peek(pqueue_s *pq)
152 { 152{
153 return pq->items; 153 return pq->items;
154 } 154}
155 155
156pitem * 156pitem *
157pqueue_pop(pqueue_s *pq) 157pqueue_pop(pqueue_s *pq)
158 { 158{
159 pitem *item = pq->items; 159 pitem *item = pq->items;
160 160
161 if (pq->items != NULL) 161 if (pq->items != NULL)
162 pq->items = pq->items->next; 162 pq->items = pq->items->next;
163 163
164 return item; 164 return item;
165 } 165}
166 166
167pitem * 167pitem *
168pqueue_find(pqueue_s *pq, unsigned char *prio64be) 168pqueue_find(pqueue_s *pq, unsigned char *prio64be)
169 { 169{
170 pitem *next; 170 pitem *next;
171 pitem *found = NULL; 171 pitem *found = NULL;
172 172
173 if ( pq->items == NULL) 173 if (pq->items == NULL)
174 return NULL; 174 return NULL;
175 175
176 for ( next = pq->items; next->next != NULL; next = next->next) 176 for (next = pq->items; next->next != NULL; next = next->next) {
177 { 177 if (memcmp(next->priority, prio64be, 8) == 0) {
178 if ( memcmp(next->priority, prio64be,8) == 0)
179 {
180 found = next; 178 found = next;
181 break; 179 break;
182 }
183 } 180 }
184 181 }
182
185 /* check the one last node */ 183 /* check the one last node */
186 if ( memcmp(next->priority, prio64be,8) ==0) 184 if (memcmp(next->priority, prio64be, 8) ==0)
187 found = next; 185 found = next;
188 186
189 if ( ! found) 187 if (! found)
190 return NULL; 188 return NULL;
191 189
192#if 0 /* find works in peek mode */ 190#if 0 /* find works in peek mode */
193 if ( prev == NULL) 191 if (prev == NULL)
194 pq->items = next->next; 192 pq->items = next->next;
195 else 193 else
196 prev->next = next->next; 194 prev->next = next->next;
197#endif 195#endif
198 196
199 return found; 197 return found;
200 } 198}
201 199
202void 200void
203pqueue_print(pqueue_s *pq) 201pqueue_print(pqueue_s *pq)
204 { 202{
205 pitem *item = pq->items; 203 pitem *item = pq->items;
206 204
207 while(item != NULL) 205 while (item != NULL) {
208 {
209 printf("item\t%02x%02x%02x%02x%02x%02x%02x%02x\n", 206 printf("item\t%02x%02x%02x%02x%02x%02x%02x%02x\n",
210 item->priority[0],item->priority[1], 207 item->priority[0], item->priority[1],
211 item->priority[2],item->priority[3], 208 item->priority[2], item->priority[3],
212 item->priority[4],item->priority[5], 209 item->priority[4], item->priority[5],
213 item->priority[6],item->priority[7]); 210 item->priority[6], item->priority[7]);
214 item = item->next; 211 item = item->next;
215 }
216 } 212 }
213}
217 214
218pitem * 215pitem *
219pqueue_iterator(pqueue_s *pq) 216pqueue_iterator(pqueue_s *pq)
220 { 217{
221 return pqueue_peek(pq); 218 return pqueue_peek(pq);
222 } 219}
223 220
224pitem * 221pitem *
225pqueue_next(pitem **item) 222pqueue_next(pitem **item)
226 { 223{
227 pitem *ret; 224 pitem *ret;
228 225
229 if ( item == NULL || *item == NULL) 226 if (item == NULL || *item == NULL)
230 return NULL; 227 return NULL;
231 228
232
233 /* *item != NULL */ 229 /* *item != NULL */
234 ret = *item; 230 ret = *item;
235 *item = (*item)->next; 231 *item = (*item)->next;
236 232
237 return ret; 233 return ret;
238 } 234}
239 235
240int 236int
241pqueue_size(pqueue_s *pq) 237pqueue_size(pqueue_s *pq)
242{ 238{
243 pitem *item = pq->items; 239 pitem *item = pq->items;
244 int count = 0; 240 int count = 0;
245 241
246 while(item != NULL) 242 while (item != NULL) {
247 {
248 count++; 243 count++;
249 item = item->next; 244 item = item->next;
250 } 245 }
diff --git a/src/lib/libssl/src/crypto/pqueue/pqueue.h b/src/lib/libssl/src/crypto/pqueue/pqueue.h
index 87fc9037c8..729e9abaf2 100644
--- a/src/lib/libssl/src/crypto/pqueue/pqueue.h
+++ b/src/lib/libssl/src/crypto/pqueue/pqueue.h
@@ -1,7 +1,7 @@
1/* crypto/pqueue/pqueue.h */ 1/* crypto/pqueue/pqueue.h */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
5 */ 5 */
6/* ==================================================================== 6/* ====================================================================
7 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. 7 * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
@@ -11,7 +11,7 @@
11 * are met: 11 * are met:
12 * 12 *
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
15 * 15 *
16 * 2. Redistributions in binary form must reproduce the above copyright 16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in 17 * notice, this list of conditions and the following disclaimer in
@@ -66,12 +66,11 @@
66 66
67typedef struct _pqueue *pqueue; 67typedef struct _pqueue *pqueue;
68 68
69typedef struct _pitem 69typedef struct _pitem {
70 {
71 unsigned char priority[8]; /* 64-bit value in big-endian encoding */ 70 unsigned char priority[8]; /* 64-bit value in big-endian encoding */
72 void *data; 71 void *data;
73 struct _pitem *next; 72 struct _pitem *next;
74 } pitem; 73} pitem;
75 74
76typedef struct _pitem *piterator; 75typedef struct _pitem *piterator;
77 76