"Fossies" - the Fresh Open Source Software Archive

Member "redis-5.0.6/src/listpack.h" (25 Sep 2019, 2786 Bytes) of package /linux/misc/redis-5.0.6.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "listpack.h" see the Fossies "Dox" file reference documentation.

    1 /* Listpack -- A lists of strings serialization format
    2  *
    3  * This file implements the specification you can find at:
    4  *
    5  *  https://github.com/antirez/listpack
    6  *
    7  * Copyright (c) 2017, Salvatore Sanfilippo <antirez at gmail dot com>
    8  * All rights reserved.
    9  *
   10  * Redistribution and use in source and binary forms, with or without
   11  * modification, are permitted provided that the following conditions are met:
   12  *
   13  *   * Redistributions of source code must retain the above copyright notice,
   14  *     this list of conditions and the following disclaimer.
   15  *   * Redistributions in binary form must reproduce the above copyright
   16  *     notice, this list of conditions and the following disclaimer in the
   17  *     documentation and/or other materials provided with the distribution.
   18  *   * Neither the name of Redis nor the names of its contributors may be used
   19  *     to endorse or promote products derived from this software without
   20  *     specific prior written permission.
   21  *
   22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   25  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
   26  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   32  * POSSIBILITY OF SUCH DAMAGE.
   33  */
   34 
   35 #ifndef __LISTPACK_H
   36 #define __LISTPACK_H
   37 
   38 #include <stdint.h>
   39 
   40 #define LP_INTBUF_SIZE 21 /* 20 digits of -2^63 + 1 null term = 21. */
   41 
   42 /* lpInsert() where argument possible values: */
   43 #define LP_BEFORE 0
   44 #define LP_AFTER 1
   45 #define LP_REPLACE 2
   46 
   47 unsigned char *lpNew(void);
   48 void lpFree(unsigned char *lp);
   49 unsigned char *lpInsert(unsigned char *lp, unsigned char *ele, uint32_t size, unsigned char *p, int where, unsigned char **newp);
   50 unsigned char *lpAppend(unsigned char *lp, unsigned char *ele, uint32_t size);
   51 unsigned char *lpDelete(unsigned char *lp, unsigned char *p, unsigned char **newp);
   52 uint32_t lpLength(unsigned char *lp);
   53 unsigned char *lpGet(unsigned char *p, int64_t *count, unsigned char *intbuf);
   54 unsigned char *lpFirst(unsigned char *lp);
   55 unsigned char *lpLast(unsigned char *lp);
   56 unsigned char *lpNext(unsigned char *lp, unsigned char *p);
   57 unsigned char *lpPrev(unsigned char *lp, unsigned char *p);
   58 uint32_t lpBytes(unsigned char *lp);
   59 unsigned char *lpSeek(unsigned char *lp, long index);
   60 
   61 #endif