Moved spdylay_pq_compar to spdylay_int.h and renamed as spdylay_compar
This commit is contained in:
parent
0eebf89f35
commit
3d7bd0accb
|
@ -33,7 +33,7 @@ lib_LTLIBRARIES = libspdylay.la
|
||||||
|
|
||||||
OBJECTS = spdylay_pq.c
|
OBJECTS = spdylay_pq.c
|
||||||
|
|
||||||
HFILES = spdylay_pq.h
|
HFILES = spdylay_pq.h spdylay_int.h
|
||||||
|
|
||||||
libspdylay_la_SOURCES = $(HFILES) $(OBJECTS)
|
libspdylay_la_SOURCES = $(HFILES) $(OBJECTS)
|
||||||
libspdylay_la_LDFLAGS = -no-undefined \
|
libspdylay_la_LDFLAGS = -no-undefined \
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Spdylay - SPDY Library
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
* the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be
|
||||||
|
* included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
#ifndef SPDYLAY_INT_H
|
||||||
|
#define SPDYLAY_INT_H
|
||||||
|
|
||||||
|
/* Macros, types and constants for internal use */
|
||||||
|
|
||||||
|
typedef int (*spdylay_compar)(const void *lhs, const void *rhs);
|
||||||
|
|
||||||
|
#endif /* SPDYLAY_INT_H */
|
|
@ -24,7 +24,7 @@
|
||||||
*/
|
*/
|
||||||
#include "spdylay_pq.h"
|
#include "spdylay_pq.h"
|
||||||
|
|
||||||
int spdylay_pq_init(spdylay_pq *pq, spdylay_pq_compar compar)
|
int spdylay_pq_init(spdylay_pq *pq, spdylay_compar compar)
|
||||||
{
|
{
|
||||||
pq->capacity = 4096;
|
pq->capacity = 4096;
|
||||||
pq->q = malloc(pq->capacity);
|
pq->q = malloc(pq->capacity);
|
||||||
|
|
|
@ -30,19 +30,18 @@
|
||||||
#endif /* HAVE_CONFIG_H */
|
#endif /* HAVE_CONFIG_H */
|
||||||
|
|
||||||
#include <spdylay/spdylay.h>
|
#include <spdylay/spdylay.h>
|
||||||
|
#include "spdylay_int.h"
|
||||||
|
|
||||||
/* Implementation of priority queue */
|
/* Implementation of priority queue */
|
||||||
|
|
||||||
typedef int (*spdylay_pq_compar)(const void *lhs, const void *rhs);
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void **q;
|
void **q;
|
||||||
size_t length;
|
size_t length;
|
||||||
size_t capacity;
|
size_t capacity;
|
||||||
spdylay_pq_compar compar;
|
spdylay_compar compar;
|
||||||
} spdylay_pq;
|
} spdylay_pq;
|
||||||
|
|
||||||
int spdylay_pq_init(spdylay_pq *pq, spdylay_pq_compar cmp);
|
int spdylay_pq_init(spdylay_pq *pq, spdylay_compar cmp);
|
||||||
|
|
||||||
void spdylay_pq_free(spdylay_pq *pq);
|
void spdylay_pq_free(spdylay_pq *pq);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue