X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=ssl%2Fpqueue.c;h=2e9ceeccd92a22c8aac43c36bfd46843d62d4917;hp=b447e1dceb7702f88e18efb8b61c112a9618565b;hb=ada66e78ef535fe80e422bbbadffe8e7863d457c;hpb=846e33c729311169d9c988ceba29484b3783f244 diff --git a/ssl/pqueue.c b/ssl/pqueue.c index b447e1dceb..2e9ceeccd9 100644 --- a/ssl/pqueue.c +++ b/ssl/pqueue.c @@ -1,13 +1,13 @@ /* - * Copyright 2005-2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2005-2018 The OpenSSL Project Authors. All Rights Reserved. * - * Licensed under the OpenSSL license (the "License"). You may not use + * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ -#include "ssl_locl.h" +#include "ssl_local.h" #include struct pqueue_st { @@ -18,14 +18,15 @@ struct pqueue_st { pitem *pitem_new(unsigned char *prio64be, void *data) { pitem *item = OPENSSL_malloc(sizeof(*item)); - if (item == NULL) + + if (item == NULL) { + SSLerr(SSL_F_PITEM_NEW, ERR_R_MALLOC_FAILURE); return NULL; + } memcpy(item->priority, prio64be, sizeof(item->priority)); - item->data = data; item->next = NULL; - return item; } @@ -34,10 +35,13 @@ void pitem_free(pitem *item) OPENSSL_free(item); } -pqueue *pqueue_new() +pqueue *pqueue_new(void) { pqueue *pq = OPENSSL_zalloc(sizeof(*pq)); + if (pq == NULL) + SSLerr(SSL_F_PQUEUE_NEW, ERR_R_MALLOC_FAILURE); + return pq; } @@ -127,7 +131,7 @@ pitem *pqueue_iterator(pqueue *pq) return pqueue_peek(pq); } -pitem *pqueue_next(pitem **item) +pitem *pqueue_next(piterator *item) { pitem *ret; @@ -141,10 +145,10 @@ pitem *pqueue_next(pitem **item) return ret; } -int pqueue_size(pqueue *pq) +size_t pqueue_size(pqueue *pq) { pitem *item = pq->items; - int count = 0; + size_t count = 0; while (item != NULL) { count++;