Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Unified Diff: openssl/crypto/pqueue/pqueue.c

Issue 9254031: Upgrade chrome's OpenSSL to same version Android ships with. (Closed) Base URL: http://src.chromium.org/svn/trunk/deps/third_party/openssl/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « openssl/crypto/pqueue/pqueue.h ('k') | openssl/crypto/rand/Makefile » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: openssl/crypto/pqueue/pqueue.c
===================================================================
--- openssl/crypto/pqueue/pqueue.c (revision 105093)
+++ openssl/crypto/pqueue/pqueue.c (working copy)
@@ -68,13 +68,12 @@
} pqueue_s;
pitem *
-pitem_new(PQ_64BIT priority, void *data)
+pitem_new(unsigned char *prio64be, void *data)
{
pitem *item = (pitem *) OPENSSL_malloc(sizeof(pitem));
if (item == NULL) return NULL;
- pq_64bit_init(&(item->priority));
- pq_64bit_assign(&item->priority, &priority);
+ memcpy(item->priority,prio64be,sizeof(item->priority));
item->data = data;
item->next = NULL;
@@ -87,7 +86,6 @@
{
if (item == NULL) return;
- pq_64bit_free(&(item->priority));
OPENSSL_free(item);
}
@@ -124,7 +122,10 @@
next != NULL;
curr = next, next = next->next)
{
- if (pq_64bit_gt(&(next->priority), &(item->priority)))
+ /* we can compare 64-bit value in big-endian encoding
+ * with memcmp:-) */
+ int cmp = memcmp(next->priority, item->priority,8);
+ if (cmp > 0) /* next > item */
{
item->next = next;
@@ -135,8 +136,8 @@
return item;
}
- /* duplicates not allowed */
- if (pq_64bit_eq(&(item->priority), &(next->priority)))
+
+ else if (cmp == 0) /* duplicates not allowed */
return NULL;
}
@@ -164,18 +165,17 @@
}
pitem *
-pqueue_find(pqueue_s *pq, PQ_64BIT priority)
+pqueue_find(pqueue_s *pq, unsigned char *prio64be)
{
- pitem *next, *prev = NULL;
+ pitem *next;
pitem *found = NULL;
if ( pq->items == NULL)
return NULL;
- for ( next = pq->items; next->next != NULL;
- prev = next, next = next->next)
+ for ( next = pq->items; next->next != NULL; next = next->next)
{
- if ( pq_64bit_eq(&(next->priority), &priority))
+ if ( memcmp(next->priority, prio64be,8) == 0)
{
found = next;
break;
@@ -183,7 +183,7 @@
}
/* check the one last node */
- if ( pq_64bit_eq(&(next->priority), &priority))
+ if ( memcmp(next->priority, prio64be,8) ==0)
found = next;
if ( ! found)
@@ -199,7 +199,6 @@
return found;
}
-#if PQ_64BIT_IS_INTEGER
void
pqueue_print(pqueue_s *pq)
{
@@ -207,11 +206,14 @@
while(item != NULL)
{
- printf("item\t" PQ_64BIT_PRINT "\n", item->priority);
+ printf("item\t%02x%02x%02x%02x%02x%02x%02x%02x\n",
+ item->priority[0],item->priority[1],
+ item->priority[2],item->priority[3],
+ item->priority[4],item->priority[5],
+ item->priority[6],item->priority[7]);
item = item->next;
}
}
-#endif
pitem *
pqueue_iterator(pqueue_s *pq)
« no previous file with comments | « openssl/crypto/pqueue/pqueue.h ('k') | openssl/crypto/rand/Makefile » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698