Showing preview only (5,199K chars total). Download the full file or copy to clipboard to get everything.
Repository: huangzworks/redis-3.0-annotated
Branch: unstable
Commit: 8e60a75884e7
Files: 424
Total size: 4.9 MB
Directory structure:
gitextract_qfafq3g7/
├── .gitignore
├── 00-RELEASENOTES
├── BUGS
├── CONTRIBUTING
├── COPYING
├── INSTALL
├── MANIFESTO
├── Makefile
├── README
├── README.rst
├── deps/
│ ├── Makefile
│ ├── hiredis/
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── COPYING
│ │ ├── Makefile
│ │ ├── README.md
│ │ ├── adapters/
│ │ │ ├── ae.h
│ │ │ ├── libev.h
│ │ │ └── libevent.h
│ │ ├── async.c
│ │ ├── async.h
│ │ ├── dict.c
│ │ ├── dict.h
│ │ ├── example-ae.c
│ │ ├── example-libev.c
│ │ ├── example-libevent.c
│ │ ├── example.c
│ │ ├── fmacros.h
│ │ ├── hiredis.c
│ │ ├── hiredis.h
│ │ ├── net.c
│ │ ├── net.h
│ │ ├── sds.c
│ │ ├── sds.h
│ │ ├── test.c
│ │ └── zmalloc.h
│ ├── jemalloc/
│ │ ├── .gitignore
│ │ ├── COPYING
│ │ ├── ChangeLog
│ │ ├── INSTALL
│ │ ├── Makefile.in
│ │ ├── README
│ │ ├── VERSION
│ │ ├── autogen.sh
│ │ ├── bin/
│ │ │ ├── jemalloc.sh.in
│ │ │ └── pprof
│ │ ├── config.guess
│ │ ├── config.stamp.in
│ │ ├── config.sub
│ │ ├── configure
│ │ ├── configure.ac
│ │ ├── doc/
│ │ │ ├── html.xsl.in
│ │ │ ├── jemalloc.3
│ │ │ ├── jemalloc.html
│ │ │ ├── jemalloc.xml.in
│ │ │ ├── manpages.xsl.in
│ │ │ └── stylesheet.xsl
│ │ ├── include/
│ │ │ ├── jemalloc/
│ │ │ │ ├── internal/
│ │ │ │ │ ├── arena.h
│ │ │ │ │ ├── atomic.h
│ │ │ │ │ ├── base.h
│ │ │ │ │ ├── bitmap.h
│ │ │ │ │ ├── chunk.h
│ │ │ │ │ ├── chunk_dss.h
│ │ │ │ │ ├── chunk_mmap.h
│ │ │ │ │ ├── ckh.h
│ │ │ │ │ ├── ctl.h
│ │ │ │ │ ├── extent.h
│ │ │ │ │ ├── hash.h
│ │ │ │ │ ├── huge.h
│ │ │ │ │ ├── jemalloc_internal.h.in
│ │ │ │ │ ├── mb.h
│ │ │ │ │ ├── mutex.h
│ │ │ │ │ ├── private_namespace.h
│ │ │ │ │ ├── prng.h
│ │ │ │ │ ├── prof.h
│ │ │ │ │ ├── ql.h
│ │ │ │ │ ├── qr.h
│ │ │ │ │ ├── quarantine.h
│ │ │ │ │ ├── rb.h
│ │ │ │ │ ├── rtree.h
│ │ │ │ │ ├── size_classes.sh
│ │ │ │ │ ├── stats.h
│ │ │ │ │ ├── tcache.h
│ │ │ │ │ ├── tsd.h
│ │ │ │ │ └── util.h
│ │ │ │ ├── jemalloc.h.in
│ │ │ │ └── jemalloc_defs.h.in
│ │ │ └── msvc_compat/
│ │ │ ├── inttypes.h
│ │ │ ├── stdbool.h
│ │ │ ├── stdint.h
│ │ │ └── strings.h
│ │ ├── install-sh
│ │ ├── src/
│ │ │ ├── arena.c
│ │ │ ├── atomic.c
│ │ │ ├── base.c
│ │ │ ├── bitmap.c
│ │ │ ├── chunk.c
│ │ │ ├── chunk_dss.c
│ │ │ ├── chunk_mmap.c
│ │ │ ├── ckh.c
│ │ │ ├── ctl.c
│ │ │ ├── extent.c
│ │ │ ├── hash.c
│ │ │ ├── huge.c
│ │ │ ├── jemalloc.c
│ │ │ ├── mb.c
│ │ │ ├── mutex.c
│ │ │ ├── prof.c
│ │ │ ├── quarantine.c
│ │ │ ├── rtree.c
│ │ │ ├── stats.c
│ │ │ ├── tcache.c
│ │ │ ├── tsd.c
│ │ │ ├── util.c
│ │ │ └── zone.c
│ │ └── test/
│ │ ├── ALLOCM_ARENA.c
│ │ ├── ALLOCM_ARENA.exp
│ │ ├── aligned_alloc.c
│ │ ├── aligned_alloc.exp
│ │ ├── allocated.c
│ │ ├── allocated.exp
│ │ ├── allocm.c
│ │ ├── allocm.exp
│ │ ├── bitmap.c
│ │ ├── bitmap.exp
│ │ ├── jemalloc_test.h.in
│ │ ├── mremap.c
│ │ ├── mremap.exp
│ │ ├── posix_memalign.c
│ │ ├── posix_memalign.exp
│ │ ├── rallocm.c
│ │ ├── rallocm.exp
│ │ ├── thread_arena.c
│ │ ├── thread_arena.exp
│ │ ├── thread_tcache_enabled.c
│ │ └── thread_tcache_enabled.exp
│ ├── linenoise/
│ │ ├── .gitignore
│ │ ├── Makefile
│ │ ├── README.markdown
│ │ ├── example.c
│ │ ├── linenoise.c
│ │ └── linenoise.h
│ └── lua/
│ ├── COPYRIGHT
│ ├── HISTORY
│ ├── INSTALL
│ ├── Makefile
│ ├── README
│ ├── doc/
│ │ ├── contents.html
│ │ ├── lua.1
│ │ ├── lua.css
│ │ ├── lua.html
│ │ ├── luac.1
│ │ ├── luac.html
│ │ ├── manual.css
│ │ ├── manual.html
│ │ └── readme.html
│ ├── etc/
│ │ ├── Makefile
│ │ ├── README
│ │ ├── all.c
│ │ ├── lua.hpp
│ │ ├── lua.pc
│ │ ├── luavs.bat
│ │ ├── min.c
│ │ ├── noparser.c
│ │ └── strict.lua
│ ├── src/
│ │ ├── Makefile
│ │ ├── lapi.c
│ │ ├── lapi.h
│ │ ├── lauxlib.c
│ │ ├── lauxlib.h
│ │ ├── lbaselib.c
│ │ ├── lcode.c
│ │ ├── lcode.h
│ │ ├── ldblib.c
│ │ ├── ldebug.c
│ │ ├── ldebug.h
│ │ ├── ldo.c
│ │ ├── ldo.h
│ │ ├── ldump.c
│ │ ├── lfunc.c
│ │ ├── lfunc.h
│ │ ├── lgc.c
│ │ ├── lgc.h
│ │ ├── linit.c
│ │ ├── liolib.c
│ │ ├── llex.c
│ │ ├── llex.h
│ │ ├── llimits.h
│ │ ├── lmathlib.c
│ │ ├── lmem.c
│ │ ├── lmem.h
│ │ ├── loadlib.c
│ │ ├── lobject.c
│ │ ├── lobject.h
│ │ ├── lopcodes.c
│ │ ├── lopcodes.h
│ │ ├── loslib.c
│ │ ├── lparser.c
│ │ ├── lparser.h
│ │ ├── lstate.c
│ │ ├── lstate.h
│ │ ├── lstring.c
│ │ ├── lstring.h
│ │ ├── lstrlib.c
│ │ ├── ltable.c
│ │ ├── ltable.h
│ │ ├── ltablib.c
│ │ ├── ltm.c
│ │ ├── ltm.h
│ │ ├── lua.c
│ │ ├── lua.h
│ │ ├── lua_cjson.c
│ │ ├── lua_cmsgpack.c
│ │ ├── lua_struct.c
│ │ ├── luac.c
│ │ ├── luaconf.h
│ │ ├── lualib.h
│ │ ├── lundump.c
│ │ ├── lundump.h
│ │ ├── lvm.c
│ │ ├── lvm.h
│ │ ├── lzio.c
│ │ ├── lzio.h
│ │ ├── print.c
│ │ ├── strbuf.c
│ │ └── strbuf.h
│ └── test/
│ ├── README
│ ├── bisect.lua
│ ├── cf.lua
│ ├── echo.lua
│ ├── env.lua
│ ├── factorial.lua
│ ├── fib.lua
│ ├── fibfor.lua
│ ├── globals.lua
│ ├── hello.lua
│ ├── life.lua
│ ├── luac.lua
│ ├── printf.lua
│ ├── readonly.lua
│ ├── sieve.lua
│ ├── sort.lua
│ ├── table.lua
│ ├── trace-calls.lua
│ ├── trace-globals.lua
│ └── xd.lua
├── redis.conf
├── runtest
├── runtest-cluster
├── runtest-sentinel
├── sentinel.conf
├── src/
│ ├── .gitignore
│ ├── Makefile
│ ├── Makefile.dep
│ ├── adlist.c
│ ├── adlist.h
│ ├── ae.c
│ ├── ae.h
│ ├── ae_epoll.c
│ ├── ae_evport.c
│ ├── ae_kqueue.c
│ ├── ae_select.c
│ ├── anet.c
│ ├── anet.h
│ ├── aof.c
│ ├── asciilogo.h
│ ├── bio.c
│ ├── bio.h
│ ├── bitops.c
│ ├── blocked.c
│ ├── cluster.c
│ ├── cluster.h
│ ├── config.c
│ ├── config.h
│ ├── crc16.c
│ ├── crc64.c
│ ├── crc64.h
│ ├── db.c
│ ├── debug.c
│ ├── dict.c
│ ├── dict.h
│ ├── endianconv.c
│ ├── endianconv.h
│ ├── fmacros.h
│ ├── help.h
│ ├── hyperloglog.c
│ ├── intset.c
│ ├── intset.h
│ ├── lzf.h
│ ├── lzfP.h
│ ├── lzf_c.c
│ ├── lzf_d.c
│ ├── memtest.c
│ ├── mkreleasehdr.sh
│ ├── multi.c
│ ├── networking.c
│ ├── notify.c
│ ├── object.c
│ ├── pqsort.c
│ ├── pqsort.h
│ ├── pubsub.c
│ ├── rand.c
│ ├── rand.h
│ ├── rdb.c
│ ├── rdb.h
│ ├── redis-benchmark.c
│ ├── redis-check-aof.c
│ ├── redis-check-dump.c
│ ├── redis-cli.c
│ ├── redis-trib.rb
│ ├── redis.c
│ ├── redis.h
│ ├── redisassert.h
│ ├── release.c
│ ├── replication.c
│ ├── rio.c
│ ├── rio.h
│ ├── scripting.c
│ ├── sds.c
│ ├── sds.h
│ ├── sentinel.c
│ ├── setproctitle.c
│ ├── sha1.c
│ ├── sha1.h
│ ├── slowlog.c
│ ├── slowlog.h
│ ├── solarisfixes.h
│ ├── sort.c
│ ├── syncio.c
│ ├── t_hash.c
│ ├── t_list.c
│ ├── t_set.c
│ ├── t_string.c
│ ├── t_zset.c
│ ├── testhelp.h
│ ├── util.c
│ ├── util.h
│ ├── valgrind.sup
│ ├── version.h
│ ├── ziplist.c
│ ├── ziplist.h
│ ├── zipmap.c
│ ├── zipmap.h
│ ├── zmalloc.c
│ └── zmalloc.h
├── tests/
│ ├── assets/
│ │ ├── default.conf
│ │ ├── encodings.rdb
│ │ └── hash-zipmap.rdb
│ ├── cluster/
│ │ ├── cluster.tcl
│ │ ├── run.tcl
│ │ └── tests/
│ │ ├── 00-base.tcl
│ │ └── includes/
│ │ └── init-tests.tcl
│ ├── helpers/
│ │ ├── bg_complex_data.tcl
│ │ └── gen_write_load.tcl
│ ├── instances.tcl
│ ├── integration/
│ │ ├── aof-race.tcl
│ │ ├── aof.tcl
│ │ ├── convert-zipmap-hash-on-load.tcl
│ │ ├── rdb.tcl
│ │ ├── redis-cli.tcl
│ │ ├── replication-2.tcl
│ │ ├── replication-3.tcl
│ │ ├── replication-4.tcl
│ │ ├── replication-psync.tcl
│ │ └── replication.tcl
│ ├── sentinel/
│ │ ├── run.tcl
│ │ ├── tests/
│ │ │ ├── 00-base.tcl
│ │ │ ├── 01-conf-update.tcl
│ │ │ ├── 02-slaves-reconf.tcl
│ │ │ ├── 03-runtime-reconf.tcl
│ │ │ ├── 04-slave-selection.tcl
│ │ │ └── includes/
│ │ │ └── init-tests.tcl
│ │ └── tmp/
│ │ └── .gitignore
│ ├── support/
│ │ ├── cluster.tcl
│ │ ├── redis.tcl
│ │ ├── server.tcl
│ │ ├── test.tcl
│ │ ├── tmpfile.tcl
│ │ └── util.tcl
│ ├── test_helper.tcl
│ └── unit/
│ ├── aofrw.tcl
│ ├── auth.tcl
│ ├── basic.tcl
│ ├── bitops.tcl
│ ├── dump.tcl
│ ├── expire.tcl
│ ├── hyperloglog.tcl
│ ├── introspection.tcl
│ ├── limits.tcl
│ ├── maxmemory.tcl
│ ├── memefficiency.tcl
│ ├── multi.tcl
│ ├── obuf-limits.tcl
│ ├── other.tcl
│ ├── printver.tcl
│ ├── protocol.tcl
│ ├── pubsub.tcl
│ ├── quit.tcl
│ ├── scan.tcl
│ ├── scripting.tcl
│ ├── slowlog.tcl
│ ├── sort.tcl
│ └── type/
│ ├── hash.tcl
│ ├── list-2.tcl
│ ├── list-3.tcl
│ ├── list-common.tcl
│ ├── list.tcl
│ ├── set.tcl
│ └── zset.tcl
└── utils/
├── build-static-symbols.tcl
├── generate-command-help.rb
├── hyperloglog/
│ ├── .gitignore
│ ├── hll-err.rb
│ └── hll-gnuplot-graph.rb
├── install_server.sh
├── lru/
│ ├── README
│ └── test-lru.rb
├── mkrelease.sh
├── redis-copy.rb
├── redis-sha1.rb
├── redis_init_script
├── redis_init_script.tpl
├── speed-regression.tcl
└── whatisdoing.sh
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
.*.swp
*.o
*.log
dump.rdb
redis-benchmark
redis-check-aof
redis-check-dump
redis-cli
redis-sentinel
redis-server
doc-tools
release
misc/*
src/release.h
appendonly.aof
SHORT_TERM_TODO
release.h
src/transfer.sh
src/configs
redis.ds
src/redis.conf
deps/lua/src/lua
deps/lua/src/luac
deps/lua/src/liblua.a
.make-*
.prerequisites
*.dSYM
================================================
FILE: 00-RELEASENOTES
================================================
Hello! This file is just a placeholder, since this is the "unstable" branch
of Redis, the place where all the development happens.
There is no release notes for this branch, it gets forked into another branch
every time there is a partial feature freeze in order to eventually create
a new stable release.
Usually "unstable" is stable enough for you to use it in development enviromnets
however you should never use it in production environments. It is possible
to download the latest stable release here:
http://download.redis.io/releases/redis-stable.tar.gz
More information is available at http://redis.io
Happy hacking!
================================================
FILE: BUGS
================================================
Plese check https://github.com/antirez/redis/issues
================================================
FILE: CONTRIBUTING
================================================
Note: by contributing code to the Redis project in any form, including sending
a pull request via Github, a code fragment or patch via private email or
public discussion groups, you agree to release your code under the terms
of the BSD license that you can find in the COPYING file included in the Redis
source distribution. You will include BSD license in the COPYING file within
each source file that you contribute.
# IMPORTANT: HOW TO USE REDIS GITHUB ISSUES
* Github issues SHOULD ONLY BE USED to report bugs, and for DETAILED feature
requests. Everything else belongs to the Redis Google Group.
PLEASE DO NOT POST GENERAL QUESTIONS that are not about bugs or suspected
bugs in the Github issues system. We'll be very happy to help you and provide
all the support in the Redis Google Group.
Redis Google Group address:
https://groups.google.com/forum/?fromgroups#!forum/redis-db
# How to provide a patch for a new feature
1. Drop a message to the Redis Google Group with a proposal of semantics/API.
2. If in step 1 you get an acknowledge from the project leaders, use the
following procedure to submit a patch:
a. Fork Redis on github ( http://help.github.com/fork-a-repo/ )
b. Create a topic branch (git checkout -b my_branch)
c. Push to your branch (git push origin my_branch)
d. Initiate a pull request on github ( http://help.github.com/send-pull-requests/ )
e. Done :)
Thanks!
================================================
FILE: COPYING
================================================
Copyright (c) 2006-2014, Salvatore Sanfilippo
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Redis nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
================================================
FILE: INSTALL
================================================
See README
================================================
FILE: MANIFESTO
================================================
[Note: this is the Redis manifesto, for general information about
installing and running Redis read the README file instead.]
Redis Manifesto
===============
1 - A DSL for Abstract Data Types. Redis is a DSL (Domain Specific Language)
that manipulates abstract data types and implemented as a TCP daemon.
Commands manipulate a key space where keys are binary-safe strings and
values are different kinds of abstract data types. Every data type
represents an abstract version of a fundamental data structure. For instance
Redis Lists are an abstract representation of linked lists. In Redis, the
essence of a data type isn't just the kind of operations that the data types
support, but also the space and time complexity of the data type and the
operations performed upon it.
2 - Memory storage is #1. The Redis data set, composed of defined key-value
pairs, is primarily stored in the computer's memory. The amount of memory in
all kinds of computers, including entry-level servers, is increasing
significantly each year. Memory is fast, and allows Redis to have very
predictable performance. Datasets composed of 10k or 40 millions keys will
perform similarly. Complex data types like Redis Sorted Sets are easy to
implement and manipulate in memory with good performance, making Redis very
simple. Redis will continue to explore alternative options (where data can
be optionally stored on disk, say) but the main goal of the project remains
the development of an in-memory database.
3 - Fundamental data structures for a fundamental API. The Redis API is a direct
consequence of fundamental data structures. APIs can often be arbitrary but
not an API that resembles the nature of fundamental data structures. If we
ever meet intelligent life forms from another part of the universe, they'll
likely know, understand and recognize the same basic data structures we have
in our computer science books. Redis will avoid intermediate layers in API,
so that the complexity is obvious and more complex operations can be
performed as the sum of the basic operations.
4 - Code is like a poem; it's not just something we write to reach some
practical result. Sometimes people that are far from the Redis philosophy
suggest using other code written by other authors (frequently in other
languages) in order to implement something Redis currently lacks. But to us
this is like if Shakespeare decided to end Enrico IV using the Paradiso from
the Divina Commedia. Is using any external code a bad idea? Not at all. Like
in "One Thousand and One Nights" smaller self contained stories are embedded
in a bigger story, we'll be happy to use beautiful self contained libraries
when needed. At the same time, when writing the Redis story we're trying to
write smaller stories that will fit in to other code.
5 - We're against complexity. We believe designing systems is a fight against
complexity. We'll accept to fight the complexity when it's worthwhile but
we'll try hard to recognize when a small feature is not worth 1000s of lines
of code. Most of the time the best way to fight complexity is by not
creating it at all.
6 - Two levels of API. The Redis API has two levels: 1) a subset of the API fits
naturally into a distributed version of Redis and 2) a more complex API that
supports multi-key operations. Both are useful if used judiciously but
there's no way to make the more complex multi-keys API distributed in an
opaque way without violating our other principles. We don't want to provide
the illusion of something that will work magically when actually it can't in
all cases. Instead we'll provide commands to quickly migrate keys from one
instance to another to perform multi-key operations and expose the tradeoffs
to the user.
7 - We optimize for joy. We believe writing code is a lot of hard work, and the
only way it can be worth is by enjoying it. When there is no longer joy in
writing code, the best thing to do is stop. To prevent this, we'll avoid
taking paths that will make Redis less of a joy to develop.
================================================
FILE: Makefile
================================================
# Top level makefile, the real shit is at src/Makefile
default: all
.DEFAULT:
cd src && $(MAKE) $@
install:
cd src && $(MAKE) $@
.PHONY: install
================================================
FILE: README
================================================
Where to find complete Redis documentation?
-------------------------------------------
This README is just a fast "quick start" document. You can find more detailed
documentation at http://redis.io
Building Redis
--------------
Redis can be compiled and used on Linux, OSX, OpenBSD, NetBSD, FreeBSD.
We support big endian and little endian architectures.
It may compile on Solaris derived systems (for instance SmartOS) but our
support for this platform is "best effort" and Redis is not guaranteed to
work as well as in Linux, OSX, and *BSD there.
It is as simple as:
% make
You can run a 32 bit Redis binary using:
% make 32bit
After building Redis is a good idea to test it, using:
% make test
Fixing problems building 32 bit binaries
---------
If after building Redis with a 32 bit target you need to rebuild it
with a 64 bit target, or the other way around, you need to perform a
"make distclean" in the root directory of the Redis distribution.
In case of build errors when trying to build a 32 bit binary of Redis, try
the following steps:
* Install the packages libc6-dev-i386 (also try g++-multilib).
* Try using the following command line instead of "make 32bit":
make CFLAGS="-m32 -march=native" LDFLAGS="-m32"
Allocator
---------
Selecting a non-default memory allocator when building Redis is done by setting
the `MALLOC` environment variable. Redis is compiled and linked against libc
malloc by default, with the exception of jemalloc being the default on Linux
systems. This default was picked because jemalloc has proven to have fewer
fragmentation problems than libc malloc.
To force compiling against libc malloc, use:
% make MALLOC=libc
To compile against jemalloc on Mac OS X systems, use:
% make MALLOC=jemalloc
Verbose build
-------------
Redis will build with a user friendly colorized output by default.
If you want to see a more verbose output use the following:
% make V=1
Running Redis
-------------
To run Redis with the default configuration just type:
% cd src
% ./redis-server
If you want to provide your redis.conf, you have to run it using an additional
parameter (the path of the configuration file):
% cd src
% ./redis-server /path/to/redis.conf
It is possible to alter the Redis configuration passing parameters directly
as options using the command line. Examples:
% ./redis-server --port 9999 --slaveof 127.0.0.1 6379
% ./redis-server /etc/redis/6379.conf --loglevel debug
All the options in redis.conf are also supported as options using the command
line, with exactly the same name.
Playing with Redis
------------------
You can use redis-cli to play with Redis. Start a redis-server instance,
then in another terminal try the following:
% cd src
% ./redis-cli
redis> ping
PONG
redis> set foo bar
OK
redis> get foo
"bar"
redis> incr mycounter
(integer) 1
redis> incr mycounter
(integer) 2
redis>
You can find the list of all the available commands here:
http://redis.io/commands
Installing Redis
-----------------
In order to install Redis binaries into /usr/local/bin just use:
% make install
You can use "make PREFIX=/some/other/directory install" if you wish to use a
different destination.
Make install will just install binaries in your system, but will not configure
init scripts and configuration files in the appropriate place. This is not
needed if you want just to play a bit with Redis, but if you are installing
it the proper way for a production system, we have a script doing this
for Ubuntu and Debian systems:
% cd utils
% ./install_server.sh
The script will ask you a few questions and will setup everything you need
to run Redis properly as a background daemon that will start again on
system reboots.
You'll be able to stop and start Redis using the script named
/etc/init.d/redis_<portnumber>, for instance /etc/init.d/redis_6379.
Code contributions
---
Note: by contributing code to the Redis project in any form, including sending
a pull request via Github, a code fragment or patch via private email or
public discussion groups, you agree to release your code under the terms
of the BSD license that you can find in the COPYING file included in the Redis
source distribution.
Please see the CONTRIBUTING file in this source distribution for more
information.
Enjoy!
================================================
FILE: README.rst
================================================
Redis 3.0 源码注释
============================
本项目是注释版的 Redis 3.0 源码,
原始代码来自: https://github.com/antirez/redis 。
这份注释是我在创作新版《Redis 设计与实现》期间,
为了了解 Redis 的内部实现而制作的,
所有在书中有介绍的内容,
在源码中都进行了相应的注释。
在注释的过程中,
除了少量空格和空行方面的调整外,
没有对原始代码进行任何其他改动,
最大程度地保证了代码的“原汁原味”。
希望这份注释源码能给大家学习和了解 Redis 带来一点帮助。
另外,
`新版《Redis 设计与实现》 <http://RedisBook.com>`_\ 正在各大网店发售中,
希望大家可以多多支持这本书。
Have fun!
| 黄健宏(huangz)
| 2014 年 6 月 28 日
附录:各个源码文件的作用简介
------------------------------
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| 文件 | 作用 |
+===================================================================+===================================================================+
| ``adlist.c`` 、 ``adlist.h`` | 双端链表数据结构的实现。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``ae.c`` 、 ``ae.h`` 、 ``ae_epoll.c`` 、 ``ae_evport.c`` 、 | 事件处理器,以及各个具体实现。 |
| ``ae_kqueue.c`` 、 ``ae_select.c`` | |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``anet.c`` 、 ``anet.h`` | Redis 的异步网络框架,内容主要为对 socket 库的包装。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``aof.c`` | AOF 功能的实现。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``asciilogo.h`` | 保存了 Redis 的 ASCII LOGO 。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``bio.c`` 、 ``bio.h`` | Redis 的后台 I/O 程序,用于将 I/O 操作放到子线程里面执行, |
| | 减少 I/O 操作对主线程的阻塞。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``bitops.c`` | 二进制位操作命令的实现文件。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``blocked.c`` | 用于实现 BLPOP 命令和 WAIT 命令的阻塞效果。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``cluster.c`` 、 ``cluster.h`` | Redis 的集群实现。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``config.c`` 、 ``config.h`` | Redis 的配置管理实现,负责读取并分析配置文件, |
| | 然后根据这些配置修改 Redis 服务器的各个选项。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``crc16.c`` 、 ``crc64.c`` 、 ``crc64.h`` | 计算 CRC 校验和。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``db.c`` | 数据库实现。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``debug.c`` | 调试实现。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``dict.c`` 、 ``dict.h`` | 字典数据结构的实现。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``endianconv.c`` 、 ``endianconv.h`` | 二进制的大端、小端转换函数。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``fmacros.h`` | 一些移植性方面的宏。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``help.h`` | ``utils/generate-command-help.rb`` 程序自动生成的命令帮助信息。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``hyperloglog.c`` | HyperLogLog 数据结构的实现。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``intset.c`` 、 ``intset.h`` | 整数集合数据结构的实现,用于优化 SET 类型。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``lzf_c.c`` 、 ``lzf_d.c`` 、 ``lzf.h`` 、 ``lzfP.h`` | Redis 对字符串和 RDB 文件进行压缩时使用的 LZF 压缩算法的实现。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``Makefile`` 、 ``Makefile.dep`` | 构建文件。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``memtest.c`` | 内存测试。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``mkreleasehdr.sh`` | 用于生成释出信息的脚本。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``multi.c`` | Redis 的事务实现。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``networking.c`` | Redis 的客户端网络操作库, |
| | 用于实现命令请求接收、发送命令回复等工作, |
| | 文件中的函数大多为 write 、 read 、 close 等函数的包装, |
| | 以及各种协议的分析和构建函数。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``notify.c`` | Redis 的数据库通知实现。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``object.c`` | Redis 的对象系统实现。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``pqsort.c`` 、 ``pqsort.h`` | 快速排序(QuickSort)算法的实现。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``pubsub.c`` | 发布与订阅功能的实现。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``rand.c`` 、 ``rand.h`` | 伪随机数生成器。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``rdb.c`` 、 ``rdb.h`` | RDB 持久化功能的实现。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``redisassert.h`` | Redis 自建的断言系统。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``redis-benchmark.c`` | Redis 的性能测试程序。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``redis.c`` | 负责服务器的启动、维护和关闭等事项。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``redis-check-aof.c`` 、 ``redis-check-dump.c`` | RDB 文件和 AOF 文件的合法性检查程序。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``redis-cli.c`` | Redis 客户端的实现。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``redis.h`` | Redis 的主要头文件,记录了 Redis 中的大部分数据结构, |
| | 包括服务器状态和客户端状态。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``redis-trib.rb`` | Redis 集群的管理程序。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``release.c`` 、 ``release.h`` | 记录和生成 Redis 的释出版本信息。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``replication.c`` | 复制功能的实现。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``rio.c`` 、 ``rio.h`` | Redis 对文件 I/O 函数的包装, |
| | 在普通 I/O 函数的基础上增加了显式缓存、以及计算校验和等功能。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``scripting.c`` | 脚本功能的实现。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``sds.c`` 、 ``sds.h`` | SDS 数据结构的实现,SDS 为 Redis 的默认字符串表示。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``sentinel.c`` | Redis Sentinel 的实现。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``setproctitle.c`` | 进程环境设置函数。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``sha1.c`` 、 ``sha1.h`` | SHA1 校验和计算函数。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``slowlog.c`` 、 ``slowlog.h`` | 慢查询功能的实现。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``solarisfixes.h`` | 针对 Solaris 系统的补丁。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``sort.c`` | SORT 命令的实现。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``syncio.c`` | 同步 I/O 操作。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``testhelp.h`` | 测试辅助宏。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``t_hash.c`` 、 ``t_list.c`` 、 ``t_set.c`` 、 ``t_string.c`` 、 | 定义了 Redis 的各种数据类型,以及这些数据类型的命令。 |
| ``t_zset.c`` | |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``util.c`` 、 ``util.h`` | 各种辅助函数。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``valgrind.sup`` | valgrind 的suppression文件。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``version.h`` | 记录了 Redis 的版本号。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``ziplist.c`` 、 ``ziplist.h`` | ZIPLIST 数据结构的实现,用于优化 LIST 类型。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``zipmap.c`` 、 ``zipmap.h`` | ZIPMAP 数据结构的实现,在 Redis 2.6 以前用与优化 HASH 类型, |
| | Redis 2.6 开始已经废弃。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
| ``zmalloc.c`` 、 ``zmalloc.h`` | 内存管理程序。 |
+-------------------------------------------------------------------+-------------------------------------------------------------------+
================================================
FILE: deps/Makefile
================================================
# Redis dependency Makefile
uname_S:= $(shell sh -c 'uname -s 2>/dev/null || echo not')
CCCOLOR="\033[34m"
LINKCOLOR="\033[34;1m"
SRCCOLOR="\033[33m"
BINCOLOR="\033[37;1m"
MAKECOLOR="\033[32;1m"
ENDCOLOR="\033[0m"
default:
@echo "Explicit target required"
.PHONY: default
# Prerequisites target
.make-prerequisites:
@touch $@
# Clean everything when CFLAGS is different
ifneq ($(shell sh -c '[ -f .make-cflags ] && cat .make-cflags || echo none'), $(CFLAGS))
.make-cflags: distclean
-(echo "$(CFLAGS)" > .make-cflags)
.make-prerequisites: .make-cflags
endif
# Clean everything when LDFLAGS is different
ifneq ($(shell sh -c '[ -f .make-ldflags ] && cat .make-ldflags || echo none'), $(LDFLAGS))
.make-ldflags: distclean
-(echo "$(LDFLAGS)" > .make-ldflags)
.make-prerequisites: .make-ldflags
endif
distclean:
-(cd hiredis && $(MAKE) clean) > /dev/null || true
-(cd linenoise && $(MAKE) clean) > /dev/null || true
-(cd lua && $(MAKE) clean) > /dev/null || true
-(cd jemalloc && [ -f Makefile ] && $(MAKE) distclean) > /dev/null || true
-(rm -f .make-*)
.PHONY: distclean
hiredis: .make-prerequisites
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
cd hiredis && $(MAKE) static
.PHONY: hiredis
linenoise: .make-prerequisites
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
cd linenoise && $(MAKE)
.PHONY: linenoise
ifeq ($(uname_S),SunOS)
# Make isinf() available
LUA_CFLAGS= -D__C99FEATURES__=1
endif
LUA_CFLAGS+= -O2 -Wall -DLUA_ANSI $(CFLAGS)
LUA_LDFLAGS+= $(LDFLAGS)
lua: .make-prerequisites
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
cd lua/src && $(MAKE) all CFLAGS="$(LUA_CFLAGS)" MYLDFLAGS="$(LUA_LDFLAGS)"
.PHONY: lua
JEMALLOC_CFLAGS= -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops $(CFLAGS)
JEMALLOC_LDFLAGS= $(LDFLAGS)
jemalloc: .make-prerequisites
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
cd jemalloc && ./configure --with-jemalloc-prefix=je_ --enable-cc-silence CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)"
cd jemalloc && $(MAKE) CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)" lib/libjemalloc.a
.PHONY: jemalloc
================================================
FILE: deps/hiredis/.gitignore
================================================
/hiredis-test
/hiredis-example*
/*.o
/*.so
/*.dylib
/*.a
================================================
FILE: deps/hiredis/CHANGELOG.md
================================================
### 0.10.1
* Makefile overhaul. Important to check out if you override one or more
variables using environment variables or via arguments to the "make" tool.
* Issue #45: Fix potential memory leak for a multi bulk reply with 0 elements
being created by the default reply object functions.
* Issue #43: Don't crash in an asynchronous context when Redis returns an error
reply after the connection has been made (this happens when the maximum
number of connections is reached).
### 0.10.0
* See commit log.
================================================
FILE: deps/hiredis/COPYING
================================================
Copyright (c) 2009-2011, Salvatore Sanfilippo <antirez at gmail dot com>
Copyright (c) 2010-2011, Pieter Noordhuis <pcnoordhuis at gmail dot com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Redis nor the names of its contributors may be used
to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
================================================
FILE: deps/hiredis/Makefile
================================================
# Hiredis Makefile
# Copyright (C) 2010-2011 Salvatore Sanfilippo <antirez at gmail dot com>
# Copyright (C) 2010-2011 Pieter Noordhuis <pcnoordhuis at gmail dot com>
# This file is released under the BSD license, see the COPYING file
OBJ=net.o hiredis.o sds.o async.o
BINS=hiredis-example hiredis-test
LIBNAME=libhiredis
HIREDIS_MAJOR=0
HIREDIS_MINOR=10
# Fallback to gcc when $CC is not in $PATH.
CC:=$(shell sh -c 'type $(CC) >/dev/null 2>/dev/null && echo $(CC) || echo gcc')
OPTIMIZATION?=-O3
WARNINGS=-Wall -W -Wstrict-prototypes -Wwrite-strings
DEBUG?= -g -ggdb
REAL_CFLAGS=$(OPTIMIZATION) -fPIC $(CFLAGS) $(WARNINGS) $(DEBUG) $(ARCH)
REAL_LDFLAGS=$(LDFLAGS) $(ARCH)
DYLIBSUFFIX=so
STLIBSUFFIX=a
DYLIB_MINOR_NAME=$(LIBNAME).$(DYLIBSUFFIX).$(HIREDIS_MAJOR).$(HIREDIS_MINOR)
DYLIB_MAJOR_NAME=$(LIBNAME).$(DYLIBSUFFIX).$(HIREDIS_MAJOR)
DYLIBNAME=$(LIBNAME).$(DYLIBSUFFIX)
DYLIB_MAKE_CMD=$(CC) -shared -Wl,-soname,$(DYLIB_MINOR_NAME) -o $(DYLIBNAME) $(LDFLAGS)
STLIBNAME=$(LIBNAME).$(STLIBSUFFIX)
STLIB_MAKE_CMD=ar rcs $(STLIBNAME)
# Platform-specific overrides
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
ifeq ($(uname_S),SunOS)
REAL_LDFLAGS+= -ldl -lnsl -lsocket
DYLIB_MAKE_CMD=$(CC) -G -o $(DYLIBNAME) -h $(DYLIB_MINOR_NAME) $(LDFLAGS)
INSTALL= cp -r
endif
ifeq ($(uname_S),Darwin)
DYLIBSUFFIX=dylib
DYLIB_MINOR_NAME=$(LIBNAME).$(HIREDIS_MAJOR).$(HIREDIS_MINOR).$(DYLIBSUFFIX)
DYLIB_MAJOR_NAME=$(LIBNAME).$(HIREDIS_MAJOR).$(DYLIBSUFFIX)
DYLIB_MAKE_CMD=$(CC) -shared -Wl,-install_name,$(DYLIB_MINOR_NAME) -o $(DYLIBNAME) $(LDFLAGS)
endif
all: $(DYLIBNAME) $(BINS)
# Deps (use make dep to generate this)
net.o: net.c fmacros.h net.h hiredis.h
async.o: async.c async.h hiredis.h sds.h dict.c dict.h
example.o: example.c hiredis.h
hiredis.o: hiredis.c fmacros.h hiredis.h net.h sds.h
sds.o: sds.c sds.h
test.o: test.c hiredis.h
$(DYLIBNAME): $(OBJ)
$(DYLIB_MAKE_CMD) $(OBJ)
$(STLIBNAME): $(OBJ)
$(STLIB_MAKE_CMD) $(OBJ)
dynamic: $(DYLIBNAME)
static: $(STLIBNAME)
# Binaries:
hiredis-example-libevent: example-libevent.c adapters/libevent.h $(STLIBNAME)
$(CC) -o $@ $(REAL_CFLAGS) $(REAL_LDFLAGS) -levent example-libevent.c $(STLIBNAME)
hiredis-example-libev: example-libev.c adapters/libev.h $(STLIBNAME)
$(CC) -o $@ $(REAL_CFLAGS) $(REAL_LDFLAGS) -lev example-libev.c $(STLIBNAME)
ifndef AE_DIR
hiredis-example-ae:
@echo "Please specify AE_DIR (e.g. <redis repository>/src)"
@false
else
hiredis-example-ae: example-ae.c adapters/ae.h $(STLIBNAME)
$(CC) -o $@ $(REAL_CFLAGS) $(REAL_LDFLAGS) -I$(AE_DIR) $(AE_DIR)/ae.o $(AE_DIR)/zmalloc.o example-ae.c $(STLIBNAME)
endif
hiredis-%: %.o $(STLIBNAME)
$(CC) -o $@ $(REAL_LDFLAGS) $< $(STLIBNAME)
test: hiredis-test
./hiredis-test
check: hiredis-test
echo \
"daemonize yes\n" \
"pidfile /tmp/hiredis-test-redis.pid\n" \
"port 56379\n" \
"bind 127.0.0.1\n" \
"unixsocket /tmp/hiredis-test-redis.sock" \
| redis-server -
./hiredis-test -h 127.0.0.1 -p 56379 -s /tmp/hiredis-test-redis.sock || \
( kill `cat /tmp/hiredis-test-redis.pid` && false )
kill `cat /tmp/hiredis-test-redis.pid`
.c.o:
$(CC) -std=c99 -pedantic -c $(REAL_CFLAGS) $<
clean:
rm -rf $(DYLIBNAME) $(STLIBNAME) $(BINS) hiredis-example* *.o *.gcda *.gcno *.gcov
dep:
$(CC) -MM *.c
# Installation related variables and target
PREFIX?=/usr/local
INCLUDE_PATH?=include/hiredis
LIBRARY_PATH?=lib
INSTALL_INCLUDE_PATH= $(PREFIX)/$(INCLUDE_PATH)
INSTALL_LIBRARY_PATH= $(PREFIX)/$(LIBRARY_PATH)
ifeq ($(uname_S),SunOS)
INSTALL?= cp -r
endif
INSTALL?= cp -a
install: $(DYLIBNAME) $(STLIBNAME)
mkdir -p $(INSTALL_INCLUDE_PATH) $(INSTALL_LIBRARY_PATH)
$(INSTALL) hiredis.h async.h adapters $(INSTALL_INCLUDE_PATH)
$(INSTALL) $(DYLIBNAME) $(INSTALL_LIBRARY_PATH)/$(DYLIB_MINOR_NAME)
cd $(INSTALL_LIBRARY_PATH) && ln -sf $(DYLIB_MINOR_NAME) $(DYLIB_MAJOR_NAME)
cd $(INSTALL_LIBRARY_PATH) && ln -sf $(DYLIB_MAJOR_NAME) $(DYLIBNAME)
$(INSTALL) $(STLIBNAME) $(INSTALL_LIBRARY_PATH)
32bit:
@echo ""
@echo "WARNING: if this fails under Linux you probably need to install libc6-dev-i386"
@echo ""
$(MAKE) CFLAGS="-m32" LDFLAGS="-m32"
gprof:
$(MAKE) CFLAGS="-pg" LDFLAGS="-pg"
gcov:
$(MAKE) CFLAGS="-fprofile-arcs -ftest-coverage" LDFLAGS="-fprofile-arcs"
coverage: gcov
make check
mkdir -p tmp/lcov
lcov -d . -c -o tmp/lcov/hiredis.info
genhtml --legend -o tmp/lcov/report tmp/lcov/hiredis.info
noopt:
$(MAKE) OPTIMIZATION=""
.PHONY: all test check clean dep install 32bit gprof gcov noopt
================================================
FILE: deps/hiredis/README.md
================================================
# HIREDIS
Hiredis is a minimalistic C client library for the [Redis](http://redis.io/) database.
It is minimalistic because it just adds minimal support for the protocol, but
at the same time it uses an high level printf-alike API in order to make it
much higher level than otherwise suggested by its minimal code base and the
lack of explicit bindings for every Redis command.
Apart from supporting sending commands and receiving replies, it comes with
a reply parser that is decoupled from the I/O layer. It
is a stream parser designed for easy reusability, which can for instance be used
in higher level language bindings for efficient reply parsing.
Hiredis only supports the binary-safe Redis protocol, so you can use it with any
Redis version >= 1.2.0.
The library comes with multiple APIs. There is the
*synchronous API*, the *asynchronous API* and the *reply parsing API*.
## UPGRADING
Version 0.9.0 is a major overhaul of hiredis in every aspect. However, upgrading existing
code using hiredis should not be a big pain. The key thing to keep in mind when
upgrading is that hiredis >= 0.9.0 uses a `redisContext*` to keep state, in contrast to
the stateless 0.0.1 that only has a file descriptor to work with.
## Synchronous API
To consume the synchronous API, there are only a few function calls that need to be introduced:
redisContext *redisConnect(const char *ip, int port);
void *redisCommand(redisContext *c, const char *format, ...);
void freeReplyObject(void *reply);
### Connecting
The function `redisConnect` is used to create a so-called `redisContext`. The
context is where Hiredis holds state for a connection. The `redisContext`
struct has an integer `err` field that is non-zero when an the connection is in
an error state. The field `errstr` will contain a string with a description of
the error. More information on errors can be found in the **Errors** section.
After trying to connect to Redis using `redisConnect` you should
check the `err` field to see if establishing the connection was successful:
redisContext *c = redisConnect("127.0.0.1", 6379);
if (c->err) {
printf("Error: %s\n", c->errstr);
// handle error
}
### Sending commands
There are several ways to issue commands to Redis. The first that will be introduced is
`redisCommand`. This function takes a format similar to printf. In the simplest form,
it is used like this:
reply = redisCommand(context, "SET foo bar");
The specifier `%s` interpolates a string in the command, and uses `strlen` to
determine the length of the string:
reply = redisCommand(context, "SET foo %s", value);
When you need to pass binary safe strings in a command, the `%b` specifier can be
used. Together with a pointer to the string, it requires a `size_t` length argument
of the string:
reply = redisCommand(context, "SET foo %b", value, valuelen);
Internally, Hiredis splits the command in different arguments and will
convert it to the protocol used to communicate with Redis.
One or more spaces separates arguments, so you can use the specifiers
anywhere in an argument:
reply = redisCommand(context, "SET key:%s %s", myid, value);
### Using replies
The return value of `redisCommand` holds a reply when the command was
successfully executed. When an error occurs, the return value is `NULL` and
the `err` field in the context will be set (see section on **Errors**).
Once an error is returned the context cannot be reused and you should set up
a new connection.
The standard replies that `redisCommand` are of the type `redisReply`. The
`type` field in the `redisReply` should be used to test what kind of reply
was received:
* **`REDIS_REPLY_STATUS`**:
* The command replied with a status reply. The status string can be accessed using `reply->str`.
The length of this string can be accessed using `reply->len`.
* **`REDIS_REPLY_ERROR`**:
* The command replied with an error. The error string can be accessed identical to `REDIS_REPLY_STATUS`.
* **`REDIS_REPLY_INTEGER`**:
* The command replied with an integer. The integer value can be accessed using the
`reply->integer` field of type `long long`.
* **`REDIS_REPLY_NIL`**:
* The command replied with a **nil** object. There is no data to access.
* **`REDIS_REPLY_STRING`**:
* A bulk (string) reply. The value of the reply can be accessed using `reply->str`.
The length of this string can be accessed using `reply->len`.
* **`REDIS_REPLY_ARRAY`**:
* A multi bulk reply. The number of elements in the multi bulk reply is stored in
`reply->elements`. Every element in the multi bulk reply is a `redisReply` object as well
and can be accessed via `reply->element[..index..]`.
Redis may reply with nested arrays but this is fully supported.
Replies should be freed using the `freeReplyObject()` function.
Note that this function will take care of freeing sub-replies objects
contained in arrays and nested arrays, so there is no need for the user to
free the sub replies (it is actually harmful and will corrupt the memory).
**Important:** the current version of hiredis (0.10.0) free's replies when the
asynchronous API is used. This means you should not call `freeReplyObject` when
you use this API. The reply is cleaned up by hiredis _after_ the callback
returns. This behavior will probably change in future releases, so make sure to
keep an eye on the changelog when upgrading (see issue #39).
### Cleaning up
To disconnect and free the context the following function can be used:
void redisFree(redisContext *c);
This function immediately closes the socket and then free's the allocations done in
creating the context.
### Sending commands (cont'd)
Together with `redisCommand`, the function `redisCommandArgv` can be used to issue commands.
It has the following prototype:
void *redisCommandArgv(redisContext *c, int argc, const char **argv, const size_t *argvlen);
It takes the number of arguments `argc`, an array of strings `argv` and the lengths of the
arguments `argvlen`. For convenience, `argvlen` may be set to `NULL` and the function will
use `strlen(3)` on every argument to determine its length. Obviously, when any of the arguments
need to be binary safe, the entire array of lengths `argvlen` should be provided.
The return value has the same semantic as `redisCommand`.
### Pipelining
To explain how Hiredis supports pipelining in a blocking connection, there needs to be
understanding of the internal execution flow.
When any of the functions in the `redisCommand` family is called, Hiredis first formats the
command according to the Redis protocol. The formatted command is then put in the output buffer
of the context. This output buffer is dynamic, so it can hold any number of commands.
After the command is put in the output buffer, `redisGetReply` is called. This function has the
following two execution paths:
1. The input buffer is non-empty:
* Try to parse a single reply from the input buffer and return it
* If no reply could be parsed, continue at *2*
2. The input buffer is empty:
* Write the **entire** output buffer to the socket
* Read from the socket until a single reply could be parsed
The function `redisGetReply` is exported as part of the Hiredis API and can be used when a reply
is expected on the socket. To pipeline commands, the only things that needs to be done is
filling up the output buffer. For this cause, two commands can be used that are identical
to the `redisCommand` family, apart from not returning a reply:
void redisAppendCommand(redisContext *c, const char *format, ...);
void redisAppendCommandArgv(redisContext *c, int argc, const char **argv, const size_t *argvlen);
After calling either function one or more times, `redisGetReply` can be used to receive the
subsequent replies. The return value for this function is either `REDIS_OK` or `REDIS_ERR`, where
the latter means an error occurred while reading a reply. Just as with the other commands,
the `err` field in the context can be used to find out what the cause of this error is.
The following examples shows a simple pipeline (resulting in only a single call to `write(2)` and
a single call to `read(2)`):
redisReply *reply;
redisAppendCommand(context,"SET foo bar");
redisAppendCommand(context,"GET foo");
redisGetReply(context,&reply); // reply for SET
freeReplyObject(reply);
redisGetReply(context,&reply); // reply for GET
freeReplyObject(reply);
This API can also be used to implement a blocking subscriber:
reply = redisCommand(context,"SUBSCRIBE foo");
freeReplyObject(reply);
while(redisGetReply(context,&reply) == REDIS_OK) {
// consume message
freeReplyObject(reply);
}
### Errors
When a function call is not successful, depending on the function either `NULL` or `REDIS_ERR` is
returned. The `err` field inside the context will be non-zero and set to one of the
following constants:
* **`REDIS_ERR_IO`**:
There was an I/O error while creating the connection, trying to write
to the socket or read from the socket. If you included `errno.h` in your
application, you can use the global `errno` variable to find out what is
wrong.
* **`REDIS_ERR_EOF`**:
The server closed the connection which resulted in an empty read.
* **`REDIS_ERR_PROTOCOL`**:
There was an error while parsing the protocol.
* **`REDIS_ERR_OTHER`**:
Any other error. Currently, it is only used when a specified hostname to connect
to cannot be resolved.
In every case, the `errstr` field in the context will be set to hold a string representation
of the error.
## Asynchronous API
Hiredis comes with an asynchronous API that works easily with any event library.
Examples are bundled that show using Hiredis with [libev](http://software.schmorp.de/pkg/libev.html)
and [libevent](http://monkey.org/~provos/libevent/).
### Connecting
The function `redisAsyncConnect` can be used to establish a non-blocking connection to
Redis. It returns a pointer to the newly created `redisAsyncContext` struct. The `err` field
should be checked after creation to see if there were errors creating the connection.
Because the connection that will be created is non-blocking, the kernel is not able to
instantly return if the specified host and port is able to accept a connection.
redisAsyncContext *c = redisAsyncConnect("127.0.0.1", 6379);
if (c->err) {
printf("Error: %s\n", c->errstr);
// handle error
}
The asynchronous context can hold a disconnect callback function that is called when the
connection is disconnected (either because of an error or per user request). This function should
have the following prototype:
void(const redisAsyncContext *c, int status);
On a disconnect, the `status` argument is set to `REDIS_OK` when disconnection was initiated by the
user, or `REDIS_ERR` when the disconnection was caused by an error. When it is `REDIS_ERR`, the `err`
field in the context can be accessed to find out the cause of the error.
The context object is always free'd after the disconnect callback fired. When a reconnect is needed,
the disconnect callback is a good point to do so.
Setting the disconnect callback can only be done once per context. For subsequent calls it will
return `REDIS_ERR`. The function to set the disconnect callback has the following prototype:
int redisAsyncSetDisconnectCallback(redisAsyncContext *ac, redisDisconnectCallback *fn);
### Sending commands and their callbacks
In an asynchronous context, commands are automatically pipelined due to the nature of an event loop.
Therefore, unlike the synchronous API, there is only a single way to send commands.
Because commands are sent to Redis asynchronously, issuing a command requires a callback function
that is called when the reply is received. Reply callbacks should have the following prototype:
void(redisAsyncContext *c, void *reply, void *privdata);
The `privdata` argument can be used to curry arbitrary data to the callback from the point where
the command is initially queued for execution.
The functions that can be used to issue commands in an asynchronous context are:
int redisAsyncCommand(
redisAsyncContext *ac, redisCallbackFn *fn, void *privdata,
const char *format, ...);
int redisAsyncCommandArgv(
redisAsyncContext *ac, redisCallbackFn *fn, void *privdata,
int argc, const char **argv, const size_t *argvlen);
Both functions work like their blocking counterparts. The return value is `REDIS_OK` when the command
was successfully added to the output buffer and `REDIS_ERR` otherwise. Example: when the connection
is being disconnected per user-request, no new commands may be added to the output buffer and `REDIS_ERR` is
returned on calls to the `redisAsyncCommand` family.
If the reply for a command with a `NULL` callback is read, it is immediately free'd. When the callback
for a command is non-`NULL`, the memory is free'd immediately following the callback: the reply is only
valid for the duration of the callback.
All pending callbacks are called with a `NULL` reply when the context encountered an error.
### Disconnecting
An asynchronous connection can be terminated using:
void redisAsyncDisconnect(redisAsyncContext *ac);
When this function is called, the connection is **not** immediately terminated. Instead, new
commands are no longer accepted and the connection is only terminated when all pending commands
have been written to the socket, their respective replies have been read and their respective
callbacks have been executed. After this, the disconnection callback is executed with the
`REDIS_OK` status and the context object is free'd.
### Hooking it up to event library *X*
There are a few hooks that need to be set on the context object after it is created.
See the `adapters/` directory for bindings to *libev* and *libevent*.
## Reply parsing API
Hiredis comes with a reply parsing API that makes it easy for writing higher
level language bindings.
The reply parsing API consists of the following functions:
redisReader *redisReaderCreate(void);
void redisReaderFree(redisReader *reader);
int redisReaderFeed(redisReader *reader, const char *buf, size_t len);
int redisReaderGetReply(redisReader *reader, void **reply);
The same set of functions are used internally by hiredis when creating a
normal Redis context, the above API just exposes it to the user for a direct
usage.
### Usage
The function `redisReaderCreate` creates a `redisReader` structure that holds a
buffer with unparsed data and state for the protocol parser.
Incoming data -- most likely from a socket -- can be placed in the internal
buffer of the `redisReader` using `redisReaderFeed`. This function will make a
copy of the buffer pointed to by `buf` for `len` bytes. This data is parsed
when `redisReaderGetReply` is called. This function returns an integer status
and a reply object (as described above) via `void **reply`. The returned status
can be either `REDIS_OK` or `REDIS_ERR`, where the latter means something went
wrong (either a protocol error, or an out of memory error).
### Customizing replies
The function `redisReaderGetReply` creates `redisReply` and makes the function
argument `reply` point to the created `redisReply` variable. For instance, if
the response of type `REDIS_REPLY_STATUS` then the `str` field of `redisReply`
will hold the status as a vanilla C string. However, the functions that are
responsible for creating instances of the `redisReply` can be customized by
setting the `fn` field on the `redisReader` struct. This should be done
immediately after creating the `redisReader`.
For example, [hiredis-rb](https://github.com/pietern/hiredis-rb/blob/master/ext/hiredis_ext/reader.c)
uses customized reply object functions to create Ruby objects.
### Reader max buffer
Both when using the Reader API directly or when using it indirectly via a
normal Redis context, the redisReader structure uses a buffer in order to
accumulate data from the server.
Usually this buffer is destroyed when it is empty and is larger than 16
kb in order to avoid wasting memory in unused buffers
However when working with very big payloads destroying the buffer may slow
down performances considerably, so it is possible to modify the max size of
an idle buffer changing the value of the `maxbuf` field of the reader structure
to the desired value. The special value of 0 means that there is no maximum
value for an idle buffer, so the buffer will never get freed.
For instance if you have a normal Redis context you can set the maximum idle
buffer to zero (unlimited) just with:
context->reader->maxbuf = 0;
This should be done only in order to maximize performances when working with
large payloads. The context should be set back to `REDIS_READER_MAX_BUF` again
as soon as possible in order to prevent allocation of useless memory.
## AUTHORS
Hiredis was written by Salvatore Sanfilippo (antirez at gmail) and
Pieter Noordhuis (pcnoordhuis at gmail) and is released under the BSD license.
================================================
FILE: deps/hiredis/adapters/ae.h
================================================
/*
* Copyright (c) 2010-2011, Pieter Noordhuis <pcnoordhuis at gmail dot com>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Redis nor the names of its contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __HIREDIS_AE_H__
#define __HIREDIS_AE_H__
#include <sys/types.h>
#include <ae.h>
#include "../hiredis.h"
#include "../async.h"
typedef struct redisAeEvents {
redisAsyncContext *context;
aeEventLoop *loop;
int fd;
int reading, writing;
} redisAeEvents;
static void redisAeReadEvent(aeEventLoop *el, int fd, void *privdata, int mask) {
((void)el); ((void)fd); ((void)mask);
redisAeEvents *e = (redisAeEvents*)privdata;
redisAsyncHandleRead(e->context);
}
static void redisAeWriteEvent(aeEventLoop *el, int fd, void *privdata, int mask) {
((void)el); ((void)fd); ((void)mask);
redisAeEvents *e = (redisAeEvents*)privdata;
redisAsyncHandleWrite(e->context);
}
static void redisAeAddRead(void *privdata) {
redisAeEvents *e = (redisAeEvents*)privdata;
aeEventLoop *loop = e->loop;
if (!e->reading) {
e->reading = 1;
aeCreateFileEvent(loop,e->fd,AE_READABLE,redisAeReadEvent,e);
}
}
static void redisAeDelRead(void *privdata) {
redisAeEvents *e = (redisAeEvents*)privdata;
aeEventLoop *loop = e->loop;
if (e->reading) {
e->reading = 0;
aeDeleteFileEvent(loop,e->fd,AE_READABLE);
}
}
static void redisAeAddWrite(void *privdata) {
redisAeEvents *e = (redisAeEvents*)privdata;
aeEventLoop *loop = e->loop;
if (!e->writing) {
e->writing = 1;
aeCreateFileEvent(loop,e->fd,AE_WRITABLE,redisAeWriteEvent,e);
}
}
static void redisAeDelWrite(void *privdata) {
redisAeEvents *e = (redisAeEvents*)privdata;
aeEventLoop *loop = e->loop;
if (e->writing) {
e->writing = 0;
aeDeleteFileEvent(loop,e->fd,AE_WRITABLE);
}
}
static void redisAeCleanup(void *privdata) {
redisAeEvents *e = (redisAeEvents*)privdata;
redisAeDelRead(privdata);
redisAeDelWrite(privdata);
free(e);
}
static int redisAeAttach(aeEventLoop *loop, redisAsyncContext *ac) {
redisContext *c = &(ac->c);
redisAeEvents *e;
/* Nothing should be attached when something is already attached */
if (ac->ev.data != NULL)
return REDIS_ERR;
/* Create container for context and r/w events */
e = (redisAeEvents*)malloc(sizeof(*e));
e->context = ac;
e->loop = loop;
e->fd = c->fd;
e->reading = e->writing = 0;
/* Register functions to start/stop listening for events */
ac->ev.addRead = redisAeAddRead;
ac->ev.delRead = redisAeDelRead;
ac->ev.addWrite = redisAeAddWrite;
ac->ev.delWrite = redisAeDelWrite;
ac->ev.cleanup = redisAeCleanup;
ac->ev.data = e;
return REDIS_OK;
}
#endif
================================================
FILE: deps/hiredis/adapters/libev.h
================================================
/*
* Copyright (c) 2010-2011, Pieter Noordhuis <pcnoordhuis at gmail dot com>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Redis nor the names of its contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __HIREDIS_LIBEV_H__
#define __HIREDIS_LIBEV_H__
#include <stdlib.h>
#include <sys/types.h>
#include <ev.h>
#include "../hiredis.h"
#include "../async.h"
typedef struct redisLibevEvents {
redisAsyncContext *context;
struct ev_loop *loop;
int reading, writing;
ev_io rev, wev;
} redisLibevEvents;
static void redisLibevReadEvent(EV_P_ ev_io *watcher, int revents) {
#if EV_MULTIPLICITY
((void)loop);
#endif
((void)revents);
redisLibevEvents *e = (redisLibevEvents*)watcher->data;
redisAsyncHandleRead(e->context);
}
static void redisLibevWriteEvent(EV_P_ ev_io *watcher, int revents) {
#if EV_MULTIPLICITY
((void)loop);
#endif
((void)revents);
redisLibevEvents *e = (redisLibevEvents*)watcher->data;
redisAsyncHandleWrite(e->context);
}
static void redisLibevAddRead(void *privdata) {
redisLibevEvents *e = (redisLibevEvents*)privdata;
struct ev_loop *loop = e->loop;
((void)loop);
if (!e->reading) {
e->reading = 1;
ev_io_start(EV_A_ &e->rev);
}
}
static void redisLibevDelRead(void *privdata) {
redisLibevEvents *e = (redisLibevEvents*)privdata;
struct ev_loop *loop = e->loop;
((void)loop);
if (e->reading) {
e->reading = 0;
ev_io_stop(EV_A_ &e->rev);
}
}
static void redisLibevAddWrite(void *privdata) {
redisLibevEvents *e = (redisLibevEvents*)privdata;
struct ev_loop *loop = e->loop;
((void)loop);
if (!e->writing) {
e->writing = 1;
ev_io_start(EV_A_ &e->wev);
}
}
static void redisLibevDelWrite(void *privdata) {
redisLibevEvents *e = (redisLibevEvents*)privdata;
struct ev_loop *loop = e->loop;
((void)loop);
if (e->writing) {
e->writing = 0;
ev_io_stop(EV_A_ &e->wev);
}
}
static void redisLibevCleanup(void *privdata) {
redisLibevEvents *e = (redisLibevEvents*)privdata;
redisLibevDelRead(privdata);
redisLibevDelWrite(privdata);
free(e);
}
static int redisLibevAttach(EV_P_ redisAsyncContext *ac) {
redisContext *c = &(ac->c);
redisLibevEvents *e;
/* Nothing should be attached when something is already attached */
if (ac->ev.data != NULL)
return REDIS_ERR;
/* Create container for context and r/w events */
e = (redisLibevEvents*)malloc(sizeof(*e));
e->context = ac;
#if EV_MULTIPLICITY
e->loop = loop;
#else
e->loop = NULL;
#endif
e->reading = e->writing = 0;
e->rev.data = e;
e->wev.data = e;
/* Register functions to start/stop listening for events */
ac->ev.addRead = redisLibevAddRead;
ac->ev.delRead = redisLibevDelRead;
ac->ev.addWrite = redisLibevAddWrite;
ac->ev.delWrite = redisLibevDelWrite;
ac->ev.cleanup = redisLibevCleanup;
ac->ev.data = e;
/* Initialize read/write events */
ev_io_init(&e->rev,redisLibevReadEvent,c->fd,EV_READ);
ev_io_init(&e->wev,redisLibevWriteEvent,c->fd,EV_WRITE);
return REDIS_OK;
}
#endif
================================================
FILE: deps/hiredis/adapters/libevent.h
================================================
/*
* Copyright (c) 2010-2011, Pieter Noordhuis <pcnoordhuis at gmail dot com>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Redis nor the names of its contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __HIREDIS_LIBEVENT_H__
#define __HIREDIS_LIBEVENT_H__
#include <event.h>
#include "../hiredis.h"
#include "../async.h"
typedef struct redisLibeventEvents {
redisAsyncContext *context;
struct event rev, wev;
} redisLibeventEvents;
static void redisLibeventReadEvent(int fd, short event, void *arg) {
((void)fd); ((void)event);
redisLibeventEvents *e = (redisLibeventEvents*)arg;
redisAsyncHandleRead(e->context);
}
static void redisLibeventWriteEvent(int fd, short event, void *arg) {
((void)fd); ((void)event);
redisLibeventEvents *e = (redisLibeventEvents*)arg;
redisAsyncHandleWrite(e->context);
}
static void redisLibeventAddRead(void *privdata) {
redisLibeventEvents *e = (redisLibeventEvents*)privdata;
event_add(&e->rev,NULL);
}
static void redisLibeventDelRead(void *privdata) {
redisLibeventEvents *e = (redisLibeventEvents*)privdata;
event_del(&e->rev);
}
static void redisLibeventAddWrite(void *privdata) {
redisLibeventEvents *e = (redisLibeventEvents*)privdata;
event_add(&e->wev,NULL);
}
static void redisLibeventDelWrite(void *privdata) {
redisLibeventEvents *e = (redisLibeventEvents*)privdata;
event_del(&e->wev);
}
static void redisLibeventCleanup(void *privdata) {
redisLibeventEvents *e = (redisLibeventEvents*)privdata;
event_del(&e->rev);
event_del(&e->wev);
free(e);
}
static int redisLibeventAttach(redisAsyncContext *ac, struct event_base *base) {
redisContext *c = &(ac->c);
redisLibeventEvents *e;
/* Nothing should be attached when something is already attached */
if (ac->ev.data != NULL)
return REDIS_ERR;
/* Create container for context and r/w events */
e = (redisLibeventEvents*)malloc(sizeof(*e));
e->context = ac;
/* Register functions to start/stop listening for events */
ac->ev.addRead = redisLibeventAddRead;
ac->ev.delRead = redisLibeventDelRead;
ac->ev.addWrite = redisLibeventAddWrite;
ac->ev.delWrite = redisLibeventDelWrite;
ac->ev.cleanup = redisLibeventCleanup;
ac->ev.data = e;
/* Initialize and install read/write events */
event_set(&e->rev,c->fd,EV_READ,redisLibeventReadEvent,e);
event_set(&e->wev,c->fd,EV_WRITE,redisLibeventWriteEvent,e);
event_base_set(base,&e->rev);
event_base_set(base,&e->wev);
return REDIS_OK;
}
#endif
================================================
FILE: deps/hiredis/async.c
================================================
/*
* Copyright (c) 2009-2011, Salvatore Sanfilippo <antirez at gmail dot com>
* Copyright (c) 2010-2011, Pieter Noordhuis <pcnoordhuis at gmail dot com>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Redis nor the names of its contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "fmacros.h"
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include "async.h"
#include "net.h"
#include "dict.c"
#include "sds.h"
#define _EL_ADD_READ(ctx) do { \
if ((ctx)->ev.addRead) (ctx)->ev.addRead((ctx)->ev.data); \
} while(0)
#define _EL_DEL_READ(ctx) do { \
if ((ctx)->ev.delRead) (ctx)->ev.delRead((ctx)->ev.data); \
} while(0)
#define _EL_ADD_WRITE(ctx) do { \
if ((ctx)->ev.addWrite) (ctx)->ev.addWrite((ctx)->ev.data); \
} while(0)
#define _EL_DEL_WRITE(ctx) do { \
if ((ctx)->ev.delWrite) (ctx)->ev.delWrite((ctx)->ev.data); \
} while(0)
#define _EL_CLEANUP(ctx) do { \
if ((ctx)->ev.cleanup) (ctx)->ev.cleanup((ctx)->ev.data); \
} while(0);
/* Forward declaration of function in hiredis.c */
void __redisAppendCommand(redisContext *c, char *cmd, size_t len);
/* Functions managing dictionary of callbacks for pub/sub. */
static unsigned int callbackHash(const void *key) {
return dictGenHashFunction((unsigned char*)key,sdslen((char*)key));
}
static void *callbackValDup(void *privdata, const void *src) {
((void) privdata);
redisCallback *dup = malloc(sizeof(*dup));
memcpy(dup,src,sizeof(*dup));
return dup;
}
static int callbackKeyCompare(void *privdata, const void *key1, const void *key2) {
int l1, l2;
((void) privdata);
l1 = sdslen((sds)key1);
l2 = sdslen((sds)key2);
if (l1 != l2) return 0;
return memcmp(key1,key2,l1) == 0;
}
static void callbackKeyDestructor(void *privdata, void *key) {
((void) privdata);
sdsfree((sds)key);
}
static void callbackValDestructor(void *privdata, void *val) {
((void) privdata);
free(val);
}
static dictType callbackDict = {
callbackHash,
NULL,
callbackValDup,
callbackKeyCompare,
callbackKeyDestructor,
callbackValDestructor
};
static redisAsyncContext *redisAsyncInitialize(redisContext *c) {
redisAsyncContext *ac = realloc(c,sizeof(redisAsyncContext));
c = &(ac->c);
/* The regular connect functions will always set the flag REDIS_CONNECTED.
* For the async API, we want to wait until the first write event is
* received up before setting this flag, so reset it here. */
c->flags &= ~REDIS_CONNECTED;
ac->err = 0;
ac->errstr = NULL;
ac->data = NULL;
ac->ev.data = NULL;
ac->ev.addRead = NULL;
ac->ev.delRead = NULL;
ac->ev.addWrite = NULL;
ac->ev.delWrite = NULL;
ac->ev.cleanup = NULL;
ac->onConnect = NULL;
ac->onDisconnect = NULL;
ac->replies.head = NULL;
ac->replies.tail = NULL;
ac->sub.invalid.head = NULL;
ac->sub.invalid.tail = NULL;
ac->sub.channels = dictCreate(&callbackDict,NULL);
ac->sub.patterns = dictCreate(&callbackDict,NULL);
return ac;
}
/* We want the error field to be accessible directly instead of requiring
* an indirection to the redisContext struct. */
static void __redisAsyncCopyError(redisAsyncContext *ac) {
redisContext *c = &(ac->c);
ac->err = c->err;
ac->errstr = c->errstr;
}
redisAsyncContext *redisAsyncConnect(const char *ip, int port) {
redisContext *c = redisConnectNonBlock(ip,port);
redisAsyncContext *ac = redisAsyncInitialize(c);
__redisAsyncCopyError(ac);
return ac;
}
redisAsyncContext *redisAsyncConnectUnix(const char *path) {
redisContext *c = redisConnectUnixNonBlock(path);
redisAsyncContext *ac = redisAsyncInitialize(c);
__redisAsyncCopyError(ac);
return ac;
}
int redisAsyncSetConnectCallback(redisAsyncContext *ac, redisConnectCallback *fn) {
if (ac->onConnect == NULL) {
ac->onConnect = fn;
/* The common way to detect an established connection is to wait for
* the first write event to be fired. This assumes the related event
* library functions are already set. */
_EL_ADD_WRITE(ac);
return REDIS_OK;
}
return REDIS_ERR;
}
int redisAsyncSetDisconnectCallback(redisAsyncContext *ac, redisDisconnectCallback *fn) {
if (ac->onDisconnect == NULL) {
ac->onDisconnect = fn;
return REDIS_OK;
}
return REDIS_ERR;
}
/* Helper functions to push/shift callbacks */
static int __redisPushCallback(redisCallbackList *list, redisCallback *source) {
redisCallback *cb;
/* Copy callback from stack to heap */
cb = malloc(sizeof(*cb));
if (source != NULL) {
memcpy(cb,source,sizeof(*cb));
cb->next = NULL;
}
/* Store callback in list */
if (list->head == NULL)
list->head = cb;
if (list->tail != NULL)
list->tail->next = cb;
list->tail = cb;
return REDIS_OK;
}
static int __redisShiftCallback(redisCallbackList *list, redisCallback *target) {
redisCallback *cb = list->head;
if (cb != NULL) {
list->head = cb->next;
if (cb == list->tail)
list->tail = NULL;
/* Copy callback from heap to stack */
if (target != NULL)
memcpy(target,cb,sizeof(*cb));
free(cb);
return REDIS_OK;
}
return REDIS_ERR;
}
static void __redisRunCallback(redisAsyncContext *ac, redisCallback *cb, redisReply *reply) {
redisContext *c = &(ac->c);
if (cb->fn != NULL) {
c->flags |= REDIS_IN_CALLBACK;
cb->fn(ac,reply,cb->privdata);
c->flags &= ~REDIS_IN_CALLBACK;
}
}
/* Helper function to free the context. */
static void __redisAsyncFree(redisAsyncContext *ac) {
redisContext *c = &(ac->c);
redisCallback cb;
dictIterator *it;
dictEntry *de;
/* Execute pending callbacks with NULL reply. */
while (__redisShiftCallback(&ac->replies,&cb) == REDIS_OK)
__redisRunCallback(ac,&cb,NULL);
/* Execute callbacks for invalid commands */
while (__redisShiftCallback(&ac->sub.invalid,&cb) == REDIS_OK)
__redisRunCallback(ac,&cb,NULL);
/* Run subscription callbacks callbacks with NULL reply */
it = dictGetIterator(ac->sub.channels);
while ((de = dictNext(it)) != NULL)
__redisRunCallback(ac,dictGetEntryVal(de),NULL);
dictReleaseIterator(it);
dictRelease(ac->sub.channels);
it = dictGetIterator(ac->sub.patterns);
while ((de = dictNext(it)) != NULL)
__redisRunCallback(ac,dictGetEntryVal(de),NULL);
dictReleaseIterator(it);
dictRelease(ac->sub.patterns);
/* Signal event lib to clean up */
_EL_CLEANUP(ac);
/* Execute disconnect callback. When redisAsyncFree() initiated destroying
* this context, the status will always be REDIS_OK. */
if (ac->onDisconnect && (c->flags & REDIS_CONNECTED)) {
if (c->flags & REDIS_FREEING) {
ac->onDisconnect(ac,REDIS_OK);
} else {
ac->onDisconnect(ac,(ac->err == 0) ? REDIS_OK : REDIS_ERR);
}
}
/* Cleanup self */
redisFree(c);
}
/* Free the async context. When this function is called from a callback,
* control needs to be returned to redisProcessCallbacks() before actual
* free'ing. To do so, a flag is set on the context which is picked up by
* redisProcessCallbacks(). Otherwise, the context is immediately free'd. */
void redisAsyncFree(redisAsyncContext *ac) {
redisContext *c = &(ac->c);
c->flags |= REDIS_FREEING;
if (!(c->flags & REDIS_IN_CALLBACK))
__redisAsyncFree(ac);
}
/* Helper function to make the disconnect happen and clean up. */
static void __redisAsyncDisconnect(redisAsyncContext *ac) {
redisContext *c = &(ac->c);
/* Make sure error is accessible if there is any */
__redisAsyncCopyError(ac);
if (ac->err == 0) {
/* For clean disconnects, there should be no pending callbacks. */
assert(__redisShiftCallback(&ac->replies,NULL) == REDIS_ERR);
} else {
/* Disconnection is caused by an error, make sure that pending
* callbacks cannot call new commands. */
c->flags |= REDIS_DISCONNECTING;
}
/* For non-clean disconnects, __redisAsyncFree() will execute pending
* callbacks with a NULL-reply. */
__redisAsyncFree(ac);
}
/* Tries to do a clean disconnect from Redis, meaning it stops new commands
* from being issued, but tries to flush the output buffer and execute
* callbacks for all remaining replies. When this function is called from a
* callback, there might be more replies and we can safely defer disconnecting
* to redisProcessCallbacks(). Otherwise, we can only disconnect immediately
* when there are no pending callbacks. */
void redisAsyncDisconnect(redisAsyncContext *ac) {
redisContext *c = &(ac->c);
c->flags |= REDIS_DISCONNECTING;
if (!(c->flags & REDIS_IN_CALLBACK) && ac->replies.head == NULL)
__redisAsyncDisconnect(ac);
}
static int __redisGetSubscribeCallback(redisAsyncContext *ac, redisReply *reply, redisCallback *dstcb) {
redisContext *c = &(ac->c);
dict *callbacks;
dictEntry *de;
int pvariant;
char *stype;
sds sname;
/* Custom reply functions are not supported for pub/sub. This will fail
* very hard when they are used... */
if (reply->type == REDIS_REPLY_ARRAY) {
assert(reply->elements >= 2);
assert(reply->element[0]->type == REDIS_REPLY_STRING);
stype = reply->element[0]->str;
pvariant = (tolower(stype[0]) == 'p') ? 1 : 0;
if (pvariant)
callbacks = ac->sub.patterns;
else
callbacks = ac->sub.channels;
/* Locate the right callback */
assert(reply->element[1]->type == REDIS_REPLY_STRING);
sname = sdsnewlen(reply->element[1]->str,reply->element[1]->len);
de = dictFind(callbacks,sname);
if (de != NULL) {
memcpy(dstcb,dictGetEntryVal(de),sizeof(*dstcb));
/* If this is an unsubscribe message, remove it. */
if (strcasecmp(stype+pvariant,"unsubscribe") == 0) {
dictDelete(callbacks,sname);
/* If this was the last unsubscribe message, revert to
* non-subscribe mode. */
assert(reply->element[2]->type == REDIS_REPLY_INTEGER);
if (reply->element[2]->integer == 0)
c->flags &= ~REDIS_SUBSCRIBED;
}
}
sdsfree(sname);
} else {
/* Shift callback for invalid commands. */
__redisShiftCallback(&ac->sub.invalid,dstcb);
}
return REDIS_OK;
}
void redisProcessCallbacks(redisAsyncContext *ac) {
redisContext *c = &(ac->c);
redisCallback cb;
void *reply = NULL;
int status;
while((status = redisGetReply(c,&reply)) == REDIS_OK) {
if (reply == NULL) {
/* When the connection is being disconnected and there are
* no more replies, this is the cue to really disconnect. */
if (c->flags & REDIS_DISCONNECTING && sdslen(c->obuf) == 0) {
__redisAsyncDisconnect(ac);
return;
}
/* If monitor mode, repush callback */
if(c->flags & REDIS_MONITORING) {
__redisPushCallback(&ac->replies,&cb);
}
/* When the connection is not being disconnected, simply stop
* trying to get replies and wait for the next loop tick. */
break;
}
/* Even if the context is subscribed, pending regular callbacks will
* get a reply before pub/sub messages arrive. */
if (__redisShiftCallback(&ac->replies,&cb) != REDIS_OK) {
/*
* A spontaneous reply in a not-subscribed context can be the error
* reply that is sent when a new connection exceeds the maximum
* number of allowed connections on the server side.
*
* This is seen as an error instead of a regular reply because the
* server closes the connection after sending it.
*
* To prevent the error from being overwritten by an EOF error the
* connection is closed here. See issue #43.
*
* Another possibility is that the server is loading its dataset.
* In this case we also want to close the connection, and have the
* user wait until the server is ready to take our request.
*/
if (((redisReply*)reply)->type == REDIS_REPLY_ERROR) {
c->err = REDIS_ERR_OTHER;
snprintf(c->errstr,sizeof(c->errstr),"%s",((redisReply*)reply)->str);
__redisAsyncDisconnect(ac);
return;
}
/* No more regular callbacks and no errors, the context *must* be subscribed or monitoring. */
assert((c->flags & REDIS_SUBSCRIBED || c->flags & REDIS_MONITORING));
if(c->flags & REDIS_SUBSCRIBED)
__redisGetSubscribeCallback(ac,reply,&cb);
}
if (cb.fn != NULL) {
__redisRunCallback(ac,&cb,reply);
c->reader->fn->freeObject(reply);
/* Proceed with free'ing when redisAsyncFree() was called. */
if (c->flags & REDIS_FREEING) {
__redisAsyncFree(ac);
return;
}
} else {
/* No callback for this reply. This can either be a NULL callback,
* or there were no callbacks to begin with. Either way, don't
* abort with an error, but simply ignore it because the client
* doesn't know what the server will spit out over the wire. */
c->reader->fn->freeObject(reply);
}
}
/* Disconnect when there was an error reading the reply */
if (status != REDIS_OK)
__redisAsyncDisconnect(ac);
}
/* Internal helper function to detect socket status the first time a read or
* write event fires. When connecting was not succesful, the connect callback
* is called with a REDIS_ERR status and the context is free'd. */
static int __redisAsyncHandleConnect(redisAsyncContext *ac) {
redisContext *c = &(ac->c);
if (redisCheckSocketError(c,c->fd) == REDIS_ERR) {
/* Try again later when connect(2) is still in progress. */
if (errno == EINPROGRESS)
return REDIS_OK;
if (ac->onConnect) ac->onConnect(ac,REDIS_ERR);
__redisAsyncDisconnect(ac);
return REDIS_ERR;
}
/* Mark context as connected. */
c->flags |= REDIS_CONNECTED;
if (ac->onConnect) ac->onConnect(ac,REDIS_OK);
return REDIS_OK;
}
/* This function should be called when the socket is readable.
* It processes all replies that can be read and executes their callbacks.
*/
void redisAsyncHandleRead(redisAsyncContext *ac) {
redisContext *c = &(ac->c);
if (!(c->flags & REDIS_CONNECTED)) {
/* Abort connect was not successful. */
if (__redisAsyncHandleConnect(ac) != REDIS_OK)
return;
/* Try again later when the context is still not connected. */
if (!(c->flags & REDIS_CONNECTED))
return;
}
if (redisBufferRead(c) == REDIS_ERR) {
__redisAsyncDisconnect(ac);
} else {
/* Always re-schedule reads */
_EL_ADD_READ(ac);
redisProcessCallbacks(ac);
}
}
void redisAsyncHandleWrite(redisAsyncContext *ac) {
redisContext *c = &(ac->c);
int done = 0;
if (!(c->flags & REDIS_CONNECTED)) {
/* Abort connect was not successful. */
if (__redisAsyncHandleConnect(ac) != REDIS_OK)
return;
/* Try again later when the context is still not connected. */
if (!(c->flags & REDIS_CONNECTED))
return;
}
if (redisBufferWrite(c,&done) == REDIS_ERR) {
__redisAsyncDisconnect(ac);
} else {
/* Continue writing when not done, stop writing otherwise */
if (!done)
_EL_ADD_WRITE(ac);
else
_EL_DEL_WRITE(ac);
/* Always schedule reads after writes */
_EL_ADD_READ(ac);
}
}
/* Sets a pointer to the first argument and its length starting at p. Returns
* the number of bytes to skip to get to the following argument. */
static char *nextArgument(char *start, char **str, size_t *len) {
char *p = start;
if (p[0] != '$') {
p = strchr(p,'$');
if (p == NULL) return NULL;
}
*len = (int)strtol(p+1,NULL,10);
p = strchr(p,'\r');
assert(p);
*str = p+2;
return p+2+(*len)+2;
}
/* Helper function for the redisAsyncCommand* family of functions. Writes a
* formatted command to the output buffer and registers the provided callback
* function with the context. */
static int __redisAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void *privdata, char *cmd, size_t len) {
redisContext *c = &(ac->c);
redisCallback cb;
int pvariant, hasnext;
char *cstr, *astr;
size_t clen, alen;
char *p;
sds sname;
/* Don't accept new commands when the connection is about to be closed. */
if (c->flags & (REDIS_DISCONNECTING | REDIS_FREEING)) return REDIS_ERR;
/* Setup callback */
cb.fn = fn;
cb.privdata = privdata;
/* Find out which command will be appended. */
p = nextArgument(cmd,&cstr,&clen);
assert(p != NULL);
hasnext = (p[0] == '$');
pvariant = (tolower(cstr[0]) == 'p') ? 1 : 0;
cstr += pvariant;
clen -= pvariant;
if (hasnext && strncasecmp(cstr,"subscribe\r\n",11) == 0) {
c->flags |= REDIS_SUBSCRIBED;
/* Add every channel/pattern to the list of subscription callbacks. */
while ((p = nextArgument(p,&astr,&alen)) != NULL) {
sname = sdsnewlen(astr,alen);
if (pvariant)
dictReplace(ac->sub.patterns,sname,&cb);
else
dictReplace(ac->sub.channels,sname,&cb);
}
} else if (strncasecmp(cstr,"unsubscribe\r\n",13) == 0) {
/* It is only useful to call (P)UNSUBSCRIBE when the context is
* subscribed to one or more channels or patterns. */
if (!(c->flags & REDIS_SUBSCRIBED)) return REDIS_ERR;
/* (P)UNSUBSCRIBE does not have its own response: every channel or
* pattern that is unsubscribed will receive a message. This means we
* should not append a callback function for this command. */
} else if(strncasecmp(cstr,"monitor\r\n",9) == 0) {
/* Set monitor flag and push callback */
c->flags |= REDIS_MONITORING;
__redisPushCallback(&ac->replies,&cb);
} else {
if (c->flags & REDIS_SUBSCRIBED)
/* This will likely result in an error reply, but it needs to be
* received and passed to the callback. */
__redisPushCallback(&ac->sub.invalid,&cb);
else
__redisPushCallback(&ac->replies,&cb);
}
__redisAppendCommand(c,cmd,len);
/* Always schedule a write when the write buffer is non-empty */
_EL_ADD_WRITE(ac);
return REDIS_OK;
}
int redisvAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void *privdata, const char *format, va_list ap) {
char *cmd;
int len;
int status;
len = redisvFormatCommand(&cmd,format,ap);
status = __redisAsyncCommand(ac,fn,privdata,cmd,len);
free(cmd);
return status;
}
int redisAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void *privdata, const char *format, ...) {
va_list ap;
int status;
va_start(ap,format);
status = redisvAsyncCommand(ac,fn,privdata,format,ap);
va_end(ap);
return status;
}
int redisAsyncCommandArgv(redisAsyncContext *ac, redisCallbackFn *fn, void *privdata, int argc, const char **argv, const size_t *argvlen) {
char *cmd;
int len;
int status;
len = redisFormatCommandArgv(&cmd,argc,argv,argvlen);
status = __redisAsyncCommand(ac,fn,privdata,cmd,len);
free(cmd);
return status;
}
================================================
FILE: deps/hiredis/async.h
================================================
/*
* Copyright (c) 2009-2011, Salvatore Sanfilippo <antirez at gmail dot com>
* Copyright (c) 2010-2011, Pieter Noordhuis <pcnoordhuis at gmail dot com>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Redis nor the names of its contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __HIREDIS_ASYNC_H
#define __HIREDIS_ASYNC_H
#include "hiredis.h"
#ifdef __cplusplus
extern "C" {
#endif
struct redisAsyncContext; /* need forward declaration of redisAsyncContext */
struct dict; /* dictionary header is included in async.c */
/* Reply callback prototype and container */
typedef void (redisCallbackFn)(struct redisAsyncContext*, void*, void*);
typedef struct redisCallback {
struct redisCallback *next; /* simple singly linked list */
redisCallbackFn *fn;
void *privdata;
} redisCallback;
/* List of callbacks for either regular replies or pub/sub */
typedef struct redisCallbackList {
redisCallback *head, *tail;
} redisCallbackList;
/* Connection callback prototypes */
typedef void (redisDisconnectCallback)(const struct redisAsyncContext*, int status);
typedef void (redisConnectCallback)(const struct redisAsyncContext*, int status);
/* Context for an async connection to Redis */
typedef struct redisAsyncContext {
/* Hold the regular context, so it can be realloc'ed. */
redisContext c;
/* Setup error flags so they can be used directly. */
int err;
char *errstr;
/* Not used by hiredis */
void *data;
/* Event library data and hooks */
struct {
void *data;
/* Hooks that are called when the library expects to start
* reading/writing. These functions should be idempotent. */
void (*addRead)(void *privdata);
void (*delRead)(void *privdata);
void (*addWrite)(void *privdata);
void (*delWrite)(void *privdata);
void (*cleanup)(void *privdata);
} ev;
/* Called when either the connection is terminated due to an error or per
* user request. The status is set accordingly (REDIS_OK, REDIS_ERR). */
redisDisconnectCallback *onDisconnect;
/* Called when the first write event was received. */
redisConnectCallback *onConnect;
/* Regular command callbacks */
redisCallbackList replies;
/* Subscription callbacks */
struct {
redisCallbackList invalid;
struct dict *channels;
struct dict *patterns;
} sub;
} redisAsyncContext;
/* Functions that proxy to hiredis */
redisAsyncContext *redisAsyncConnect(const char *ip, int port);
redisAsyncContext *redisAsyncConnectUnix(const char *path);
int redisAsyncSetConnectCallback(redisAsyncContext *ac, redisConnectCallback *fn);
int redisAsyncSetDisconnectCallback(redisAsyncContext *ac, redisDisconnectCallback *fn);
void redisAsyncDisconnect(redisAsyncContext *ac);
void redisAsyncFree(redisAsyncContext *ac);
/* Handle read/write events */
void redisAsyncHandleRead(redisAsyncContext *ac);
void redisAsyncHandleWrite(redisAsyncContext *ac);
/* Command functions for an async context. Write the command to the
* output buffer and register the provided callback. */
int redisvAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void *privdata, const char *format, va_list ap);
int redisAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void *privdata, const char *format, ...);
int redisAsyncCommandArgv(redisAsyncContext *ac, redisCallbackFn *fn, void *privdata, int argc, const char **argv, const size_t *argvlen);
#ifdef __cplusplus
}
#endif
#endif
================================================
FILE: deps/hiredis/dict.c
================================================
/* Hash table implementation.
*
* This file implements in memory hash tables with insert/del/replace/find/
* get-random-element operations. Hash tables will auto resize if needed
* tables of power of two in size are used, collisions are handled by
* chaining. See the source code for more information... :)
*
* Copyright (c) 2006-2010, Salvatore Sanfilippo <antirez at gmail dot com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Redis nor the names of its contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "fmacros.h"
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include "dict.h"
/* -------------------------- private prototypes ---------------------------- */
static int _dictExpandIfNeeded(dict *ht);
static unsigned long _dictNextPower(unsigned long size);
static int _dictKeyIndex(dict *ht, const void *key);
static int _dictInit(dict *ht, dictType *type, void *privDataPtr);
/* -------------------------- hash functions -------------------------------- */
/* Generic hash function (a popular one from Bernstein).
* I tested a few and this was the best. */
static unsigned int dictGenHashFunction(const unsigned char *buf, int len) {
unsigned int hash = 5381;
while (len--)
hash = ((hash << 5) + hash) + (*buf++); /* hash * 33 + c */
return hash;
}
/* ----------------------------- API implementation ------------------------- */
/* Reset an hashtable already initialized with ht_init().
* NOTE: This function should only called by ht_destroy(). */
static void _dictReset(dict *ht) {
ht->table = NULL;
ht->size = 0;
ht->sizemask = 0;
ht->used = 0;
}
/* Create a new hash table */
static dict *dictCreate(dictType *type, void *privDataPtr) {
dict *ht = malloc(sizeof(*ht));
_dictInit(ht,type,privDataPtr);
return ht;
}
/* Initialize the hash table */
static int _dictInit(dict *ht, dictType *type, void *privDataPtr) {
_dictReset(ht);
ht->type = type;
ht->privdata = privDataPtr;
return DICT_OK;
}
/* Expand or create the hashtable */
static int dictExpand(dict *ht, unsigned long size) {
dict n; /* the new hashtable */
unsigned long realsize = _dictNextPower(size), i;
/* the size is invalid if it is smaller than the number of
* elements already inside the hashtable */
if (ht->used > size)
return DICT_ERR;
_dictInit(&n, ht->type, ht->privdata);
n.size = realsize;
n.sizemask = realsize-1;
n.table = calloc(realsize,sizeof(dictEntry*));
/* Copy all the elements from the old to the new table:
* note that if the old hash table is empty ht->size is zero,
* so dictExpand just creates an hash table. */
n.used = ht->used;
for (i = 0; i < ht->size && ht->used > 0; i++) {
dictEntry *he, *nextHe;
if (ht->table[i] == NULL) continue;
/* For each hash entry on this slot... */
he = ht->table[i];
while(he) {
unsigned int h;
nextHe = he->next;
/* Get the new element index */
h = dictHashKey(ht, he->key) & n.sizemask;
he->next = n.table[h];
n.table[h] = he;
ht->used--;
/* Pass to the next element */
he = nextHe;
}
}
assert(ht->used == 0);
free(ht->table);
/* Remap the new hashtable in the old */
*ht = n;
return DICT_OK;
}
/* Add an element to the target hash table */
static int dictAdd(dict *ht, void *key, void *val) {
int index;
dictEntry *entry;
/* Get the index of the new element, or -1 if
* the element already exists. */
if ((index = _dictKeyIndex(ht, key)) == -1)
return DICT_ERR;
/* Allocates the memory and stores key */
entry = malloc(sizeof(*entry));
entry->next = ht->table[index];
ht->table[index] = entry;
/* Set the hash entry fields. */
dictSetHashKey(ht, entry, key);
dictSetHashVal(ht, entry, val);
ht->used++;
return DICT_OK;
}
/* Add an element, discarding the old if the key already exists.
* Return 1 if the key was added from scratch, 0 if there was already an
* element with such key and dictReplace() just performed a value update
* operation. */
static int dictReplace(dict *ht, void *key, void *val) {
dictEntry *entry, auxentry;
/* Try to add the element. If the key
* does not exists dictAdd will suceed. */
if (dictAdd(ht, key, val) == DICT_OK)
return 1;
/* It already exists, get the entry */
entry = dictFind(ht, key);
/* Free the old value and set the new one */
/* Set the new value and free the old one. Note that it is important
* to do that in this order, as the value may just be exactly the same
* as the previous one. In this context, think to reference counting,
* you want to increment (set), and then decrement (free), and not the
* reverse. */
auxentry = *entry;
dictSetHashVal(ht, entry, val);
dictFreeEntryVal(ht, &auxentry);
return 0;
}
/* Search and remove an element */
static int dictDelete(dict *ht, const void *key) {
unsigned int h;
dictEntry *de, *prevde;
if (ht->size == 0)
return DICT_ERR;
h = dictHashKey(ht, key) & ht->sizemask;
de = ht->table[h];
prevde = NULL;
while(de) {
if (dictCompareHashKeys(ht,key,de->key)) {
/* Unlink the element from the list */
if (prevde)
prevde->next = de->next;
else
ht->table[h] = de->next;
dictFreeEntryKey(ht,de);
dictFreeEntryVal(ht,de);
free(de);
ht->used--;
return DICT_OK;
}
prevde = de;
de = de->next;
}
return DICT_ERR; /* not found */
}
/* Destroy an entire hash table */
static int _dictClear(dict *ht) {
unsigned long i;
/* Free all the elements */
for (i = 0; i < ht->size && ht->used > 0; i++) {
dictEntry *he, *nextHe;
if ((he = ht->table[i]) == NULL) continue;
while(he) {
nextHe = he->next;
dictFreeEntryKey(ht, he);
dictFreeEntryVal(ht, he);
free(he);
ht->used--;
he = nextHe;
}
}
/* Free the table and the allocated cache structure */
free(ht->table);
/* Re-initialize the table */
_dictReset(ht);
return DICT_OK; /* never fails */
}
/* Clear & Release the hash table */
static void dictRelease(dict *ht) {
_dictClear(ht);
free(ht);
}
static dictEntry *dictFind(dict *ht, const void *key) {
dictEntry *he;
unsigned int h;
if (ht->size == 0) return NULL;
h = dictHashKey(ht, key) & ht->sizemask;
he = ht->table[h];
while(he) {
if (dictCompareHashKeys(ht, key, he->key))
return he;
he = he->next;
}
return NULL;
}
static dictIterator *dictGetIterator(dict *ht) {
dictIterator *iter = malloc(sizeof(*iter));
iter->ht = ht;
iter->index = -1;
iter->entry = NULL;
iter->nextEntry = NULL;
return iter;
}
static dictEntry *dictNext(dictIterator *iter) {
while (1) {
if (iter->entry == NULL) {
iter->index++;
if (iter->index >=
(signed)iter->ht->size) break;
iter->entry = iter->ht->table[iter->index];
} else {
iter->entry = iter->nextEntry;
}
if (iter->entry) {
/* We need to save the 'next' here, the iterator user
* may delete the entry we are returning. */
iter->nextEntry = iter->entry->next;
return iter->entry;
}
}
return NULL;
}
static void dictReleaseIterator(dictIterator *iter) {
free(iter);
}
/* ------------------------- private functions ------------------------------ */
/* Expand the hash table if needed */
static int _dictExpandIfNeeded(dict *ht) {
/* If the hash table is empty expand it to the intial size,
* if the table is "full" dobule its size. */
if (ht->size == 0)
return dictExpand(ht, DICT_HT_INITIAL_SIZE);
if (ht->used == ht->size)
return dictExpand(ht, ht->size*2);
return DICT_OK;
}
/* Our hash table capability is a power of two */
static unsigned long _dictNextPower(unsigned long size) {
unsigned long i = DICT_HT_INITIAL_SIZE;
if (size >= LONG_MAX) return LONG_MAX;
while(1) {
if (i >= size)
return i;
i *= 2;
}
}
/* Returns the index of a free slot that can be populated with
* an hash entry for the given 'key'.
* If the key already exists, -1 is returned. */
static int _dictKeyIndex(dict *ht, const void *key) {
unsigned int h;
dictEntry *he;
/* Expand the hashtable if needed */
if (_dictExpandIfNeeded(ht) == DICT_ERR)
return -1;
/* Compute the key hash value */
h = dictHashKey(ht, key) & ht->sizemask;
/* Search if this slot does not already contain the given key */
he = ht->table[h];
while(he) {
if (dictCompareHashKeys(ht, key, he->key))
return -1;
he = he->next;
}
return h;
}
================================================
FILE: deps/hiredis/dict.h
================================================
/* Hash table implementation.
*
* This file implements in memory hash tables with insert/del/replace/find/
* get-random-element operations. Hash tables will auto resize if needed
* tables of power of two in size are used, collisions are handled by
* chaining. See the source code for more information... :)
*
* Copyright (c) 2006-2010, Salvatore Sanfilippo <antirez at gmail dot com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Redis nor the names of its contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __DICT_H
#define __DICT_H
#define DICT_OK 0
#define DICT_ERR 1
/* Unused arguments generate annoying warnings... */
#define DICT_NOTUSED(V) ((void) V)
typedef struct dictEntry {
void *key;
void *val;
struct dictEntry *next;
} dictEntry;
typedef struct dictType {
unsigned int (*hashFunction)(const void *key);
void *(*keyDup)(void *privdata, const void *key);
void *(*valDup)(void *privdata, const void *obj);
int (*keyCompare)(void *privdata, const void *key1, const void *key2);
void (*keyDestructor)(void *privdata, void *key);
void (*valDestructor)(void *privdata, void *obj);
} dictType;
typedef struct dict {
dictEntry **table;
dictType *type;
unsigned long size;
unsigned long sizemask;
unsigned long used;
void *privdata;
} dict;
typedef struct dictIterator {
dict *ht;
int index;
dictEntry *entry, *nextEntry;
} dictIterator;
/* This is the initial size of every hash table */
#define DICT_HT_INITIAL_SIZE 4
/* ------------------------------- Macros ------------------------------------*/
#define dictFreeEntryVal(ht, entry) \
if ((ht)->type->valDestructor) \
(ht)->type->valDestructor((ht)->privdata, (entry)->val)
#define dictSetHashVal(ht, entry, _val_) do { \
if ((ht)->type->valDup) \
entry->val = (ht)->type->valDup((ht)->privdata, _val_); \
else \
entry->val = (_val_); \
} while(0)
#define dictFreeEntryKey(ht, entry) \
if ((ht)->type->keyDestructor) \
(ht)->type->keyDestructor((ht)->privdata, (entry)->key)
#define dictSetHashKey(ht, entry, _key_) do { \
if ((ht)->type->keyDup) \
entry->key = (ht)->type->keyDup((ht)->privdata, _key_); \
else \
entry->key = (_key_); \
} while(0)
#define dictCompareHashKeys(ht, key1, key2) \
(((ht)->type->keyCompare) ? \
(ht)->type->keyCompare((ht)->privdata, key1, key2) : \
(key1) == (key2))
#define dictHashKey(ht, key) (ht)->type->hashFunction(key)
#define dictGetEntryKey(he) ((he)->key)
#define dictGetEntryVal(he) ((he)->val)
#define dictSlots(ht) ((ht)->size)
#define dictSize(ht) ((ht)->used)
/* API */
static unsigned int dictGenHashFunction(const unsigned char *buf, int len);
static dict *dictCreate(dictType *type, void *privDataPtr);
static int dictExpand(dict *ht, unsigned long size);
static int dictAdd(dict *ht, void *key, void *val);
static int dictReplace(dict *ht, void *key, void *val);
static int dictDelete(dict *ht, const void *key);
static void dictRelease(dict *ht);
static dictEntry * dictFind(dict *ht, const void *key);
static dictIterator *dictGetIterator(dict *ht);
static dictEntry *dictNext(dictIterator *iter);
static void dictReleaseIterator(dictIterator *iter);
#endif /* __DICT_H */
================================================
FILE: deps/hiredis/example-ae.c
================================================
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include "hiredis.h"
#include "async.h"
#include "adapters/ae.h"
/* Put event loop in the global scope, so it can be explicitly stopped */
static aeEventLoop *loop;
void getCallback(redisAsyncContext *c, void *r, void *privdata) {
redisReply *reply = r;
if (reply == NULL) return;
printf("argv[%s]: %s\n", (char*)privdata, reply->str);
/* Disconnect after receiving the reply to GET */
redisAsyncDisconnect(c);
}
void connectCallback(const redisAsyncContext *c, int status) {
if (status != REDIS_OK) {
printf("Error: %s\n", c->errstr);
return;
}
printf("Connected...\n");
}
void disconnectCallback(const redisAsyncContext *c, int status) {
if (status != REDIS_OK) {
printf("Error: %s\n", c->errstr);
return;
}
printf("Disconnected...\n");
}
int main (int argc, char **argv) {
signal(SIGPIPE, SIG_IGN);
redisAsyncContext *c = redisAsyncConnect("127.0.0.1", 6379);
if (c->err) {
/* Let *c leak for now... */
printf("Error: %s\n", c->errstr);
return 1;
}
loop = aeCreateEventLoop();
redisAeAttach(loop, c);
redisAsyncSetConnectCallback(c,connectCallback);
redisAsyncSetDisconnectCallback(c,disconnectCallback);
redisAsyncCommand(c, NULL, NULL, "SET key %b", argv[argc-1], strlen(argv[argc-1]));
redisAsyncCommand(c, getCallback, (char*)"end-1", "GET key");
aeMain(loop);
return 0;
}
================================================
FILE: deps/hiredis/example-libev.c
================================================
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include "hiredis.h"
#include "async.h"
#include "adapters/libev.h"
void getCallback(redisAsyncContext *c, void *r, void *privdata) {
redisReply *reply = r;
if (reply == NULL) return;
printf("argv[%s]: %s\n", (char*)privdata, reply->str);
/* Disconnect after receiving the reply to GET */
redisAsyncDisconnect(c);
}
void connectCallback(const redisAsyncContext *c, int status) {
if (status != REDIS_OK) {
printf("Error: %s\n", c->errstr);
return;
}
printf("Connected...\n");
}
void disconnectCallback(const redisAsyncContext *c, int status) {
if (status != REDIS_OK) {
printf("Error: %s\n", c->errstr);
return;
}
printf("Disconnected...\n");
}
int main (int argc, char **argv) {
signal(SIGPIPE, SIG_IGN);
redisAsyncContext *c = redisAsyncConnect("127.0.0.1", 6379);
if (c->err) {
/* Let *c leak for now... */
printf("Error: %s\n", c->errstr);
return 1;
}
redisLibevAttach(EV_DEFAULT_ c);
redisAsyncSetConnectCallback(c,connectCallback);
redisAsyncSetDisconnectCallback(c,disconnectCallback);
redisAsyncCommand(c, NULL, NULL, "SET key %b", argv[argc-1], strlen(argv[argc-1]));
redisAsyncCommand(c, getCallback, (char*)"end-1", "GET key");
ev_loop(EV_DEFAULT_ 0);
return 0;
}
================================================
FILE: deps/hiredis/example-libevent.c
================================================
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include "hiredis.h"
#include "async.h"
#include "adapters/libevent.h"
void getCallback(redisAsyncContext *c, void *r, void *privdata) {
redisReply *reply = r;
if (reply == NULL) return;
printf("argv[%s]: %s\n", (char*)privdata, reply->str);
/* Disconnect after receiving the reply to GET */
redisAsyncDisconnect(c);
}
void connectCallback(const redisAsyncContext *c, int status) {
if (status != REDIS_OK) {
printf("Error: %s\n", c->errstr);
return;
}
printf("Connected...\n");
}
void disconnectCallback(const redisAsyncContext *c, int status) {
if (status != REDIS_OK) {
printf("Error: %s\n", c->errstr);
return;
}
printf("Disconnected...\n");
}
int main (int argc, char **argv) {
signal(SIGPIPE, SIG_IGN);
struct event_base *base = event_base_new();
redisAsyncContext *c = redisAsyncConnect("127.0.0.1", 6379);
if (c->err) {
/* Let *c leak for now... */
printf("Error: %s\n", c->errstr);
return 1;
}
redisLibeventAttach(c,base);
redisAsyncSetConnectCallback(c,connectCallback);
redisAsyncSetDisconnectCallback(c,disconnectCallback);
redisAsyncCommand(c, NULL, NULL, "SET key %b", argv[argc-1], strlen(argv[argc-1]));
redisAsyncCommand(c, getCallback, (char*)"end-1", "GET key");
event_base_dispatch(base);
return 0;
}
================================================
FILE: deps/hiredis/example.c
================================================
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "hiredis.h"
int main(void) {
unsigned int j;
redisContext *c;
redisReply *reply;
struct timeval timeout = { 1, 500000 }; // 1.5 seconds
c = redisConnectWithTimeout((char*)"127.0.0.2", 6379, timeout);
if (c->err) {
printf("Connection error: %s\n", c->errstr);
exit(1);
}
/* PING server */
reply = redisCommand(c,"PING");
printf("PING: %s\n", reply->str);
freeReplyObject(reply);
/* Set a key */
reply = redisCommand(c,"SET %s %s", "foo", "hello world");
printf("SET: %s\n", reply->str);
freeReplyObject(reply);
/* Set a key using binary safe API */
reply = redisCommand(c,"SET %b %b", "bar", 3, "hello", 5);
printf("SET (binary API): %s\n", reply->str);
freeReplyObject(reply);
/* Try a GET and two INCR */
reply = redisCommand(c,"GET foo");
printf("GET foo: %s\n", reply->str);
freeReplyObject(reply);
reply = redisCommand(c,"INCR counter");
printf("INCR counter: %lld\n", reply->integer);
freeReplyObject(reply);
/* again ... */
reply = redisCommand(c,"INCR counter");
printf("INCR counter: %lld\n", reply->integer);
freeReplyObject(reply);
/* Create a list of numbers, from 0 to 9 */
reply = redisCommand(c,"DEL mylist");
freeReplyObject(reply);
for (j = 0; j < 10; j++) {
char buf[64];
snprintf(buf,64,"%d",j);
reply = redisCommand(c,"LPUSH mylist element-%s", buf);
freeReplyObject(reply);
}
/* Let's check what we have inside the list */
reply = redisCommand(c,"LRANGE mylist 0 -1");
if (reply->type == REDIS_REPLY_ARRAY) {
for (j = 0; j < reply->elements; j++) {
printf("%u) %s\n", j, reply->element[j]->str);
}
}
freeReplyObject(reply);
return 0;
}
================================================
FILE: deps/hiredis/fmacros.h
================================================
#ifndef __HIREDIS_FMACRO_H
#define __HIREDIS_FMACRO_H
#if !defined(_BSD_SOURCE)
#define _BSD_SOURCE
#endif
#if defined(__sun__)
#define _POSIX_C_SOURCE 200112L
#elif defined(__linux__) || defined(__OpenBSD__) || defined(__NetBSD__)
#define _XOPEN_SOURCE 600
#else
#define _XOPEN_SOURCE
#endif
#endif
================================================
FILE: deps/hiredis/hiredis.c
================================================
/*
* Copyright (c) 2009-2011, Salvatore Sanfilippo <antirez at gmail dot com>
* Copyright (c) 2010-2011, Pieter Noordhuis <pcnoordhuis at gmail dot com>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Redis nor the names of its contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "fmacros.h"
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <errno.h>
#include <ctype.h>
#include "hiredis.h"
#include "net.h"
#include "sds.h"
static redisReply *createReplyObject(int type);
static void *createStringObject(const redisReadTask *task, char *str, size_t len);
static void *createArrayObject(const redisReadTask *task, int elements);
static void *createIntegerObject(const redisReadTask *task, long long value);
static void *createNilObject(const redisReadTask *task);
/* Default set of functions to build the reply. Keep in mind that such a
* function returning NULL is interpreted as OOM. */
static redisReplyObjectFunctions defaultFunctions = {
createStringObject,
createArrayObject,
createIntegerObject,
createNilObject,
freeReplyObject
};
/* Create a reply object */
static redisReply *createReplyObject(int type) {
redisReply *r = calloc(1,sizeof(*r));
if (r == NULL)
return NULL;
r->type = type;
return r;
}
/* Free a reply object */
void freeReplyObject(void *reply) {
redisReply *r = reply;
size_t j;
switch(r->type) {
case REDIS_REPLY_INTEGER:
break; /* Nothing to free */
case REDIS_REPLY_ARRAY:
if (r->element != NULL) {
for (j = 0; j < r->elements; j++)
if (r->element[j] != NULL)
freeReplyObject(r->element[j]);
free(r->element);
}
break;
case REDIS_REPLY_ERROR:
case REDIS_REPLY_STATUS:
case REDIS_REPLY_STRING:
if (r->str != NULL)
free(r->str);
break;
}
free(r);
}
static void *createStringObject(const redisReadTask *task, char *str, size_t len) {
redisReply *r, *parent;
char *buf;
r = createReplyObject(task->type);
if (r == NULL)
return NULL;
buf = malloc(len+1);
if (buf == NULL) {
freeReplyObject(r);
return NULL;
}
assert(task->type == REDIS_REPLY_ERROR ||
task->type == REDIS_REPLY_STATUS ||
task->type == REDIS_REPLY_STRING);
/* Copy string value */
memcpy(buf,str,len);
buf[len] = '\0';
r->str = buf;
r->len = len;
if (task->parent) {
parent = task->parent->obj;
assert(parent->type == REDIS_REPLY_ARRAY);
parent->element[task->idx] = r;
}
return r;
}
static void *createArrayObject(const redisReadTask *task, int elements) {
redisReply *r, *parent;
r = createReplyObject(REDIS_REPLY_ARRAY);
if (r == NULL)
return NULL;
if (elements > 0) {
r->element = calloc(elements,sizeof(redisReply*));
if (r->element == NULL) {
freeReplyObject(r);
return NULL;
}
}
r->elements = elements;
if (task->parent) {
parent = task->parent->obj;
assert(parent->type == REDIS_REPLY_ARRAY);
parent->element[task->idx] = r;
}
return r;
}
static void *createIntegerObject(const redisReadTask *task, long long value) {
redisReply *r, *parent;
r = createReplyObject(REDIS_REPLY_INTEGER);
if (r == NULL)
return NULL;
r->integer = value;
if (task->parent) {
parent = task->parent->obj;
assert(parent->type == REDIS_REPLY_ARRAY);
parent->element[task->idx] = r;
}
return r;
}
static void *createNilObject(const redisReadTask *task) {
redisReply *r, *parent;
r = createReplyObject(REDIS_REPLY_NIL);
if (r == NULL)
return NULL;
if (task->parent) {
parent = task->parent->obj;
assert(parent->type == REDIS_REPLY_ARRAY);
parent->element[task->idx] = r;
}
return r;
}
static void __redisReaderSetError(redisReader *r, int type, const char *str) {
size_t len;
if (r->reply != NULL && r->fn && r->fn->freeObject) {
r->fn->freeObject(r->reply);
r->reply = NULL;
}
/* Clear input buffer on errors. */
if (r->buf != NULL) {
sdsfree(r->buf);
r->buf = NULL;
r->pos = r->len = 0;
}
/* Reset task stack. */
r->ridx = -1;
/* Set error. */
r->err = type;
len = strlen(str);
len = len < (sizeof(r->errstr)-1) ? len : (sizeof(r->errstr)-1);
memcpy(r->errstr,str,len);
r->errstr[len] = '\0';
}
static size_t chrtos(char *buf, size_t size, char byte) {
size_t len = 0;
switch(byte) {
case '\\':
case '"':
len = snprintf(buf,size,"\"\\%c\"",byte);
break;
case '\n': len = snprintf(buf,size,"\"\\n\""); break;
case '\r': len = snprintf(buf,size,"\"\\r\""); break;
case '\t': len = snprintf(buf,size,"\"\\t\""); break;
case '\a': len = snprintf(buf,size,"\"\\a\""); break;
case '\b': len = snprintf(buf,size,"\"\\b\""); break;
default:
if (isprint(byte))
len = snprintf(buf,size,"\"%c\"",byte);
else
len = snprintf(buf,size,"\"\\x%02x\"",(unsigned char)byte);
break;
}
return len;
}
static void __redisReaderSetErrorProtocolByte(redisReader *r, char byte) {
char cbuf[8], sbuf[128];
chrtos(cbuf,sizeof(cbuf),byte);
snprintf(sbuf,sizeof(sbuf),
"Protocol error, got %s as reply type byte", cbuf);
__redisReaderSetError(r,REDIS_ERR_PROTOCOL,sbuf);
}
static void __redisReaderSetErrorOOM(redisReader *r) {
__redisReaderSetError(r,REDIS_ERR_OOM,"Out of memory");
}
static char *readBytes(redisReader *r, unsigned int bytes) {
char *p;
if (r->len-r->pos >= bytes) {
p = r->buf+r->pos;
r->pos += bytes;
return p;
}
return NULL;
}
/* Find pointer to \r\n. */
static char *seekNewline(char *s, size_t len) {
int pos = 0;
int _len = len-1;
/* Position should be < len-1 because the character at "pos" should be
* followed by a \n. Note that strchr cannot be used because it doesn't
* allow to search a limited length and the buffer that is being searched
* might not have a trailing NULL character. */
while (pos < _len) {
while(pos < _len && s[pos] != '\r') pos++;
if (s[pos] != '\r') {
/* Not found. */
return NULL;
} else {
if (s[pos+1] == '\n') {
/* Found. */
return s+pos;
} else {
/* Continue searching. */
pos++;
}
}
}
return NULL;
}
/* Read a long long value starting at *s, under the assumption that it will be
* terminated by \r\n. Ambiguously returns -1 for unexpected input. */
static long long readLongLong(char *s) {
long long v = 0;
int dec, mult = 1;
char c;
if (*s == '-') {
mult = -1;
s++;
} else if (*s == '+') {
mult = 1;
s++;
}
while ((c = *(s++)) != '\r') {
dec = c - '0';
if (dec >= 0 && dec < 10) {
v *= 10;
v += dec;
} else {
/* Should not happen... */
return -1;
}
}
return mult*v;
}
static char *readLine(redisReader *r, int *_len) {
char *p, *s;
int len;
p = r->buf+r->pos;
s = seekNewline(p,(r->len-r->pos));
if (s != NULL) {
len = s-(r->buf+r->pos);
r->pos += len+2; /* skip \r\n */
if (_len) *_len = len;
return p;
}
return NULL;
}
static void moveToNextTask(redisReader *r) {
redisReadTask *cur, *prv;
while (r->ridx >= 0) {
/* Return a.s.a.p. when the stack is now empty. */
if (r->ridx == 0) {
r->ridx--;
return;
}
cur = &(r->rstack[r->ridx]);
prv = &(r->rstack[r->ridx-1]);
assert(prv->type == REDIS_REPLY_ARRAY);
if (cur->idx == prv->elements-1) {
r->ridx--;
} else {
/* Reset the type because the next item can be anything */
assert(cur->idx < prv->elements);
cur->type = -1;
cur->elements = -1;
cur->idx++;
return;
}
}
}
static int processLineItem(redisReader *r) {
redisReadTask *cur = &(r->rstack[r->ridx]);
void *obj;
char *p;
int len;
if ((p = readLine(r,&len)) != NULL) {
if (cur->type == REDIS_REPLY_INTEGER) {
if (r->fn && r->fn->createInteger)
obj = r->fn->createInteger(cur,readLongLong(p));
else
obj = (void*)REDIS_REPLY_INTEGER;
} else {
/* Type will be error or status. */
if (r->fn && r->fn->createString)
obj = r->fn->createString(cur,p,len);
else
obj = (void*)(size_t)(cur->type);
}
if (obj == NULL) {
__redisReaderSetErrorOOM(r);
return REDIS_ERR;
}
/* Set reply if this is the root object. */
if (r->ridx == 0) r->reply = obj;
moveToNextTask(r);
return REDIS_OK;
}
return REDIS_ERR;
}
static int processBulkItem(redisReader *r) {
redisReadTask *cur = &(r->rstack[r->ridx]);
void *obj = NULL;
char *p, *s;
long len;
unsigned long bytelen;
int success = 0;
p = r->buf+r->pos;
s = seekNewline(p,r->len-r->pos);
if (s != NULL) {
p = r->buf+r->pos;
bytelen = s-(r->buf+r->pos)+2; /* include \r\n */
len = readLongLong(p);
if (len < 0) {
/* The nil object can always be created. */
if (r->fn && r->fn->createNil)
obj = r->fn->createNil(cur);
else
obj = (void*)REDIS_REPLY_NIL;
success = 1;
} else {
/* Only continue when the buffer contains the entire bulk item. */
bytelen += len+2; /* include \r\n */
if (r->pos+bytelen <= r->len) {
if (r->fn && r->fn->createString)
obj = r->fn->createString(cur,s+2,len);
else
obj = (void*)REDIS_REPLY_STRING;
success = 1;
}
}
/* Proceed when obj was created. */
if (success) {
if (obj == NULL) {
__redisReaderSetErrorOOM(r);
return REDIS_ERR;
}
r->pos += bytelen;
/* Set reply if this is the root object. */
if (r->ridx == 0) r->reply = obj;
moveToNextTask(r);
return REDIS_OK;
}
}
return REDIS_ERR;
}
static int processMultiBulkItem(redisReader *r) {
redisReadTask *cur = &(r->rstack[r->ridx]);
void *obj;
char *p;
long elements;
int root = 0;
/* Set error for nested multi bulks with depth > 7 */
if (r->ridx == 8) {
__redisReaderSetError(r,REDIS_ERR_PROTOCOL,
"No support for nested multi bulk replies with depth > 7");
return REDIS_ERR;
}
if ((p = readLine(r,NULL)) != NULL) {
elements = readLongLong(p);
root = (r->ridx == 0);
if (elements == -1) {
if (r->fn && r->fn->createNil)
obj = r->fn->createNil(cur);
else
obj = (void*)REDIS_REPLY_NIL;
if (obj == NULL) {
__redisReaderSetErrorOOM(r);
return REDIS_ERR;
}
moveToNextTask(r);
} else {
if (r->fn && r->fn->createArray)
obj = r->fn->createArray(cur,elements);
else
obj = (void*)REDIS_REPLY_ARRAY;
if (obj == NULL) {
__redisReaderSetErrorOOM(r);
return REDIS_ERR;
}
/* Modify task stack when there are more than 0 elements. */
if (elements > 0) {
cur->elements = elements;
cur->obj = obj;
r->ridx++;
r->rstack[r->ridx].type = -1;
r->rstack[r->ridx].elements = -1;
r->rstack[r->ridx].idx = 0;
r->rstack[r->ridx].obj = NULL;
r->rstack[r->ridx].parent = cur;
r->rstack[r->ridx].privdata = r->privdata;
} else {
moveToNextTask(r);
}
}
/* Set reply if this is the root object. */
if (root) r->reply = obj;
return REDIS_OK;
}
return REDIS_ERR;
}
static int processItem(redisReader *r) {
redisReadTask *cur = &(r->rstack[r->ridx]);
char *p;
/* check if we need to read type */
if (cur->type < 0) {
if ((p = readBytes(r,1)) != NULL) {
switch (p[0]) {
case '-':
cur->type = REDIS_REPLY_ERROR;
break;
case '+':
cur->type = REDIS_REPLY_STATUS;
break;
case ':':
cur->type = REDIS_REPLY_INTEGER;
break;
case '$':
cur->type = REDIS_REPLY_STRING;
break;
case '*':
cur->type = REDIS_REPLY_ARRAY;
break;
default:
__redisReaderSetErrorProtocolByte(r,*p);
return REDIS_ERR;
}
} else {
/* could not consume 1 byte */
return REDIS_ERR;
}
}
/* process typed item */
switch(cur->type) {
case REDIS_REPLY_ERROR:
case REDIS_REPLY_STATUS:
case REDIS_REPLY_INTEGER:
return processLineItem(r);
case REDIS_REPLY_STRING:
return processBulkItem(r);
case REDIS_REPLY_ARRAY:
return processMultiBulkItem(r);
default:
assert(NULL);
return REDIS_ERR; /* Avoid warning. */
}
}
redisReader *redisReaderCreate(void) {
redisReader *r;
r = calloc(sizeof(redisReader),1);
if (r == NULL)
return NULL;
r->err = 0;
r->errstr[0] = '\0';
r->fn = &defaultFunctions;
r->buf = sdsempty();
r->maxbuf = REDIS_READER_MAX_BUF;
if (r->buf == NULL) {
free(r);
return NULL;
}
r->ridx = -1;
return r;
}
void redisReaderFree(redisReader *r) {
if (r->reply != NULL && r->fn && r->fn->freeObject)
r->fn->freeObject(r->reply);
if (r->buf != NULL)
sdsfree(r->buf);
free(r);
}
int redisReaderFeed(redisReader *r, const char *buf, size_t len) {
sds newbuf;
/* Return early when this reader is in an erroneous state. */
if (r->err)
return REDIS_ERR;
/* Copy the provided buffer. */
if (buf != NULL && len >= 1) {
/* Destroy internal buffer when it is empty and is quite large. */
if (r->len == 0 && r->maxbuf != 0 && sdsavail(r->buf) > r->maxbuf) {
sdsfree(r->buf);
r->buf = sdsempty();
r->pos = 0;
/* r->buf should not be NULL since we just free'd a larger one. */
assert(r->buf != NULL);
}
newbuf = sdscatlen(r->buf,buf,len);
if (newbuf == NULL) {
__redisReaderSetErrorOOM(r);
return REDIS_ERR;
}
r->buf = newbuf;
r->len = sdslen(r->buf);
}
return REDIS_OK;
}
int redisReaderGetReply(redisReader *r, void **reply) {
/* Default target pointer to NULL. */
if (reply != NULL)
*reply = NULL;
/* Return early when this reader is in an erroneous state. */
if (r->err)
return REDIS_ERR;
/* When the buffer is empty, there will never be a reply. */
if (r->len == 0)
return REDIS_OK;
/* Set first item to process when the stack is empty. */
if (r->ridx == -1) {
r->rstack[0].type = -1;
r->rstack[0].elements = -1;
r->rstack[0].idx = -1;
r->rstack[0].obj = NULL;
r->rstack[0].parent = NULL;
r->rstack[0].privdata = r->privdata;
r->ridx = 0;
}
/* Process items in reply. */
while (r->ridx >= 0)
if (processItem(r) != REDIS_OK)
break;
/* Return ASAP when an error occurred. */
if (r->err)
return REDIS_ERR;
/* Discard part of the buffer when we've consumed at least 1k, to avoid
* doing unnecessary calls to memmove() in sds.c. */
if (r->pos >= 1024) {
sdsrange(r->buf,r->pos,-1);
r->pos = 0;
r->len = sdslen(r->buf);
}
/* Emit a reply when there is one. */
if (r->ridx == -1) {
if (reply != NULL)
*reply = r->reply;
r->reply = NULL;
}
return REDIS_OK;
}
/* Calculate the number of bytes needed to represent an integer as string. */
static int intlen(int i) {
int len = 0;
if (i < 0) {
len++;
i = -i;
}
do {
len++;
i /= 10;
} while(i);
return len;
}
/* Helper that calculates the bulk length given a certain string length. */
static size_t bulklen(size_t len) {
return 1+intlen(len)+2+len+2;
}
int redisvFormatCommand(char **target, const char *format, va_list ap) {
const char *c = format;
char *cmd = NULL; /* final command */
int pos; /* position in final command */
sds curarg, newarg; /* current argument */
int touched = 0; /* was the current argument touched? */
char **curargv = NULL, **newargv = NULL;
int argc = 0;
int totlen = 0;
int j;
/* Abort if there is not target to set */
if (target == NULL)
return -1;
/* Build the command string accordingly to protocol */
curarg = sdsempty();
if (curarg == NULL)
return -1;
while(*c != '\0') {
if (*c != '%' || c[1] == '\0') {
if (*c == ' ') {
if (touched) {
newargv = realloc(curargv,sizeof(char*)*(argc+1));
if (newargv == NULL) goto err;
curargv = newargv;
curargv[argc++] = curarg;
totlen += bulklen(sdslen(curarg));
/* curarg is put in argv so it can be overwritten. */
curarg = sdsempty();
if (curarg == NULL) goto err;
touched = 0;
}
} else {
newarg = sdscatlen(curarg,c,1);
if (newarg == NULL) goto err;
curarg = newarg;
touched = 1;
}
} else {
char *arg;
size_t size;
/* Set newarg so it can be checked even if it is not touched. */
newarg = curarg;
switch(c[1]) {
case 's':
arg = va_arg(ap,char*);
size = strlen(arg);
if (size > 0)
newarg = sdscatlen(curarg,arg,size);
break;
case 'b':
arg = va_arg(ap,char*);
size = va_arg(ap,size_t);
if (size > 0)
newarg = sdscatlen(curarg,arg,size);
break;
case '%':
newarg = sdscat(curarg,"%");
break;
default:
/* Try to detect printf format */
{
static const char intfmts[] = "diouxX";
char _format[16];
const char *_p = c+1;
size_t _l = 0;
va_list _cpy;
/* Flags */
if (*_p != '\0' && *_p == '#') _p++;
if (*_p != '\0' && *_p == '0') _p++;
if (*_p != '\0' && *_p == '-') _p++;
if (*_p != '\0' && *_p == ' ') _p++;
if (*_p != '\0' && *_p == '+') _p++;
/* Field width */
while (*_p != '\0' && isdigit(*_p)) _p++;
/* Precision */
if (*_p == '.') {
_p++;
while (*_p != '\0' && isdigit(*_p)) _p++;
}
/* Copy va_list before consuming with va_arg */
va_copy(_cpy,ap);
/* Integer conversion (without modifiers) */
if (strchr(intfmts,*_p) != NULL) {
va_arg(ap,int);
goto fmt_valid;
}
/* Double conversion (without modifiers) */
if (strchr("eEfFgGaA",*_p) != NULL) {
va_arg(ap,double);
goto fmt_valid;
}
/* Size: char */
if (_p[0] == 'h' && _p[1] == 'h') {
_p += 2;
if (*_p != '\0' && strchr(intfmts,*_p) != NULL) {
va_arg(ap,int); /* char gets promoted to int */
goto fmt_valid;
}
goto fmt_invalid;
}
/* Size: short */
if (_p[0] == 'h') {
_p += 1;
if (*_p != '\0' && strchr(intfmts,*_p) != NULL) {
va_arg(ap,int); /* short gets promoted to int */
goto fmt_valid;
}
goto fmt_invalid;
}
/* Size: long long */
if (_p[0] == 'l' && _p[1] == 'l') {
_p += 2;
if (*_p != '\0' && strchr(intfmts,*_p) != NULL) {
va_arg(ap,long long);
goto fmt_valid;
}
goto fmt_invalid;
}
/* Size: long */
if (_p[0] == 'l') {
_p += 1;
if (*_p != '\0' && strchr(intfmts,*_p) != NULL) {
va_arg(ap,long);
goto fmt_valid;
}
goto fmt_invalid;
}
fmt_invalid:
va_end(_cpy);
goto err;
fmt_valid:
_l = (_p+1)-c;
if (_l < sizeof(_format)-2) {
memcpy(_format,c,_l);
_format[_l] = '\0';
newarg = sdscatvprintf(curarg,_format,_cpy);
/* Update current position (note: outer blocks
* increment c twice so compensate here) */
c = _p-1;
}
va_end(_cpy);
break;
}
}
if (newarg == NULL) goto err;
curarg = newarg;
touched = 1;
c++;
}
c++;
}
/* Add the last argument if needed */
if (touched) {
newargv = realloc(curargv,sizeof(char*)*(argc+1));
if (newargv == NULL) goto err;
curargv = newargv;
curargv[argc++] = curarg;
totlen += bulklen(sdslen(curarg));
} else {
sdsfree(curarg);
}
/* Clear curarg because it was put in curargv or was free'd. */
curarg = NULL;
/* Add bytes needed to hold multi bulk count */
totlen += 1+intlen(argc)+2;
/* Build the command at protocol level */
cmd = malloc(totlen+1);
if (cmd == NULL) goto err;
pos = sprintf(cmd,"*%d\r\n",argc);
for (j = 0; j < argc; j++) {
pos += sprintf(cmd+pos,"$%zu\r\n",sdslen(curargv[j]));
memcpy(cmd+pos,curargv[j],sdslen(curargv[j]));
pos += sdslen(curargv[j]);
sdsfree(curargv[j]);
cmd[pos++] = '\r';
cmd[pos++] = '\n';
}
assert(pos == totlen);
cmd[pos] = '\0';
free(curargv);
*target = cmd;
return totlen;
err:
while(argc--)
sdsfree(curargv[argc]);
free(curargv);
if (curarg != NULL)
sdsfree(curarg);
/* No need to check cmd since it is the last statement that can fail,
* but do it anyway to be as defensive as possible. */
if (cmd != NULL)
free(cmd);
return -1;
}
/* Format a command according to the Redis protocol. This function
* takes a format similar to printf:
*
* %s represents a C null terminated string you want to interpolate
* %b represents a binary safe string
*
* When using %b you need to provide both the pointer to the string
* and the length in bytes. Examples:
*
* len = redisFormatCommand(target, "GET %s", mykey);
* len = redisFormatCommand(target, "SET %s %b", mykey, myval, myvallen);
*/
int redisFormatCommand(char **target, const char *format, ...) {
va_list ap;
int len;
va_start(ap,format);
len = redisvFormatCommand(target,format,ap);
va_end(ap);
return len;
}
/* Format a command according to the Redis protocol. This function takes the
* number of arguments, an array with arguments and an array with their
* lengths. If the latter is set to NULL, strlen will be used to compute the
* argument lengths.
*/
int redisFormatCommandArgv(char **target, int argc, const char **argv, const size_t *argvlen) {
char *cmd = NULL; /* final command */
int pos; /* position in final command */
size_t len;
int totlen, j;
/* Calculate number of bytes needed for the command */
totlen = 1+intlen(argc)+2;
for (j = 0; j < argc; j++) {
len = argvlen ? argvlen[j] : strlen(argv[j]);
totlen += bulklen(len);
}
/* Build the command at protocol level */
cmd = malloc(totlen+1);
if (cmd == NULL)
return -1;
pos = sprintf(cmd,"*%d\r\n",argc);
for (j = 0; j < argc; j++) {
len = argvlen ? argvlen[j] : strlen(argv[j]);
pos += sprintf(cmd+pos,"$%zu\r\n",len);
memcpy(cmd+pos,argv[j],len);
pos += len;
cmd[pos++] = '\r';
cmd[pos++] = '\n';
}
assert(pos == totlen);
cmd[pos] = '\0';
*target = cmd;
return totlen;
}
void __redisSetError(redisContext *c, int type, const char *str) {
size_t len;
c->err = type;
if (str != NULL) {
len = strlen(str);
len = len < (sizeof(c->errstr)-1) ? len : (sizeof(c->errstr)-1);
memcpy(c->errstr,str,len);
c->errstr[len] = '\0';
} else {
/* Only REDIS_ERR_IO may lack a description! */
assert(type == REDIS_ERR_IO);
strerror_r(errno,c->errstr,sizeof(c->errstr));
}
}
static redisContext *redisContextInit(void) {
redisContext *c;
c = calloc(1,sizeof(redisContext));
if (c == NULL)
return NULL;
c->err = 0;
c->errstr[0] = '\0';
c->obuf = sdsempty();
c->reader = redisReaderCreate();
return c;
}
void redisFree(redisContext *c) {
if (c->fd > 0)
close(c->fd);
if (c->obuf != NULL)
sdsfree(c->obuf);
if (c->reader != NULL)
redisReaderFree(c->reader);
free(c);
}
/* Connect to a Redis instance. On error the field error in the returned
* context will be set to the return value of the error function.
* When no set of reply functions is given, the default set will be used. */
redisContext *redisConnect(const char *ip, int port) {
redisContext *c = redisContextInit();
c->flags |= REDIS_BLOCK;
redisContextConnectTcp(c,ip,port,NULL);
return c;
}
redisContext *redisConnectWithTimeout(const char *ip, int port, struct timeval tv) {
redisContext *c = redisContextInit();
c->flags |= REDIS_BLOCK;
redisContextConnectTcp(c,ip,port,&tv);
return c;
}
redisContext *redisConnectNonBlock(const char *ip, int port) {
redisContext *c = redisContextInit();
c->flags &= ~REDIS_BLOCK;
redisContextConnectTcp(c,ip,port,NULL);
return c;
}
redisContext *redisConnectUnix(const char *path) {
redisContext *c = redisContextInit();
c->flags |= REDIS_BLOCK;
redisContextConnectUnix(c,path,NULL);
return c;
}
redisContext *redisConnectUnixWithTimeout(const char *path, struct timeval tv) {
redisContext *c = redisContextInit();
c->flags |= REDIS_BLOCK;
redisContextConnectUnix(c,path,&tv);
return c;
}
redisContext *redisConnectUnixNonBlock(const char *path) {
redisContext *c = redisContextInit();
c->flags &= ~REDIS_BLOCK;
redisContextConnectUnix(c,path,NULL);
return c;
}
/* Set read/write timeout on a blocking socket. */
int redisSetTimeout(redisContext *c, struct timeval tv) {
if (c->flags & REDIS_BLOCK)
return redisContextSetTimeout(c,tv);
return REDIS_ERR;
}
/* Use this function to handle a read event on the descriptor. It will try
* and read some bytes from the socket and feed them to the reply parser.
*
* After this function is called, you may use redisContextReadReply to
* see if there is a reply available. */
int redisBufferRead(redisContext *c) {
char buf[1024*16];
int nread;
/* Return early when the context has seen an error. */
if (c->err)
return REDIS_ERR;
nread = read(c->fd,buf,sizeof(buf));
if (nread == -1) {
if (errno == EAGAIN && !(c->flags & REDIS_BLOCK)) {
/* Try again later */
} else {
__redisSetError(c,REDIS_ERR_IO,NULL);
return REDIS_ERR;
}
} else if (nread == 0) {
__redisSetError(c,REDIS_ERR_EOF,"Server closed the connection");
return REDIS_ERR;
} else {
if (redisReaderFeed(c->reader,buf,nread) != REDIS_OK) {
__redisSetError(c,c->reader->err,c->reader->errstr);
return REDIS_ERR;
}
}
return REDIS_OK;
}
/* Write the output buffer to the socket.
*
* Returns REDIS_OK when the buffer is empty, or (a part of) the buffer was
* succesfully written to the socket. When the buffer is empty after the
* write operation, "done" is set to 1 (if given).
*
* Returns REDIS_ERR if an error occured trying to write and sets
* c->errstr to hold the appropriate error string.
*/
int redisBufferWrite(redisContext *c, int *done) {
int nwritten;
/* Return early when the context has seen an error. */
if (c->err)
return REDIS_ERR;
if (sdslen(c->obuf) > 0) {
nwritten = write(c->fd,c->obuf,sdslen(c->obuf));
if (nwritten == -1) {
if (errno == EAGAIN && !(c->flags & REDIS_BLOCK)) {
/* Try again later */
} else {
__redisSetError(c,REDIS_ERR_IO,NULL);
return REDIS_ERR;
}
} else if (nwritten > 0) {
if (nwritten == (signed)sdslen(c->obuf)) {
sdsfree(c->obuf);
c->obuf = sdsempty();
} else {
sdsrange(c->obuf,nwritten,-1);
}
}
}
if (done != NULL) *done = (sdslen(c->obuf) == 0);
return REDIS_OK;
}
/* Internal helper function to try and get a reply from the reader,
* or set an error in the context otherwise. */
int redisGetReplyFromReader(redisContext *c, void **reply) {
if (redisReaderGetReply(c->reader,reply) == REDIS_ERR) {
__redisSetError(c,c->reader->err,c->reader->errstr);
return REDIS_ERR;
}
return REDIS_OK;
}
int redisGetReply(redisContext *c, void **reply) {
int wdone = 0;
void *aux = NULL;
/* Try to read pending replies */
if (redisGetReplyFromReader(c,&aux) == REDIS_ERR)
return REDIS_ERR;
/* For the blocking context, flush output buffer and read reply */
if (aux == NULL && c->flags & REDIS_BLOCK) {
/* Write until done */
do {
if (redisBufferWrite(c,&wdone) == REDIS_ERR)
return REDIS_ERR;
} while (!wdone);
/* Read until there is a reply */
do {
if (redisBufferRead(c) == REDIS_ERR)
return REDIS_ERR;
if (redisGetReplyFromReader(c,&aux) == REDIS_ERR)
return REDIS_ERR;
} while (aux == NULL);
}
/* Set reply object */
if (reply != NULL) *reply = aux;
return REDIS_OK;
}
/* Helper function for the redisAppendCommand* family of functions.
*
* Write a formatted command to the output buffer. When this family
* is used, you need to call redisGetReply yourself to retrieve
* the reply (or replies in pub/sub).
*/
int __redisAppendCommand(redisContext *c, char *cmd, size_t len) {
sds newbuf;
newbuf = sdscatlen(c->obuf,cmd,len);
if (newbuf == NULL) {
__redisSetError(c,REDIS_ERR_OOM,"Out of memory");
return REDIS_ERR;
}
c->obuf = newbuf;
return REDIS_OK;
}
int redisvAppendCommand(redisContext *c, const char *format, va_list ap) {
char *cmd;
int len;
len = redisvFormatCommand(&cmd,format,ap);
if (len == -1) {
__redisSetError(c,REDIS_ERR_OOM,"Out of memory");
return REDIS_ERR;
}
if (__redisAppendCommand(c,cmd,len) != REDIS_OK) {
free(cmd);
return REDIS_ERR;
}
free(cmd);
return REDIS_OK;
}
int redisAppendCommand(redisContext *c, const char *format, ...) {
va_list ap;
int ret;
va_start(ap,format);
ret = redisvAppendCommand(c,format,ap);
va_end(ap);
return ret;
}
int redisAppendCommandArgv(redisContext *c, int argc, const char **argv, const size_t *argvlen) {
char *cmd;
int len;
len = redisFormatCommandArgv(&cmd,argc,argv,argvlen);
if (len == -1) {
__redisSetError(c,REDIS_ERR_OOM,"Out of memory");
return REDIS_ERR;
}
if (__redisAppendCommand(c,cmd,len) != REDIS_OK) {
free(cmd);
return REDIS_ERR;
}
free(cmd);
return REDIS_OK;
}
/* Helper function for the redisCommand* family of functions.
*
* Write a formatted command to the output buffer. If the given context is
* blocking, immediately read the reply into the "reply" pointer. When the
* context is non-blocking, the "reply" pointer will not be used and the
* command is simply appended to the write buffer.
*
* Returns the reply when a reply was succesfully retrieved. Returns NULL
* otherwise. When NULL is returned in a blocking context, the error field
* in the context will be set.
*/
static void *__redisBlockForReply(redisContext *c) {
void *reply;
if (c->flags & REDIS_BLOCK) {
if (redisGetReply(c,&reply) != REDIS_OK)
return NULL;
return reply;
}
return NULL;
}
void *redisvCommand(redisContext *c, const char *format, va_list ap) {
if (redisvAppendCommand(c,format,ap) != REDIS_OK)
return NULL;
return __redisBlockForReply(c);
}
void *redisCommand(redisContext *c, const char *format, ...) {
va_list ap;
void *reply = NULL;
va_start(ap,format);
reply = redisvCommand(c,format,ap);
va_end(ap);
return reply;
}
void *redisCommandArgv(redisContext *c, int argc, const char **argv, const size_t *argvlen) {
if (redisAppendCommandArgv(c,argc,argv,argvlen) != REDIS_OK)
return NULL;
return __redisBlockForReply(c);
}
================================================
FILE: deps/hiredis/hiredis.h
================================================
/*
* Copyright (c) 2009-2011, Salvatore Sanfilippo <antirez at gmail dot com>
* Copyright (c) 2010-2011, Pieter Noordhuis <pcnoordhuis at gmail dot com>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Redis nor the names of its contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __HIREDIS_H
#define __HIREDIS_H
#include <stdio.h> /* for size_t */
#include <stdarg.h> /* for va_list */
#include <sys/time.h> /* for struct timeval */
#define HIREDIS_MAJOR 0
#define HIREDIS_MINOR 10
#define HIREDIS_PATCH 1
#define REDIS_ERR -1
#define REDIS_OK 0
/* When an error occurs, the err flag in a context is set to hold the type of
* error that occured. REDIS_ERR_IO means there was an I/O error and you
* should use the "errno" variable to find out what is wrong.
* For other values, the "errstr" field will hold a description. */
#define REDIS_ERR_IO 1 /* Error in read or write */
#define REDIS_ERR_EOF 3 /* End of file */
#define REDIS_ERR_PROTOCOL 4 /* Protocol error */
#define REDIS_ERR_OOM 5 /* Out of memory */
#define REDIS_ERR_OTHER 2 /* Everything else... */
/* Connection type can be blocking or non-blocking and is set in the
* least significant bit of the flags field in redisContext. */
#define REDIS_BLOCK 0x1
/* Connection may be disconnected before being free'd. The second bit
* in the flags field is set when the context is connected. */
#define REDIS_CONNECTED 0x2
/* The async API might try to disconnect cleanly and flush the output
* buffer and read all subsequent replies before disconnecting.
* This flag means no new commands can come in and the connection
* should be terminated once all replies have been read. */
#define REDIS_DISCONNECTING 0x4
/* Flag specific to the async API which means that the context should be clean
* up as soon as possible. */
#define REDIS_FREEING 0x8
/* Flag that is set when an async callback is executed. */
#define REDIS_IN_CALLBACK 0x10
/* Flag that is set when the async context has one or more subscriptions. */
#define REDIS_SUBSCRIBED 0x20
/* Flag that is set when monitor mode is active */
#define REDIS_MONITORING 0x40
#define REDIS_REPLY_STRING 1
#define REDIS_REPLY_ARRAY 2
#define REDIS_REPLY_INTEGER 3
#define REDIS_REPLY_NIL 4
#define REDIS_REPLY_STATUS 5
#define REDIS_REPLY_ERROR 6
#define REDIS_READER_MAX_BUF (1024*16) /* Default max unused reader buffer. */
#ifdef __cplusplus
extern "C" {
#endif
/* This is the reply object returned by redisCommand() */
typedef struct redisReply {
int type; /* REDIS_REPLY_* */
long long integer; /* The integer when type is REDIS_REPLY_INTEGER */
int len; /* Length of string */
char *str; /* Used for both REDIS_REPLY_ERROR and REDIS_REPLY_STRING */
size_t elements; /* number of elements, for REDIS_REPLY_ARRAY */
struct redisReply **element; /* elements vector for REDIS_REPLY_ARRAY */
} redisReply;
typedef struct redisReadTask {
int type;
int elements; /* number of elements in multibulk container */
int idx; /* index in parent (array) object */
void *obj; /* holds user-generated value for a read task */
struct redisReadTask *parent; /* parent task */
void *privdata; /* user-settable arbitrary field */
} redisReadTask;
typedef struct redisReplyObjectFunctions {
void *(*createString)(const redisReadTask*, char*, size_t);
void *(*createArray)(const redisReadTask*, int);
void *(*createInteger)(const redisReadTask*, long long);
void *(*createNil)(const redisReadTask*);
void (*freeObject)(void*);
} redisReplyObjectFunctions;
/* State for the protocol parser */
typedef struct redisReader {
int err; /* Error flags, 0 when there is no error */
char errstr[128]; /* String representation of error when applicable */
char *buf; /* Read buffer */
size_t pos; /* Buffer cursor */
size_t len; /* Buffer length */
size_t maxbuf; /* Max length of unused buffer */
redisReadTask rstack[9];
int ridx; /* Index of current read task */
void *reply; /* Temporary reply pointer */
redisReplyObjectFunctions *fn;
void *privdata;
} redisReader;
/* Public API for the protocol parser. */
redisReader *redisReaderCreate(void);
void redisReaderFree(redisReader *r);
int redisReaderFeed(redisReader *r, const char *buf, size_t len);
int redisReaderGetReply(redisReader *r, void **reply);
/* Backwards compatibility, can be removed on big version bump. */
#define redisReplyReaderCreate redisReaderCreate
#define redisReplyReaderFree redisReaderFree
#define redisReplyReaderFeed redisReaderFeed
#define redisReplyReaderGetReply redisReaderGetReply
#define redisReplyReaderSetPrivdata(_r, _p) (int)(((redisReader*)(_r))->privdata = (_p))
#define redisReplyReaderGetObject(_r) (((redisReader*)(_r))->reply)
#define redisReplyReaderGetError(_r) (((redisReader*)(_r))->errstr)
/* Function to free the reply objects hiredis returns by default. */
void freeReplyObject(void *reply);
/* Functions to format a command according to the protocol. */
int redisvFormatCommand(char **target, const char *format, va_list ap);
int redisFormatCommand(char **target, const char *format, ...);
int redisFormatCommandArgv(char **target, int argc, const char **argv, const size_t *argvlen);
/* Context for a connection to Redis */
typedef struct redisContext {
int err; /* Error flags, 0 when there is no error */
char errstr[128]; /* String representation of error when applicable */
int fd;
int flags;
char *obuf; /* Write buffer */
redisReader *reader; /* Protocol reader */
} redisContext;
redisContext *redisConnect(const char *ip, int port);
redisContext *redisConnectWithTimeout(const char *ip, int port, struct timeval tv);
redisContext *redisConnectNonBlock(const char *ip, int port);
redisContext *redisConnectUnix(const char *path);
redisContext *redisConnectUnixWithTimeout(const char *path, struct timeval tv);
redisContext *redisConnectUnixNonBlock(const char *path);
int redisSetTimeout(redisContext *c, struct timeval tv);
void redisFree(redisContext *c);
int redisBufferRead(redisContext *c);
int redisBufferWrite(redisContext *c, int *done);
/* In a blocking context, this function first checks if there are unconsumed
* replies to return and returns one if so. Otherwise, it flushes the output
* buffer to the socket and reads until it has a reply. In a non-blocking
* context, it will return unconsumed replies until there are no more. */
int redisGetReply(redisContext *c, void **reply);
int redisGetReplyFromReader(redisContext *c, void **reply);
/* Write a command to the output buffer. Use these functions in blocking mode
* to get a pipeline of commands. */
int redisvAppendCommand(redisContext *c, const char *format, va_list ap);
int redisAppendCommand(redisContext *c, const char *format, ...);
int redisAppendCommandArgv(redisContext *c, int argc, const char **argv, const size_t *argvlen);
/* Issue a command to Redis. In a blocking context, it is identical to calling
* redisAppendCommand, followed by redisGetReply. The function will return
* NULL if there was an error in performing the request, otherwise it will
* return the reply. In a non-blocking context, it is identical to calling
* only redisAppendCommand and will always return NULL. */
void *redisvCommand(redisContext *c, const char *format, va_list ap);
void *redisCommand(redisContext *c, const char *format, ...);
void *redisCommandArgv(redisContext *c, int argc, const char **argv, const size_t *argvlen);
#ifdef __cplusplus
}
#endif
#endif
================================================
FILE: deps/hiredis/net.c
================================================
/* Extracted from anet.c to work properly with Hiredis error reporting.
*
* Copyright (c) 2006-2011, Salvatore Sanfilippo <antirez at gmail dot com>
* Copyright (c) 2010-2011, Pieter Noordhuis <pcnoordhuis at gmail dot com>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Redis nor the names of its contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "fmacros.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <netdb.h>
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <poll.h>
#include <limits.h>
#include "net.h"
#include "sds.h"
/* Defined in hiredis.c */
void __redisSetError(redisContext *c, int type, const char *str);
static void __redisSetErrorFromErrno(redisContext *c, int type, const char *prefix) {
char buf[128];
size_t len = 0;
if (prefix != NULL)
len = snprintf(buf,sizeof(buf),"%s: ",prefix);
strerror_r(errno,buf+len,sizeof(buf)-len);
__redisSetError(c,type,buf);
}
static int redisSetReuseAddr(redisContext *c, int fd) {
int on = 1;
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) {
__redisSetErrorFromErrno(c,REDIS_ERR_IO,NULL);
close(fd);
return REDIS_ERR;
}
return REDIS_OK;
}
static int redisCreateSocket(redisContext *c, int type) {
int s;
if ((s = socket(type, SOCK_STREAM, 0)) == -1) {
__redisSetErrorFromErrno(c,REDIS_ERR_IO,NULL);
return REDIS_ERR;
}
if (type == AF_INET) {
if (redisSetReuseAddr(c,s) == REDIS_ERR) {
return REDIS_ERR;
}
}
return s;
}
static int redisSetBlocking(redisContext *c, int fd, int blocking) {
int flags;
/* Set the socket nonblocking.
* Note that fcntl(2) for F_GETFL and F_SETFL can't be
* interrupted by a signal. */
if ((flags = fcntl(fd, F_GETFL)) == -1) {
__redisSetErrorFromErrno(c,REDIS_ERR_IO,"fcntl(F_GETFL)");
close(fd);
return REDIS_ERR;
}
if (blocking)
flags &= ~O_NONBLOCK;
else
flags |= O_NONBLOCK;
if (fcntl(fd, F_SETFL, flags) == -1) {
__redisSetErrorFromErrno(c,REDIS_ERR_IO,"fcntl(F_SETFL)");
close(fd);
return REDIS_ERR;
}
return REDIS_OK;
}
static int redisSetTcpNoDelay(redisContext *c, int fd) {
int yes = 1;
if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &yes, sizeof(yes)) == -1) {
__redisSetErrorFromErrno(c,REDIS_ERR_IO,"setsockopt(TCP_NODELAY)");
close(fd);
return REDIS_ERR;
}
return REDIS_OK;
}
#define __MAX_MSEC (((LONG_MAX) - 999) / 1000)
static int redisContextWaitReady(redisContext *c, int fd, const struct timeval *timeout) {
struct pollfd wfd[1];
long msec;
msec = -1;
wfd[0].fd = fd;
wfd[0].events = POLLOUT;
/* Only use timeout when not NULL. */
if (timeout != NULL) {
if (timeout->tv_usec > 1000000 || timeout->tv_sec > __MAX_MSEC) {
close(fd);
return REDIS_ERR;
}
msec = (timeout->tv_sec * 1000) + ((timeout->tv_usec + 999) / 1000);
if (msec < 0 || msec > INT_MAX) {
msec = INT_MAX;
}
}
if (errno == EINPROGRESS) {
int res;
if ((res = poll(wfd, 1, msec)) == -1) {
__redisSetErrorFromErrno(c, REDIS_ERR_IO, "poll(2)");
close(fd);
return REDIS_ERR;
} else if (res == 0) {
errno = ETIMEDOUT;
__redisSetErrorFromErrno(c,REDIS_ERR_IO,NULL);
close(fd);
return REDIS_ERR;
}
if (redisCheckSocketError(c, fd) != REDIS_OK)
return REDIS_ERR;
return REDIS_OK;
}
__redisSetErrorFromErrno(c,REDIS_ERR_IO,NULL);
close(fd);
return REDIS_ERR;
}
int redisCheckSocketError(redisContext *c, int fd) {
int err = 0;
socklen_t errlen = sizeof(err);
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &errlen) == -1) {
__redisSetErrorFromErrno(c,REDIS_ERR_IO,"getsockopt(SO_ERROR)");
close(fd);
return REDIS_ERR;
}
if (err) {
errno = err;
__redisSetErrorFromErrno(c,REDIS_ERR_IO,NULL);
close(fd);
return REDIS_ERR;
}
return REDIS_OK;
}
int redisContextSetTimeout(redisContext *c, struct timeval tv) {
if (setsockopt(c->fd,SOL_SOCKET,SO_RCVTIMEO,&tv,sizeof(tv)) == -1) {
__redisSetErrorFromErrno(c,REDIS_ERR_IO,"setsockopt(SO_RCVTIMEO)");
return REDIS_ERR;
}
if (setsockopt(c->fd,SOL_SOCKET,SO_SNDTIMEO,&tv,sizeof(tv)) == -1) {
__redisSetErrorFromErrno(c,REDIS_ERR_IO,"setsockopt(SO_SNDTIMEO)");
return REDIS_ERR;
}
return REDIS_OK;
}
int redisContextConnectTcp(redisContext *c, const char *addr, int port, struct timeval *timeout) {
int s, rv;
char _port[6]; /* strlen("65535"); */
struct addrinfo hints, *servinfo, *p;
int blocking = (c->flags & REDIS_BLOCK);
snprintf(_port, 6, "%d", port);
memset(&hints,0,sizeof(hints));
hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_STREAM;
/* Try with IPv6 if no IPv4 address was found. We do it in this order since
* in a Redis client you can't afford to test if you have IPv6 connectivity
* as this would add latency to every connect. Otherwise a more sensible
* route could be: Use IPv6 if both addresses are available and there is IPv6
* connectivity. */
if ((rv = getaddrinfo(addr,_port,&hints,&servinfo)) != 0) {
hints.ai_family = AF_INET6;
if ((rv = getaddrinfo(addr,_port,&hints,&servinfo)) != 0) {
__redisSetError(c,REDIS_ERR_OTHER,gai_strerror(rv));
return REDIS_ERR;
}
}
for (p = servinfo; p != NULL; p = p->ai_next) {
if ((s = socket(p->ai_family,p->ai_socktype,p->ai_protocol)) == -1)
continue;
if (redisSetBlocking(c,s,0) != REDIS_OK)
goto error;
if (connect(s,p->ai_addr,p->ai_addrlen) == -1) {
if (errno == EHOSTUNREACH) {
close(s);
continue;
} else if (errno == EINPROGRESS && !blocking) {
/* This is ok. */
} else {
if (redisContextWaitReady(c,s,timeout) != REDIS_OK)
goto error;
}
}
if (blocking && redisSetBlocking(c,s,1) != REDIS_OK)
goto error;
if (redisSetTcpNoDelay(c,s) != REDIS_OK)
goto error;
c->fd = s;
c->flags |= REDIS_CONNECTED;
rv = REDIS_OK;
goto end;
}
if (p == NULL) {
char buf[128];
snprintf(buf,sizeof(buf),"Can't create socket: %s",strerror(errno));
__redisSetError(c,REDIS_ERR_OTHER,buf);
goto error;
}
error:
rv = REDIS_ERR;
end:
freeaddrinfo(servinfo);
return rv; // Need to return REDIS_OK if alright
}
int redisContextConnectUnix(redisContext *c, const char *path, struct timeval *timeout) {
int s;
int blocking = (c->flags & REDIS_BLOCK);
struct sockaddr_un sa;
if ((s = redisCreateSocket(c,AF_LOCAL)) < 0)
return REDIS_ERR;
if (redisSetBlocking(c,s,0) != REDIS_OK)
return REDIS_ERR;
sa.sun_family = AF_LOCAL;
strncpy(sa.sun_path,path,sizeof(sa.sun_path)-1);
if (connect(s, (struct sockaddr*)&sa, sizeof(sa)) == -1) {
if (errno == EINPROGRESS && !blocking) {
/* This is ok. */
} else {
if (redisContextWaitReady(c,s,timeout) != REDIS_OK)
return REDIS_ERR;
}
}
/* Reset socket to be blocking after connect(2). */
if (blocking && redisSetBlocking(c,s,1) != REDIS_OK)
return REDIS_ERR;
c->fd = s;
c->flags |= REDIS_CONNECTED;
return REDIS_OK;
}
================================================
FILE: deps/hiredis/net.h
================================================
/* Extracted from anet.c to work properly with Hiredis error reporting.
*
* Copyright (c) 2006-2011, Salvatore Sanfilippo <antirez at gmail dot com>
* Copyright (c) 2010-2011, Pieter Noordhuis <pcnoordhuis at gmail dot com>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Redis nor the names of its contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __NET_H
#define __NET_H
#include "hiredis.h"
#if defined(__sun)
#define AF_LOCAL AF_UNIX
#endif
int redisCheckSocketError(redisContext *c, int fd);
int redisContextSetTimeout(redisContext *c, struct timeval tv);
int redisContextConnectTcp(redisContext *c, const char *addr, int port, struct timeval *timeout);
int redisContextConnectUnix(redisContext *c, const char *path, struct timeval *timeout);
#endif
================================================
FILE: deps/hiredis/sds.c
================================================
/* SDSLib, A C dynamic strings library
*
* Copyright (c) 2006-2012, Salvatore Sanfilippo <antirez at gmail dot com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Redis nor the names of its contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include "sds.h"
#include "zmalloc.h"
/* Create a new sds string with the content specified by the 'init' pointer
* and 'initlen'.
* If NULL is used for 'init' the string is initialized with zero bytes.
*
* The string is always null-termined (all the sds strings are, always) so
* even if you create an sds string with:
*
* mystring = sdsnewlen("abc",3");
*
* You can print the string with printf() as there is an implicit \0 at the
* end of the string. However the string is binary safe and can contain
* \0 characters in the middle, as the length is stored in the sds header. */
sds sdsnewlen(const void *init, size_t initlen) {
struct sdshdr *sh;
if (init) {
sh = zmalloc(sizeof(struct sdshdr)+initlen+1);
} else {
sh = zcalloc(sizeof(struct sdshdr)+initlen+1);
}
if (sh == NULL) return NULL;
sh->len = initlen;
sh->free = 0;
if (initlen && init)
memcpy(sh->buf, init, initlen);
sh->buf[initlen] = '\0';
return (char*)sh->buf;
}
/* Create an empty (zero length) sds string. Even in this case the string
* always has an implicit null term. */
sds sdsempty(void) {
return sdsnewlen("",0);
}
/* Create a new sds string starting from a null termined C string. */
sds sdsnew(const char *init) {
size_t initlen = (init == NULL) ? 0 : strlen(init);
return sdsnewlen(init, initlen);
}
/* Duplicate an sds string. */
sds sdsdup(const sds s) {
return sdsnewlen(s, sdslen(s));
}
/* Free an sds string. No operation is performed if 's' is NULL. */
void sdsfree(sds s) {
if (s == NULL) return;
zfree(s-sizeof(struct sdshdr));
}
/* Set the sds string length to the length as obtained with strlen(), so
* considering as content only up to the first null term character.
*
* This function is useful when the sds string is hacked manually in some
* way, like in the following example:
*
* s = sdsnew("foobar");
* s[2] = '\0';
* sdsupdatelen(s);
* printf("%d\n", sdslen(s));
*
* The output will be "2", but if we comment out the call to sdsupdatelen()
* the output will be "6" as the string was modified but the logical length
* remains 6 bytes. */
void sdsupdatelen(sds s) {
struct sdshdr *sh = (void*) (s-(sizeof(struct sdshdr)));
int reallen = strlen(s);
sh->free += (sh->len-reallen);
sh->len = reallen;
}
/* Modify an sds string on-place to make it empty (zero length).
* However all the existing buffer is not discarded but set as free space
* so that next append operations will not require allocations up to the
* number of bytes previously available. */
void sdsclear(sds s) {
struct sdshdr *sh = (void*) (s-(sizeof(struct sdshdr)));
sh->free += sh->len;
sh->len = 0;
sh->buf[0] = '\0';
}
/* Enlarge the free space at the end of the sds string so that the caller
* is sure that after calling this function can overwrite up to addlen
* bytes after the end of the string, plus one more byte for nul term.
*
* Note: this does not change the *length* of the sds string as returned
* by sdslen(), but only the free buffer space we have. */
sds sdsMakeRoomFor(sds s, size_t addlen) {
struct sdshdr *sh, *newsh;
size_t free = sdsavail(s);
size_t len, newlen;
if (free >= addlen) return s;
len = sdslen(s);
sh = (void*) (s-(sizeof(struct sdshdr)));
newlen = (len+addlen);
if (newlen < SDS_MAX_PREALLOC)
newlen *= 2;
else
newlen += SDS_MAX_PREALLOC;
newsh = zrealloc(sh, sizeof(struct sdshdr)+newlen+1);
if (newsh == NULL) return NULL;
newsh->free = newlen - len;
return newsh->buf;
}
/* Reallocate the sds string so that it has no free space at the end. The
* contained string remains not altered, but next concatenation operations
* will require a reallocation.
*
* After the call, the passed sds string is no longer valid and all the
* references must be substituted with the new pointer returned by the call. */
sds sdsRemoveFreeSpace(sds s) {
struct sdshdr *sh;
sh = (void*) (s-(sizeof(struct sdshdr)));
sh = zrealloc(sh, sizeof(struct sdshdr)+sh->len+1);
sh->free = 0;
return sh->buf;
}
/* Return the total size of the allocation of the specifed sds string,
* including:
* 1) The sds header before the pointer.
* 2) The string.
* 3) The free buffer at the end if any.
* 4) The implicit null term.
*/
size_t sdsAllocSize(sds s) {
struct sdshdr *sh = (void*) (s-(sizeof(struct sdshdr)));
return sizeof(*sh)+sh->len+sh->free+1;
}
/* Increment the sds length and decrements the left free space at the
* end of the string according to 'incr'. Also set the null term
* in the new end of the string.
*
* This function is used in order to fix the string length after the
* user calls sdsMakeRoomFor(), writes something after the end of
* the current string, and finally needs to set the new length.
*
* Note: it is possible to use a negative increment in order to
* right-trim the string.
*
* Usage example:
*
* Using sdsIncrLen() and sdsMakeRoomFor() it is possible to mount the
* following schema, to cat bytes coming from the kernel to the end of an
* sds string without copying into an intermediate buffer:
*
* oldlen = sdslen(s);
* s = sdsMakeRoomFor(s, BUFFER_SIZE);
* nread = read(fd, s+oldlen, BUFFER_SIZE);
* ... check for nread <= 0 and handle it ...
* sdsIncrLen(s, nread);
*/
void sdsIncrLen(sds s, int incr) {
struct sdshdr *sh = (void*) (s-(sizeof(struct sdshdr)));
assert(sh->free >= incr);
sh->len += incr;
sh->free -= incr;
assert(sh->free >= 0);
s[sh->len] = '\0';
}
/* Grow the sds to have the specified length. Bytes that were not part of
* the original length of the sds will be set to zero.
*
* if the specified length is smaller than the current length, no operation
* is performed. */
sds sdsgrowzero(sds s, size_t len) {
struct sdshdr *sh = (void*)(s-(sizeof(struct sdshdr)));
size_t totlen, curlen = sh->len;
if (len <= curlen) return s;
s = sdsMakeRoomFor(s,len-curlen);
if (s == NULL) return NULL;
/* Make sure added region doesn't contain garbage */
sh = (void*)(s-(sizeof(struct sdshdr)));
memset(s+curlen,0,(len-curlen+1)); /* also set trailing \0 byte */
totlen = sh->len+sh->free;
sh->len = len;
sh->free = totlen-sh->len;
return s;
}
/* Append the specified binary-safe string pointed by 't' of 'len' bytes to the
* end of the specified sds string 's'.
*
* After the call, the passed sds string is no longer valid and all the
* references must be substituted with the new pointer returned by the call. */
sds sdscatlen(sds s, const void *t, size_t len) {
struct sdshdr *sh;
size_t curlen = sdslen(s);
s = sdsMakeRoomFor(s,len);
if (s == NULL) return NULL;
sh = (void*) (s-(sizeof(struct sdshdr)));
memcpy(s+curlen, t, len);
sh->len = curlen+len;
sh->free = sh->free-len;
s[curlen+len] = '\0';
return s;
}
/* Append the specified null termianted C string to the sds string 's'.
*
* After the call, the passed sds string is no longer valid and all the
* references must be substituted with the new pointer returned by the call. */
sds sdscat(sds s, const char *t) {
return sdscatlen(s, t, strlen(t));
}
/* Append the specified sds 't' to the existing sds 's'.
*
* After the call, the modified sds string is no longer valid and all the
* references must be substituted with the new pointer returned by the call. */
sds sdscatsds(sds s, const sds t) {
return sdscatlen(s, t, sdslen(t));
}
/* Destructively modify the sds string 's' to hold the specified binary
* safe string pointed by 't' of length 'len' bytes. */
sds sdscpylen(sds s, const char *t, size_t len) {
struct sdshdr *sh = (void*) (s-(sizeof(struct sdshdr)));
size_t totlen = sh->free+sh->len;
if (totlen < len) {
s = sdsMakeRoomFor(s,len-sh->len);
if (s == NULL) return NULL;
sh = (void*) (s-(sizeof(struct sdshdr)));
totlen = sh->free+sh->len;
}
memcpy(s, t, len);
s[len] = '\0';
sh->len = len;
sh->free = totlen-len;
return s;
}
/* Like sdscpylen() but 't' must be a null-termined string so that the length
* of the string is obtained with strlen(). */
sds sdscpy(sds s, const char *t) {
return sdscpylen(s, t, strlen(t));
}
/* Like sdscatpritf() but gets va_list instead of being variadic. */
sds sdscatvprintf(sds s, const char *fmt, va_list ap) {
va_list cpy;
char *buf, *t;
size_t buflen = 16;
while(1) {
buf = zmalloc(buflen);
if (buf == NULL) return NULL;
buf[buflen-2] = '\0';
va_copy(cpy,ap);
vsnprintf(buf, buflen, fmt, cpy);
if (buf[buflen-2] != '\0') {
zfree(buf);
buflen *= 2;
continue;
}
break;
}
t = sdscat(s, buf);
zfree(buf);
return t;
}
/* Append to the sds string 's' a string obtained using printf-alike format
* specifier.
*
* After the call, the modified sds string is no longer valid and all the
* references must be substituted with the new pointer returned by the call.
*
* Example:
*
* s = sdsempty("Sum is: ");
* s = sdscatprintf(s,"%d+%d = %d",a,b,a+b).
*
* Often you need to create a string from scratch with the printf-alike
* format. When this is the need, just use sdsempty() as the target string:
*
* s = sdscatprintf(sdsempty(), "... your format ...", args);
*/
sds sdscatprintf(sds s, const char *fmt, ...) {
va_list ap;
char *t;
va_start(ap, fmt);
t = sdscatvprintf(s,fmt,ap);
va_end(ap);
return t;
}
/* Remove the part of the string from left and from right composed just of
* contiguous characters found in 'cset', that is a null terminted C string.
*
* After the call, the modified sds string is no longer valid and all the
* references must be substituted with the new pointer returned by the call.
*
* Example:
*
* s = sdsnew("AA...AA.a.aa.aHelloWorld :::");
* s = sdstrim(s,"A. :");
* printf("%s\n", s);
*
* Output will be just "Hello World".
*/
sds sdstrim(sds s, const char *cset) {
struct sdshdr *sh = (void*) (s-(sizeof(struct sdshdr)));
char *start, *end, *sp, *ep;
size_t len;
sp = start = s;
ep = end = s+sdslen(s)-1;
while(sp <= end && strchr(cset, *sp)) sp++;
while(ep > start && strchr(cset, *ep)) ep--;
len = (sp > ep) ? 0 : ((ep-sp)+1);
if (sh->buf != sp) memmove(sh->buf, sp, len);
sh->buf[len] = '\0';
sh->free = sh->free+(sh->len-len);
sh->len = len;
return s;
}
/* Turn the string into a smaller (or equal) string containing only the
* substring specified by the 'start' and 'end' indexes.
*
* start and end can be negative, where -1 means the last character of the
* string, -2 the penultimate character, and so forth.
*
* The interval is inclusive, so the start and end characters will be part
* of the resulting string.
*
* The string is modified in-place.
*
* Example:
*
* s = sdsnew("Hello World");
* sdstrim(s,1,-1); => "ello Worl"
*/
void sdsrange(sds s, int start, int end) {
struct sdshdr *sh = (void*) (s-(sizeof(struct sdshdr)));
size_t newlen, len = sdslen(s);
if (len == 0) return;
if (start < 0) {
start = len+start;
if (start < 0) start = 0;
}
if (end < 0) {
end = len+end;
if (end < 0) end = 0;
}
newlen = (start > end) ? 0 : (end-start)+1;
if (newlen != 0) {
if (start >= (signed)len) {
newlen = 0;
} else if (end >= (signed)len) {
end = len-1;
newlen = (start > end) ? 0 : (end-start)+1;
}
} else {
start = 0;
}
if (start && newlen) memmove(sh->buf, sh->buf+start, newlen);
sh->buf[newlen] = 0;
sh->free = sh->free+(sh->len-newlen);
sh->len = newlen;
}
/* Apply tolower() to every character of the sds string 's'. */
void sdstolower(sds s) {
int len = sdslen(s), j;
for (j = 0; j < len; j++) s[j] = tolower(s[j]);
}
/* Apply toupper() to every character of the sds string 's'. */
void sdstoupper(sds s) {
int len = sdslen(s), j;
for (j = 0; j < len; j++) s[j] = toupper(s[j]);
}
/* Compare two sds strings s1 and s2 with memcmp().
*
* Return value:
*
* 1 if s1 > s2.
* -1 if s1 < s2.
* 0 if s1 and s2 are exactly the same binary string.
*
* If two strings share exactly the same prefix, but one of the two has
* additional characters, the longer string is considered to be greater than
* the smaller one. */
int sdscmp(const sds s1, const sds s2) {
size_t l1, l2, minlen;
int cmp;
l1 = sdslen(s1);
l2 = sdslen(s2);
minlen = (l1 < l2) ? l1 : l2;
cmp = memcmp(s1,s2,minlen);
if (cmp == 0) return l1-l2;
return cmp;
}
/* Split 's' with separator in 'sep'. An array
* of sds strings is returned. *count will be set
* by reference to the number of tokens returned.
*
* On out of memory, zero length string, zero length
* separator, NULL is returned.
*
* Note that 'sep' is able to split a string using
* a multi-character separator. For example
* sdssplit("foo_-_bar","_-_"); will return two
* elements "foo" and "bar".
*
* This version of the function is binary-safe but
* requires length arguments. sdssplit() is just the
* same function but for zero-terminated strings.
*/
sds *sdssplitlen(const char *s, int len, const char *sep, int seplen, int *count) {
int elements = 0, slots = 5, start = 0, j;
sds *tokens;
if (seplen < 1 || len < 0) return NULL;
tokens = zmalloc(sizeof(sds)*slots);
if (tokens == NULL) return NULL;
if (len == 0) {
*count = 0;
return tokens;
}
for (j = 0; j < (len-(seplen-1)); j++) {
/* make sure there is room for the next element and the final one */
if (slots < elements+2) {
sds *newtokens;
slots *= 2;
newtokens = zrealloc(tokens,sizeof(sds)*slots);
if (newtokens == NULL) goto cleanup;
tokens = newtokens;
}
/* search the separator */
if ((seplen == 1 && *(s+j) == sep[0]) || (memcmp(s+j,sep,seplen) == 0)) {
tokens[elements] = sdsnewlen(s+start,j-start);
if (tokens[elements] == NULL) goto cleanup;
elements++;
start = j+seplen;
j = j+seplen-1; /* skip the separator */
}
}
/* Add the final element. We are sure there is room in the tokens array. */
tokens[elements] = sdsnewlen(s+start,len-start);
if (tokens[elements] == NULL) goto cleanup;
elements++;
*count = elements;
return tokens;
cleanup:
{
int i;
for (i = 0; i < elements; i++) sdsfree(tokens[i]);
zfree(tokens);
*count = 0;
return NULL;
}
}
/* Free the result returned by sdssplitlen(), or do nothing if 'tokens' is NULL. */
void sdsfreesplitres(sds *tokens, int count) {
if (!tokens) return;
while(count--)
sdsfree(tokens[count]);
zfree(tokens);
}
/* Create an sds string from a long long value. It is much faster than:
*
* sdscatprintf(sdsempty(),"%lld\n", value);
*/
sds sdsfromlonglong(long long value) {
char buf[32], *p;
unsigned long long v;
v = (value < 0) ? -value : value;
p = buf+31; /* point to the last character */
do {
*p-- = '0'+(v%10);
v /= 10;
} while(v);
if (value < 0) *p-- = '-';
p++;
return sdsnewlen(p,32-(p-buf));
}
/* Append to the sds string "s" an escaped string representation where
* all the non-printable characters (tested with isprint()) are turned into
* escapes in the form "\n\r\a...." or "\x<hex-number>".
*
* After the call, the modified sds string is no longer valid and all the
* references must be substituted with the new pointer returned by the call. */
sds sdscatrepr(sds s, const char *p, size_t len) {
s = sdscatlen(s,"\"",1);
while(len--) {
switch(*p) {
case '\\':
case '"':
s = sdscatprintf(s,"\\%c",*p);
break;
case '\n': s = sdscatlen(s,"\\n",2); break;
case '\r': s = sdscatlen(s,"\\r",2); break;
case '\t': s = sdscatlen(s,"\\t",2); break;
case '\a': s = sdscatlen(s,"\\a",2); break;
case '\b': s = sdscatlen(s,"\\b",2); break;
default:
if (isprint(*p))
s = sdscatprintf(s,"%c",*p);
else
s = sdscatprintf(s,"\\x%02x",(unsigned char)*p);
break;
}
p++;
}
return sdscatlen(s,"\"",1);
}
/* Helper function for sdssplitargs() that returns non zero if 'c'
* is a valid hex digit. */
int is_hex_digit(char c) {
return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') ||
(c >= 'A' && c <= 'F');
}
/* Helper function for sdssplitargs() that converts an hex digit into an
* integer from 0 to 15 */
int hex_digit_to_int(char c) {
switch(c) {
case '0': return 0;
case '1': return 1;
case '2': return 2;
case '3': return 3;
case '4': return 4;
case '5': return 5;
case '6': return 6;
case '7': return 7;
case '8': return 8;
case '9': return 9;
case 'a': case 'A': return 10;
case 'b': case 'B': return 11;
case 'c': case 'C': return 12;
case 'd': case 'D': return 13;
case 'e': case 'E': return 14;
case 'f': case 'F': return 15;
default: return 0;
}
}
/* Split a line into arguments, where every argument can be in the
* following programming-language REPL-alike form:
*
* foo bar "newline are supported\n" and "\xff\x00otherstuff"
*
* The number of arguments is stored into *argc, and an array
* of sds is returned.
*
* The caller should free the resulting array of sds strings with
* sdsfreesplitres().
*
* Note that sdscatrepr() is able to convert back a string into
* a quoted string in the same format sdssplitargs() is able to parse.
*
* The function returns the allocated tokens on success, even when the
* input string is empty, or NULL if the input contains unbalanced
* quotes or closed quotes followed by non space characters
* as in: "foo"bar or "foo'
*/
sds *sdssplitargs(const char *line, int *argc) {
const char *p = line;
char *current = NULL;
char **vector = NULL;
*argc = 0;
while(1) {
/* skip blanks */
while(*p && isspace(*p)) p++;
if (*p) {
/* get a token */
int inq=0; /* set to 1 if we are in "quotes" */
int insq=0; /* set to 1 if we are in 'single quotes' */
int done=0;
if (current == NULL) current = sdsempty();
while(!done) {
if (inq) {
if (*p == '\\' && *(p+1) == 'x' &&
is_hex_digit(*(p+2)) &&
is_hex_digit(*(p+3)))
{
unsigned char byte;
byte = (hex_digit_to_int(*(p+2))*16)+
hex_digit_to_int(*(p+3));
current = sdscatlen(current,(char*)&byte,1);
p += 3;
} else if (*p == '\\' && *(p+1)) {
char c;
p++;
switch(*p) {
case 'n': c = '\n'; break;
case 'r': c = '\r'; break;
case 't': c = '\t'; break;
case 'b': c = '\b'; break;
case 'a': c = '\a'; break;
default: c = *p; break;
}
gitextract_qfafq3g7/
├── .gitignore
├── 00-RELEASENOTES
├── BUGS
├── CONTRIBUTING
├── COPYING
├── INSTALL
├── MANIFESTO
├── Makefile
├── README
├── README.rst
├── deps/
│ ├── Makefile
│ ├── hiredis/
│ │ ├── .gitignore
│ │ ├── CHANGELOG.md
│ │ ├── COPYING
│ │ ├── Makefile
│ │ ├── README.md
│ │ ├── adapters/
│ │ │ ├── ae.h
│ │ │ ├── libev.h
│ │ │ └── libevent.h
│ │ ├── async.c
│ │ ├── async.h
│ │ ├── dict.c
│ │ ├── dict.h
│ │ ├── example-ae.c
│ │ ├── example-libev.c
│ │ ├── example-libevent.c
│ │ ├── example.c
│ │ ├── fmacros.h
│ │ ├── hiredis.c
│ │ ├── hiredis.h
│ │ ├── net.c
│ │ ├── net.h
│ │ ├── sds.c
│ │ ├── sds.h
│ │ ├── test.c
│ │ └── zmalloc.h
│ ├── jemalloc/
│ │ ├── .gitignore
│ │ ├── COPYING
│ │ ├── ChangeLog
│ │ ├── INSTALL
│ │ ├── Makefile.in
│ │ ├── README
│ │ ├── VERSION
│ │ ├── autogen.sh
│ │ ├── bin/
│ │ │ ├── jemalloc.sh.in
│ │ │ └── pprof
│ │ ├── config.guess
│ │ ├── config.stamp.in
│ │ ├── config.sub
│ │ ├── configure
│ │ ├── configure.ac
│ │ ├── doc/
│ │ │ ├── html.xsl.in
│ │ │ ├── jemalloc.3
│ │ │ ├── jemalloc.html
│ │ │ ├── jemalloc.xml.in
│ │ │ ├── manpages.xsl.in
│ │ │ └── stylesheet.xsl
│ │ ├── include/
│ │ │ ├── jemalloc/
│ │ │ │ ├── internal/
│ │ │ │ │ ├── arena.h
│ │ │ │ │ ├── atomic.h
│ │ │ │ │ ├── base.h
│ │ │ │ │ ├── bitmap.h
│ │ │ │ │ ├── chunk.h
│ │ │ │ │ ├── chunk_dss.h
│ │ │ │ │ ├── chunk_mmap.h
│ │ │ │ │ ├── ckh.h
│ │ │ │ │ ├── ctl.h
│ │ │ │ │ ├── extent.h
│ │ │ │ │ ├── hash.h
│ │ │ │ │ ├── huge.h
│ │ │ │ │ ├── jemalloc_internal.h.in
│ │ │ │ │ ├── mb.h
│ │ │ │ │ ├── mutex.h
│ │ │ │ │ ├── private_namespace.h
│ │ │ │ │ ├── prng.h
│ │ │ │ │ ├── prof.h
│ │ │ │ │ ├── ql.h
│ │ │ │ │ ├── qr.h
│ │ │ │ │ ├── quarantine.h
│ │ │ │ │ ├── rb.h
│ │ │ │ │ ├── rtree.h
│ │ │ │ │ ├── size_classes.sh
│ │ │ │ │ ├── stats.h
│ │ │ │ │ ├── tcache.h
│ │ │ │ │ ├── tsd.h
│ │ │ │ │ └── util.h
│ │ │ │ ├── jemalloc.h.in
│ │ │ │ └── jemalloc_defs.h.in
│ │ │ └── msvc_compat/
│ │ │ ├── inttypes.h
│ │ │ ├── stdbool.h
│ │ │ ├── stdint.h
│ │ │ └── strings.h
│ │ ├── install-sh
│ │ ├── src/
│ │ │ ├── arena.c
│ │ │ ├── atomic.c
│ │ │ ├── base.c
│ │ │ ├── bitmap.c
│ │ │ ├── chunk.c
│ │ │ ├── chunk_dss.c
│ │ │ ├── chunk_mmap.c
│ │ │ ├── ckh.c
│ │ │ ├── ctl.c
│ │ │ ├── extent.c
│ │ │ ├── hash.c
│ │ │ ├── huge.c
│ │ │ ├── jemalloc.c
│ │ │ ├── mb.c
│ │ │ ├── mutex.c
│ │ │ ├── prof.c
│ │ │ ├── quarantine.c
│ │ │ ├── rtree.c
│ │ │ ├── stats.c
│ │ │ ├── tcache.c
│ │ │ ├── tsd.c
│ │ │ ├── util.c
│ │ │ └── zone.c
│ │ └── test/
│ │ ├── ALLOCM_ARENA.c
│ │ ├── ALLOCM_ARENA.exp
│ │ ├── aligned_alloc.c
│ │ ├── aligned_alloc.exp
│ │ ├── allocated.c
│ │ ├── allocated.exp
│ │ ├── allocm.c
│ │ ├── allocm.exp
│ │ ├── bitmap.c
│ │ ├── bitmap.exp
│ │ ├── jemalloc_test.h.in
│ │ ├── mremap.c
│ │ ├── mremap.exp
│ │ ├── posix_memalign.c
│ │ ├── posix_memalign.exp
│ │ ├── rallocm.c
│ │ ├── rallocm.exp
│ │ ├── thread_arena.c
│ │ ├── thread_arena.exp
│ │ ├── thread_tcache_enabled.c
│ │ └── thread_tcache_enabled.exp
│ ├── linenoise/
│ │ ├── .gitignore
│ │ ├── Makefile
│ │ ├── README.markdown
│ │ ├── example.c
│ │ ├── linenoise.c
│ │ └── linenoise.h
│ └── lua/
│ ├── COPYRIGHT
│ ├── HISTORY
│ ├── INSTALL
│ ├── Makefile
│ ├── README
│ ├── doc/
│ │ ├── contents.html
│ │ ├── lua.1
│ │ ├── lua.css
│ │ ├── lua.html
│ │ ├── luac.1
│ │ ├── luac.html
│ │ ├── manual.css
│ │ ├── manual.html
│ │ └── readme.html
│ ├── etc/
│ │ ├── Makefile
│ │ ├── README
│ │ ├── all.c
│ │ ├── lua.hpp
│ │ ├── lua.pc
│ │ ├── luavs.bat
│ │ ├── min.c
│ │ ├── noparser.c
│ │ └── strict.lua
│ ├── src/
│ │ ├── Makefile
│ │ ├── lapi.c
│ │ ├── lapi.h
│ │ ├── lauxlib.c
│ │ ├── lauxlib.h
│ │ ├── lbaselib.c
│ │ ├── lcode.c
│ │ ├── lcode.h
│ │ ├── ldblib.c
│ │ ├── ldebug.c
│ │ ├── ldebug.h
│ │ ├── ldo.c
│ │ ├── ldo.h
│ │ ├── ldump.c
│ │ ├── lfunc.c
│ │ ├── lfunc.h
│ │ ├── lgc.c
│ │ ├── lgc.h
│ │ ├── linit.c
│ │ ├── liolib.c
│ │ ├── llex.c
│ │ ├── llex.h
│ │ ├── llimits.h
│ │ ├── lmathlib.c
│ │ ├── lmem.c
│ │ ├── lmem.h
│ │ ├── loadlib.c
│ │ ├── lobject.c
│ │ ├── lobject.h
│ │ ├── lopcodes.c
│ │ ├── lopcodes.h
│ │ ├── loslib.c
│ │ ├── lparser.c
│ │ ├── lparser.h
│ │ ├── lstate.c
│ │ ├── lstate.h
│ │ ├── lstring.c
│ │ ├── lstring.h
│ │ ├── lstrlib.c
│ │ ├── ltable.c
│ │ ├── ltable.h
│ │ ├── ltablib.c
│ │ ├── ltm.c
│ │ ├── ltm.h
│ │ ├── lua.c
│ │ ├── lua.h
│ │ ├── lua_cjson.c
│ │ ├── lua_cmsgpack.c
│ │ ├── lua_struct.c
│ │ ├── luac.c
│ │ ├── luaconf.h
│ │ ├── lualib.h
│ │ ├── lundump.c
│ │ ├── lundump.h
│ │ ├── lvm.c
│ │ ├── lvm.h
│ │ ├── lzio.c
│ │ ├── lzio.h
│ │ ├── print.c
│ │ ├── strbuf.c
│ │ └── strbuf.h
│ └── test/
│ ├── README
│ ├── bisect.lua
│ ├── cf.lua
│ ├── echo.lua
│ ├── env.lua
│ ├── factorial.lua
│ ├── fib.lua
│ ├── fibfor.lua
│ ├── globals.lua
│ ├── hello.lua
│ ├── life.lua
│ ├── luac.lua
│ ├── printf.lua
│ ├── readonly.lua
│ ├── sieve.lua
│ ├── sort.lua
│ ├── table.lua
│ ├── trace-calls.lua
│ ├── trace-globals.lua
│ └── xd.lua
├── redis.conf
├── runtest
├── runtest-cluster
├── runtest-sentinel
├── sentinel.conf
├── src/
│ ├── .gitignore
│ ├── Makefile
│ ├── Makefile.dep
│ ├── adlist.c
│ ├── adlist.h
│ ├── ae.c
│ ├── ae.h
│ ├── ae_epoll.c
│ ├── ae_evport.c
│ ├── ae_kqueue.c
│ ├── ae_select.c
│ ├── anet.c
│ ├── anet.h
│ ├── aof.c
│ ├── asciilogo.h
│ ├── bio.c
│ ├── bio.h
│ ├── bitops.c
│ ├── blocked.c
│ ├── cluster.c
│ ├── cluster.h
│ ├── config.c
│ ├── config.h
│ ├── crc16.c
│ ├── crc64.c
│ ├── crc64.h
│ ├── db.c
│ ├── debug.c
│ ├── dict.c
│ ├── dict.h
│ ├── endianconv.c
│ ├── endianconv.h
│ ├── fmacros.h
│ ├── help.h
│ ├── hyperloglog.c
│ ├── intset.c
│ ├── intset.h
│ ├── lzf.h
│ ├── lzfP.h
│ ├── lzf_c.c
│ ├── lzf_d.c
│ ├── memtest.c
│ ├── mkreleasehdr.sh
│ ├── multi.c
│ ├── networking.c
│ ├── notify.c
│ ├── object.c
│ ├── pqsort.c
│ ├── pqsort.h
│ ├── pubsub.c
│ ├── rand.c
│ ├── rand.h
│ ├── rdb.c
│ ├── rdb.h
│ ├── redis-benchmark.c
│ ├── redis-check-aof.c
│ ├── redis-check-dump.c
│ ├── redis-cli.c
│ ├── redis-trib.rb
│ ├── redis.c
│ ├── redis.h
│ ├── redisassert.h
│ ├── release.c
│ ├── replication.c
│ ├── rio.c
│ ├── rio.h
│ ├── scripting.c
│ ├── sds.c
│ ├── sds.h
│ ├── sentinel.c
│ ├── setproctitle.c
│ ├── sha1.c
│ ├── sha1.h
│ ├── slowlog.c
│ ├── slowlog.h
│ ├── solarisfixes.h
│ ├── sort.c
│ ├── syncio.c
│ ├── t_hash.c
│ ├── t_list.c
│ ├── t_set.c
│ ├── t_string.c
│ ├── t_zset.c
│ ├── testhelp.h
│ ├── util.c
│ ├── util.h
│ ├── valgrind.sup
│ ├── version.h
│ ├── ziplist.c
│ ├── ziplist.h
│ ├── zipmap.c
│ ├── zipmap.h
│ ├── zmalloc.c
│ └── zmalloc.h
├── tests/
│ ├── assets/
│ │ ├── default.conf
│ │ ├── encodings.rdb
│ │ └── hash-zipmap.rdb
│ ├── cluster/
│ │ ├── cluster.tcl
│ │ ├── run.tcl
│ │ └── tests/
│ │ ├── 00-base.tcl
│ │ └── includes/
│ │ └── init-tests.tcl
│ ├── helpers/
│ │ ├── bg_complex_data.tcl
│ │ └── gen_write_load.tcl
│ ├── instances.tcl
│ ├── integration/
│ │ ├── aof-race.tcl
│ │ ├── aof.tcl
│ │ ├── convert-zipmap-hash-on-load.tcl
│ │ ├── rdb.tcl
│ │ ├── redis-cli.tcl
│ │ ├── replication-2.tcl
│ │ ├── replication-3.tcl
│ │ ├── replication-4.tcl
│ │ ├── replication-psync.tcl
│ │ └── replication.tcl
│ ├── sentinel/
│ │ ├── run.tcl
│ │ ├── tests/
│ │ │ ├── 00-base.tcl
│ │ │ ├── 01-conf-update.tcl
│ │ │ ├── 02-slaves-reconf.tcl
│ │ │ ├── 03-runtime-reconf.tcl
│ │ │ ├── 04-slave-selection.tcl
│ │ │ └── includes/
│ │ │ └── init-tests.tcl
│ │ └── tmp/
│ │ └── .gitignore
│ ├── support/
│ │ ├── cluster.tcl
│ │ ├── redis.tcl
│ │ ├── server.tcl
│ │ ├── test.tcl
│ │ ├── tmpfile.tcl
│ │ └── util.tcl
│ ├── test_helper.tcl
│ └── unit/
│ ├── aofrw.tcl
│ ├── auth.tcl
│ ├── basic.tcl
│ ├── bitops.tcl
│ ├── dump.tcl
│ ├── expire.tcl
│ ├── hyperloglog.tcl
│ ├── introspection.tcl
│ ├── limits.tcl
│ ├── maxmemory.tcl
│ ├── memefficiency.tcl
│ ├── multi.tcl
│ ├── obuf-limits.tcl
│ ├── other.tcl
│ ├── printver.tcl
│ ├── protocol.tcl
│ ├── pubsub.tcl
│ ├── quit.tcl
│ ├── scan.tcl
│ ├── scripting.tcl
│ ├── slowlog.tcl
│ ├── sort.tcl
│ └── type/
│ ├── hash.tcl
│ ├── list-2.tcl
│ ├── list-3.tcl
│ ├── list-common.tcl
│ ├── list.tcl
│ ├── set.tcl
│ └── zset.tcl
└── utils/
├── build-static-symbols.tcl
├── generate-command-help.rb
├── hyperloglog/
│ ├── .gitignore
│ ├── hll-err.rb
│ └── hll-gnuplot-graph.rb
├── install_server.sh
├── lru/
│ ├── README
│ └── test-lru.rb
├── mkrelease.sh
├── redis-copy.rb
├── redis-sha1.rb
├── redis_init_script
├── redis_init_script.tpl
├── speed-regression.tcl
└── whatisdoing.sh
Showing preview only (256K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (3098 symbols across 193 files)
FILE: deps/hiredis/adapters/ae.h
type redisAeEvents (line 38) | typedef struct redisAeEvents {
function redisAeReadEvent (line 45) | static void redisAeReadEvent(aeEventLoop *el, int fd, void *privdata, in...
function redisAeWriteEvent (line 52) | static void redisAeWriteEvent(aeEventLoop *el, int fd, void *privdata, i...
function redisAeAddRead (line 59) | static void redisAeAddRead(void *privdata) {
function redisAeDelRead (line 68) | static void redisAeDelRead(void *privdata) {
function redisAeAddWrite (line 77) | static void redisAeAddWrite(void *privdata) {
function redisAeDelWrite (line 86) | static void redisAeDelWrite(void *privdata) {
function redisAeCleanup (line 95) | static void redisAeCleanup(void *privdata) {
function redisAeAttach (line 102) | static int redisAeAttach(aeEventLoop *loop, redisAsyncContext *ac) {
FILE: deps/hiredis/adapters/libev.h
type redisLibevEvents (line 39) | typedef struct redisLibevEvents {
function redisLibevReadEvent (line 46) | static void redisLibevReadEvent(EV_P_ ev_io *watcher, int revents) {
function redisLibevWriteEvent (line 56) | static void redisLibevWriteEvent(EV_P_ ev_io *watcher, int revents) {
function redisLibevAddRead (line 66) | static void redisLibevAddRead(void *privdata) {
function redisLibevDelRead (line 76) | static void redisLibevDelRead(void *privdata) {
function redisLibevAddWrite (line 86) | static void redisLibevAddWrite(void *privdata) {
function redisLibevDelWrite (line 96) | static void redisLibevDelWrite(void *privdata) {
function redisLibevCleanup (line 106) | static void redisLibevCleanup(void *privdata) {
function redisLibevAttach (line 113) | static int redisLibevAttach(EV_P_ redisAsyncContext *ac) {
FILE: deps/hiredis/adapters/libevent.h
type redisLibeventEvents (line 37) | typedef struct redisLibeventEvents {
function redisLibeventReadEvent (line 42) | static void redisLibeventReadEvent(int fd, short event, void *arg) {
function redisLibeventWriteEvent (line 48) | static void redisLibeventWriteEvent(int fd, short event, void *arg) {
function redisLibeventAddRead (line 54) | static void redisLibeventAddRead(void *privdata) {
function redisLibeventDelRead (line 59) | static void redisLibeventDelRead(void *privdata) {
function redisLibeventAddWrite (line 64) | static void redisLibeventAddWrite(void *privdata) {
function redisLibeventDelWrite (line 69) | static void redisLibeventDelWrite(void *privdata) {
function redisLibeventCleanup (line 74) | static void redisLibeventCleanup(void *privdata) {
function redisLibeventAttach (line 81) | static int redisLibeventAttach(redisAsyncContext *ac, struct event_base ...
FILE: deps/hiredis/async.c
function callbackHash (line 64) | static unsigned int callbackHash(const void *key) {
function callbackKeyCompare (line 75) | static int callbackKeyCompare(void *privdata, const void *key1, const vo...
function callbackKeyDestructor (line 85) | static void callbackKeyDestructor(void *privdata, void *key) {
function callbackValDestructor (line 90) | static void callbackValDestructor(void *privdata, void *val) {
function redisAsyncContext (line 104) | static redisAsyncContext *redisAsyncInitialize(redisContext *c) {
function __redisAsyncCopyError (line 138) | static void __redisAsyncCopyError(redisAsyncContext *ac) {
function redisAsyncContext (line 144) | redisAsyncContext *redisAsyncConnect(const char *ip, int port) {
function redisAsyncContext (line 151) | redisAsyncContext *redisAsyncConnectUnix(const char *path) {
function redisAsyncSetConnectCallback (line 158) | int redisAsyncSetConnectCallback(redisAsyncContext *ac, redisConnectCall...
function redisAsyncSetDisconnectCallback (line 171) | int redisAsyncSetDisconnectCallback(redisAsyncContext *ac, redisDisconne...
function __redisPushCallback (line 180) | static int __redisPushCallback(redisCallbackList *list, redisCallback *s...
function __redisShiftCallback (line 199) | static int __redisShiftCallback(redisCallbackList *list, redisCallback *...
function __redisRunCallback (line 215) | static void __redisRunCallback(redisAsyncContext *ac, redisCallback *cb,...
function __redisAsyncFree (line 225) | static void __redisAsyncFree(redisAsyncContext *ac) {
function redisAsyncFree (line 273) | void redisAsyncFree(redisAsyncContext *ac) {
function __redisAsyncDisconnect (line 281) | static void __redisAsyncDisconnect(redisAsyncContext *ac) {
function redisAsyncDisconnect (line 307) | void redisAsyncDisconnect(redisAsyncContext *ac) {
function __redisGetSubscribeCallback (line 314) | static int __redisGetSubscribeCallback(redisAsyncContext *ac, redisReply...
function redisProcessCallbacks (line 361) | void redisProcessCallbacks(redisAsyncContext *ac) {
function __redisAsyncHandleConnect (line 442) | static int __redisAsyncHandleConnect(redisAsyncContext *ac) {
function redisAsyncHandleRead (line 464) | void redisAsyncHandleRead(redisAsyncContext *ac) {
function redisAsyncHandleWrite (line 485) | void redisAsyncHandleWrite(redisAsyncContext *ac) {
function __redisAsyncCommand (line 531) | static int __redisAsyncCommand(redisAsyncContext *ac, redisCallbackFn *f...
function redisvAsyncCommand (line 595) | int redisvAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void ...
function redisAsyncCommand (line 605) | int redisAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void *...
function redisAsyncCommandArgv (line 614) | int redisAsyncCommandArgv(redisAsyncContext *ac, redisCallbackFn *fn, vo...
FILE: deps/hiredis/async.h
type redisAsyncContext (line 40) | struct redisAsyncContext
type dict (line 41) | struct dict
type redisAsyncContext (line 44) | struct redisAsyncContext
type redisCallback (line 45) | typedef struct redisCallback {
type redisCallbackList (line 52) | typedef struct redisCallbackList {
type redisAsyncContext (line 57) | struct redisAsyncContext
type redisAsyncContext (line 58) | struct redisAsyncContext
type redisAsyncContext (line 61) | typedef struct redisAsyncContext {
FILE: deps/hiredis/dict.c
function dictGenHashFunction (line 53) | static unsigned int dictGenHashFunction(const unsigned char *buf, int le...
function _dictReset (line 65) | static void _dictReset(dict *ht) {
function dict (line 73) | static dict *dictCreate(dictType *type, void *privDataPtr) {
function _dictInit (line 80) | static int _dictInit(dict *ht, dictType *type, void *privDataPtr) {
function dictExpand (line 88) | static int dictExpand(dict *ht, unsigned long size) {
function dictAdd (line 135) | static int dictAdd(dict *ht, void *key, void *val) {
function dictReplace (line 160) | static int dictReplace(dict *ht, void *key, void *val) {
function dictDelete (line 182) | static int dictDelete(dict *ht, const void *key) {
function _dictClear (line 213) | static int _dictClear(dict *ht) {
function dictRelease (line 238) | static void dictRelease(dict *ht) {
function dictEntry (line 243) | static dictEntry *dictFind(dict *ht, const void *key) {
function dictIterator (line 258) | static dictIterator *dictGetIterator(dict *ht) {
function dictEntry (line 268) | static dictEntry *dictNext(dictIterator *iter) {
function dictReleaseIterator (line 288) | static void dictReleaseIterator(dictIterator *iter) {
function _dictExpandIfNeeded (line 295) | static int _dictExpandIfNeeded(dict *ht) {
function _dictNextPower (line 306) | static unsigned long _dictNextPower(unsigned long size) {
function _dictKeyIndex (line 320) | static int _dictKeyIndex(dict *ht, const void *key) {
FILE: deps/hiredis/dict.h
type dictEntry (line 45) | typedef struct dictEntry {
type dictType (line 51) | typedef struct dictType {
type dict (line 60) | typedef struct dict {
type dictIterator (line 69) | typedef struct dictIterator {
FILE: deps/hiredis/example-ae.c
function getCallback (line 12) | void getCallback(redisAsyncContext *c, void *r, void *privdata) {
function connectCallback (line 21) | void connectCallback(const redisAsyncContext *c, int status) {
function disconnectCallback (line 29) | void disconnectCallback(const redisAsyncContext *c, int status) {
function main (line 37) | int main (int argc, char **argv) {
FILE: deps/hiredis/example-libev.c
function getCallback (line 9) | void getCallback(redisAsyncContext *c, void *r, void *privdata) {
function connectCallback (line 18) | void connectCallback(const redisAsyncContext *c, int status) {
function disconnectCallback (line 26) | void disconnectCallback(const redisAsyncContext *c, int status) {
function main (line 34) | int main (int argc, char **argv) {
FILE: deps/hiredis/example-libevent.c
function getCallback (line 9) | void getCallback(redisAsyncContext *c, void *r, void *privdata) {
function connectCallback (line 18) | void connectCallback(const redisAsyncContext *c, int status) {
function disconnectCallback (line 26) | void disconnectCallback(const redisAsyncContext *c, int status) {
function main (line 34) | int main (int argc, char **argv) {
FILE: deps/hiredis/example.c
function main (line 7) | int main(void) {
FILE: deps/hiredis/hiredis.c
function redisReply (line 61) | static redisReply *createReplyObject(int type) {
function freeReplyObject (line 72) | void freeReplyObject(void *reply) {
function __redisReaderSetError (line 186) | static void __redisReaderSetError(redisReader *r, int type, const char *...
function chrtos (line 212) | static size_t chrtos(char *buf, size_t size, char byte) {
function __redisReaderSetErrorProtocolByte (line 236) | static void __redisReaderSetErrorProtocolByte(redisReader *r, char byte) {
function __redisReaderSetErrorOOM (line 245) | static void __redisReaderSetErrorOOM(redisReader *r) {
function readLongLong (line 288) | static long long readLongLong(char *s) {
function moveToNextTask (line 330) | static void moveToNextTask(redisReader *r) {
function processLineItem (line 355) | static int processLineItem(redisReader *r) {
function processBulkItem (line 389) | static int processBulkItem(redisReader *r) {
function processMultiBulkItem (line 442) | static int processMultiBulkItem(redisReader *r) {
function processItem (line 507) | static int processItem(redisReader *r) {
function redisReader (line 556) | redisReader *redisReaderCreate(void) {
function redisReaderFree (line 577) | void redisReaderFree(redisReader *r) {
function redisReaderFeed (line 585) | int redisReaderFeed(redisReader *r, const char *buf, size_t len) {
function redisReaderGetReply (line 617) | int redisReaderGetReply(redisReader *r, void **reply) {
function intlen (line 668) | static int intlen(int i) {
function bulklen (line 682) | static size_t bulklen(size_t len) {
function redisvFormatCommand (line 686) | int redisvFormatCommand(char **target, const char *format, va_list ap) {
function redisFormatCommand (line 925) | int redisFormatCommand(char **target, const char *format, ...) {
function redisFormatCommandArgv (line 939) | int redisFormatCommandArgv(char **target, int argc, const char **argv, c...
function __redisSetError (line 973) | void __redisSetError(redisContext *c, int type, const char *str) {
function redisContext (line 989) | static redisContext *redisContextInit(void) {
function redisFree (line 1003) | void redisFree(redisContext *c) {
function redisContext (line 1016) | redisContext *redisConnect(const char *ip, int port) {
function redisContext (line 1023) | redisContext *redisConnectWithTimeout(const char *ip, int port, struct t...
function redisContext (line 1030) | redisContext *redisConnectNonBlock(const char *ip, int port) {
function redisContext (line 1037) | redisContext *redisConnectUnix(const char *path) {
function redisContext (line 1044) | redisContext *redisConnectUnixWithTimeout(const char *path, struct timev...
function redisContext (line 1051) | redisContext *redisConnectUnixNonBlock(const char *path) {
function redisSetTimeout (line 1059) | int redisSetTimeout(redisContext *c, struct timeval tv) {
function redisBufferRead (line 1070) | int redisBufferRead(redisContext *c) {
function redisBufferWrite (line 1107) | int redisBufferWrite(redisContext *c, int *done) {
function redisGetReplyFromReader (line 1138) | int redisGetReplyFromReader(redisContext *c, void **reply) {
function redisGetReply (line 1146) | int redisGetReply(redisContext *c, void **reply) {
function __redisAppendCommand (line 1183) | int __redisAppendCommand(redisContext *c, char *cmd, size_t len) {
function redisvAppendCommand (line 1196) | int redisvAppendCommand(redisContext *c, const char *format, va_list ap) {
function redisAppendCommand (line 1215) | int redisAppendCommand(redisContext *c, const char *format, ...) {
function redisAppendCommandArgv (line 1225) | int redisAppendCommandArgv(redisContext *c, int argc, const char **argv,...
FILE: deps/hiredis/hiredis.h
type redisReply (line 96) | typedef struct redisReply {
type redisReadTask (line 105) | typedef struct redisReadTask {
type redisReplyObjectFunctions (line 114) | typedef struct redisReplyObjectFunctions {
type redisReader (line 123) | typedef struct redisReader {
type redisContext (line 164) | typedef struct redisContext {
type timeval (line 174) | struct timeval
type timeval (line 177) | struct timeval
type timeval (line 179) | struct timeval
FILE: deps/hiredis/net.c
function __redisSetErrorFromErrno (line 57) | static void __redisSetErrorFromErrno(redisContext *c, int type, const ch...
function redisSetReuseAddr (line 67) | static int redisSetReuseAddr(redisContext *c, int fd) {
function redisCreateSocket (line 77) | static int redisCreateSocket(redisContext *c, int type) {
function redisSetBlocking (line 91) | static int redisSetBlocking(redisContext *c, int fd, int blocking) {
function redisSetTcpNoDelay (line 116) | static int redisSetTcpNoDelay(redisContext *c, int fd) {
function redisContextWaitReady (line 128) | static int redisContextWaitReady(redisContext *c, int fd, const struct t...
function redisCheckSocketError (line 175) | int redisCheckSocketError(redisContext *c, int fd) {
function redisContextSetTimeout (line 195) | int redisContextSetTimeout(redisContext *c, struct timeval tv) {
function redisContextConnectTcp (line 207) | int redisContextConnectTcp(redisContext *c, const char *addr, int port, ...
function redisContextConnectUnix (line 271) | int redisContextConnectUnix(redisContext *c, const char *path, struct ti...
FILE: deps/hiredis/net.h
type timeval (line 43) | struct timeval
type timeval (line 44) | struct timeval
type timeval (line 45) | struct timeval
FILE: deps/hiredis/sds.c
function sds (line 51) | sds sdsnewlen(const void *init, size_t initlen) {
function sds (line 70) | sds sdsempty(void) {
function sds (line 75) | sds sdsnew(const char *init) {
function sds (line 81) | sds sdsdup(const sds s) {
function sdsfree (line 86) | void sdsfree(sds s) {
function sdsupdatelen (line 105) | void sdsupdatelen(sds s) {
function sdsclear (line 116) | void sdsclear(sds s) {
function sds (line 129) | sds sdsMakeRoomFor(sds s, size_t addlen) {
function sds (line 155) | sds sdsRemoveFreeSpace(sds s) {
function sdsAllocSize (line 171) | size_t sdsAllocSize(sds s) {
function sdsIncrLen (line 200) | void sdsIncrLen(sds s, int incr) {
function sds (line 215) | sds sdsgrowzero(sds s, size_t len) {
function sds (line 237) | sds sdscatlen(sds s, const void *t, size_t len) {
function sds (line 255) | sds sdscat(sds s, const char *t) {
function sds (line 263) | sds sdscatsds(sds s, const sds t) {
function sds (line 269) | sds sdscpylen(sds s, const char *t, size_t len) {
function sds (line 288) | sds sdscpy(sds s, const char *t) {
function sds (line 293) | sds sdscatvprintf(sds s, const char *fmt, va_list ap) {
function sds (line 332) | sds sdscatprintf(sds s, const char *fmt, ...) {
function sds (line 355) | sds sdstrim(sds s, const char *cset) {
function sdsrange (line 388) | void sdsrange(sds s, int start, int end) {
function sdstolower (line 419) | void sdstolower(sds s) {
function sdstoupper (line 426) | void sdstoupper(sds s) {
function sdscmp (line 443) | int sdscmp(const sds s1, const sds s2) {
function sds (line 471) | sds *sdssplitlen(const char *s, int len, const char *sep, int seplen, in...
function sdsfreesplitres (line 521) | void sdsfreesplitres(sds *tokens, int count) {
function sds (line 532) | sds sdsfromlonglong(long long value) {
function sds (line 553) | sds sdscatrepr(sds s, const char *p, size_t len) {
function is_hex_digit (line 580) | int is_hex_digit(char c) {
function hex_digit_to_int (line 587) | int hex_digit_to_int(char c) {
function sds (line 628) | sds *sdssplitargs(const char *line, int *argc) {
function sds (line 747) | sds sdsmapchars(sds s, const char *from, const char *to, size_t setlen) {
function sds (line 763) | sds sdsjoin(char **argv, int argc, char *sep) {
function main (line 778) | int main(void) {
FILE: deps/hiredis/sds.h
type sdshdr (line 41) | struct sdshdr {
function sdslen (line 47) | static inline size_t sdslen(const sds s) {
function sdsavail (line 52) | static inline size_t sdsavail(const sds s) {
FILE: deps/hiredis/test.c
type connection_type (line 14) | enum connection_type {
type config (line 19) | struct config {
function usec (line 37) | static long long usec(void) {
function redisContext (line 43) | static redisContext *select_database(redisContext *c) {
function disconnect (line 65) | static void disconnect(redisContext *c) {
function redisContext (line 80) | static redisContext *connect(struct config config) {
function test_format_commands (line 99) | static void test_format_commands(void) {
function test_reply_reader (line 203) | static void test_reply_reader(void) {
function test_blocking_connection_errors (line 280) | static void test_blocking_connection_errors(void) {
function test_blocking_connection (line 302) | static void test_blocking_connection(struct config config) {
function test_blocking_io_errors (line 380) | static void test_blocking_io_errors(struct config config) {
function test_throughput (line 431) | static void test_throughput(struct config config) {
function main (line 595) | int main(int argc, char **argv) {
FILE: deps/jemalloc/include/jemalloc/internal/arena.h
type arena_chunk_map_t (line 46) | typedef struct arena_chunk_map_s arena_chunk_map_t;
type arena_chunk_t (line 47) | typedef struct arena_chunk_s arena_chunk_t;
type arena_run_t (line 48) | typedef struct arena_run_s arena_run_t;
type arena_bin_info_t (line 49) | typedef struct arena_bin_info_s arena_bin_info_t;
type arena_bin_t (line 50) | typedef struct arena_bin_s arena_bin_t;
type arena_t (line 51) | typedef struct arena_s arena_t;
type arena_chunk_map_s (line 58) | struct arena_chunk_map_s {
type arena_avail_tree_t (line 159) | typedef rb_tree(arena_chunk_map_t) arena_avail_tree_t;
type arena_run_tree_t (line 160) | typedef rb_tree(arena_chunk_map_t) arena_run_tree_t;
type arena_chunk_s (line 163) | struct arena_chunk_s {
type arena_chunk_tree_t (line 192) | typedef rb_tree(arena_chunk_t) arena_chunk_tree_t;
type arena_run_s (line 194) | struct arena_run_s {
type arena_bin_info_s (line 243) | struct arena_bin_info_s {
type arena_bin_s (line 281) | struct arena_bin_s {
type arena_s (line 309) | struct arena_s {
function JEMALLOC_INLINE (line 481) | JEMALLOC_INLINE arena_chunk_map_t *
function JEMALLOC_INLINE (line 491) | JEMALLOC_INLINE size_t *
function JEMALLOC_INLINE (line 498) | JEMALLOC_INLINE size_t
function JEMALLOC_INLINE (line 505) | JEMALLOC_INLINE size_t
function JEMALLOC_INLINE (line 515) | JEMALLOC_INLINE size_t
function JEMALLOC_INLINE (line 526) | JEMALLOC_INLINE size_t
function JEMALLOC_INLINE (line 537) | JEMALLOC_INLINE size_t
function JEMALLOC_INLINE (line 549) | JEMALLOC_INLINE size_t
function JEMALLOC_INLINE (line 558) | JEMALLOC_INLINE size_t
function JEMALLOC_INLINE (line 567) | JEMALLOC_INLINE size_t
function JEMALLOC_INLINE (line 576) | JEMALLOC_INLINE size_t
function JEMALLOC_INLINE (line 585) | JEMALLOC_INLINE void
function JEMALLOC_INLINE (line 598) | JEMALLOC_INLINE void
function JEMALLOC_INLINE (line 610) | JEMALLOC_INLINE void
function JEMALLOC_INLINE (line 625) | JEMALLOC_INLINE void
function JEMALLOC_INLINE (line 638) | JEMALLOC_INLINE void
function JEMALLOC_INLINE (line 654) | JEMALLOC_INLINE void
function JEMALLOC_INLINE (line 664) | JEMALLOC_INLINE size_t
function JEMALLOC_INLINE (line 706) | JEMALLOC_INLINE size_t
function arena_run_regind (line 714) | JEMALLOC_INLINE unsigned
function JEMALLOC_INLINE (line 786) | JEMALLOC_INLINE prof_ctx_t *
function JEMALLOC_INLINE (line 824) | JEMALLOC_INLINE void
function JEMALLOC_INLINE (line 859) | JEMALLOC_INLINE void *
function JEMALLOC_INLINE (line 890) | JEMALLOC_INLINE size_t
function JEMALLOC_INLINE (line 936) | JEMALLOC_INLINE void
FILE: deps/jemalloc/include/jemalloc/internal/atomic.h
function JEMALLOC_INLINE (line 37) | JEMALLOC_INLINE uint64_t
function JEMALLOC_INLINE (line 44) | JEMALLOC_INLINE uint64_t
function JEMALLOC_INLINE (line 51) | JEMALLOC_INLINE uint64_t
function JEMALLOC_INLINE (line 58) | JEMALLOC_INLINE uint64_t
function JEMALLOC_INLINE (line 65) | JEMALLOC_INLINE uint64_t
function JEMALLOC_INLINE (line 72) | JEMALLOC_INLINE uint64_t
function JEMALLOC_INLINE (line 79) | JEMALLOC_INLINE uint64_t
function JEMALLOC_INLINE (line 92) | JEMALLOC_INLINE uint64_t
function JEMALLOC_INLINE (line 106) | JEMALLOC_INLINE uint64_t
function JEMALLOC_INLINE (line 119) | JEMALLOC_INLINE uint64_t
function JEMALLOC_INLINE (line 128) | JEMALLOC_INLINE uint64_t
function JEMALLOC_INLINE (line 135) | JEMALLOC_INLINE uint64_t
function JEMALLOC_INLINE (line 149) | JEMALLOC_INLINE uint32_t
function JEMALLOC_INLINE (line 156) | JEMALLOC_INLINE uint32_t
function JEMALLOC_INLINE (line 163) | JEMALLOC_INLINE uint32_t
function JEMALLOC_INLINE (line 170) | JEMALLOC_INLINE uint32_t
function JEMALLOC_INLINE (line 177) | JEMALLOC_INLINE uint32_t
function JEMALLOC_INLINE (line 184) | JEMALLOC_INLINE uint32_t
function JEMALLOC_INLINE (line 191) | JEMALLOC_INLINE uint32_t
function JEMALLOC_INLINE (line 204) | JEMALLOC_INLINE uint32_t
function JEMALLOC_INLINE (line 218) | JEMALLOC_INLINE uint32_t
function JEMALLOC_INLINE (line 225) | JEMALLOC_INLINE uint32_t
function JEMALLOC_INLINE (line 232) | JEMALLOC_INLINE uint32_t
function JEMALLOC_INLINE (line 239) | JEMALLOC_INLINE uint32_t
function JEMALLOC_INLINE (line 251) | JEMALLOC_INLINE size_t
function JEMALLOC_INLINE (line 262) | JEMALLOC_INLINE size_t
function atomic_add_u (line 277) | JEMALLOC_INLINE unsigned
function atomic_sub_u (line 288) | JEMALLOC_INLINE unsigned
FILE: deps/jemalloc/include/jemalloc/internal/bitmap.h
type bitmap_level_t (line 7) | typedef struct bitmap_level_s bitmap_level_t;
type bitmap_info_t (line 8) | typedef struct bitmap_info_s bitmap_info_t;
type bitmap_t (line 9) | typedef unsigned long bitmap_t;
type bitmap_level_s (line 26) | struct bitmap_level_s {
type bitmap_info_s (line 31) | struct bitmap_info_s {
function JEMALLOC_INLINE (line 67) | JEMALLOC_INLINE bool
function JEMALLOC_INLINE (line 76) | JEMALLOC_INLINE bool
function JEMALLOC_INLINE (line 88) | JEMALLOC_INLINE void
function JEMALLOC_INLINE (line 122) | JEMALLOC_INLINE size_t
function JEMALLOC_INLINE (line 144) | JEMALLOC_INLINE void
FILE: deps/jemalloc/include/jemalloc/internal/chunk_dss.h
type dss_prec_t (line 4) | typedef enum {
FILE: deps/jemalloc/include/jemalloc/internal/ckh.h
type ckh_t (line 4) | typedef struct ckh_s ckh_t;
type ckhc_t (line 5) | typedef struct ckhc_s ckhc_t;
type ckhc_s (line 27) | struct ckhc_s {
type ckh_s (line 32) | struct ckh_s {
FILE: deps/jemalloc/include/jemalloc/internal/ctl.h
type ctl_node_t (line 4) | typedef struct ctl_node_s ctl_node_t;
type ctl_named_node_t (line 5) | typedef struct ctl_named_node_s ctl_named_node_t;
type ctl_indexed_node_t (line 6) | typedef struct ctl_indexed_node_s ctl_indexed_node_t;
type ctl_arena_stats_t (line 7) | typedef struct ctl_arena_stats_s ctl_arena_stats_t;
type ctl_stats_t (line 8) | typedef struct ctl_stats_s ctl_stats_t;
type ctl_node_s (line 14) | struct ctl_node_s {
type ctl_named_node_s (line 18) | struct ctl_named_node_s {
type ctl_indexed_node_s (line 28) | struct ctl_indexed_node_s {
type ctl_arena_stats_s (line 33) | struct ctl_arena_stats_s {
type ctl_stats_s (line 51) | struct ctl_stats_s {
FILE: deps/jemalloc/include/jemalloc/internal/extent.h
type extent_node_t (line 4) | typedef struct extent_node_s extent_node_t;
type extent_node_s (line 11) | struct extent_node_s {
type extent_tree_t (line 30) | typedef rb_tree(extent_node_t) extent_tree_t;
FILE: deps/jemalloc/include/jemalloc/internal/hash.h
function JEMALLOC_INLINE (line 26) | JEMALLOC_INLINE uint64_t
FILE: deps/jemalloc/include/jemalloc/internal/mb.h
function JEMALLOC_INLINE (line 31) | JEMALLOC_INLINE void
function JEMALLOC_INLINE (line 58) | JEMALLOC_INLINE void
function JEMALLOC_INLINE (line 69) | JEMALLOC_INLINE void
function JEMALLOC_INLINE (line 80) | JEMALLOC_INLINE void
function JEMALLOC_INLINE (line 91) | JEMALLOC_INLINE void
function JEMALLOC_INLINE (line 102) | JEMALLOC_INLINE void
FILE: deps/jemalloc/include/jemalloc/internal/mutex.h
type malloc_mutex_t (line 4) | typedef struct malloc_mutex_s malloc_mutex_t;
type malloc_mutex_s (line 27) | struct malloc_mutex_s {
function JEMALLOC_INLINE (line 67) | JEMALLOC_INLINE void
function JEMALLOC_INLINE (line 82) | JEMALLOC_INLINE void
FILE: deps/jemalloc/include/jemalloc/internal/prof.h
type prof_bt_t (line 4) | typedef struct prof_bt_s prof_bt_t;
type prof_cnt_t (line 5) | typedef struct prof_cnt_s prof_cnt_t;
type prof_thr_cnt_t (line 6) | typedef struct prof_thr_cnt_s prof_thr_cnt_t;
type prof_ctx_t (line 7) | typedef struct prof_ctx_s prof_ctx_t;
type prof_tdata_t (line 8) | typedef struct prof_tdata_s prof_tdata_t;
type prof_bt_s (line 52) | struct prof_bt_s {
type prof_unwind_data_t (line 60) | typedef struct {
type prof_cnt_s (line 67) | struct prof_cnt_s {
type prof_thr_cnt_s (line 83) | struct prof_thr_cnt_s {
type prof_ctx_s (line 120) | struct prof_ctx_s {
type prof_tdata_s (line 150) | struct prof_tdata_s {
function JEMALLOC_INLINE (line 356) | JEMALLOC_INLINE prof_ctx_t *
function JEMALLOC_INLINE (line 375) | JEMALLOC_INLINE void
function JEMALLOC_INLINE (line 391) | JEMALLOC_INLINE bool
function JEMALLOC_INLINE (line 420) | JEMALLOC_INLINE void
function JEMALLOC_INLINE (line 465) | JEMALLOC_INLINE void
function JEMALLOC_INLINE (line 540) | JEMALLOC_INLINE void
FILE: deps/jemalloc/include/jemalloc/internal/rtree.h
type rtree_t (line 11) | typedef struct rtree_s rtree_t;
type rtree_s (line 27) | struct rtree_s {
function JEMALLOC_INLINE (line 125) | JEMALLOC_INLINE bool
FILE: deps/jemalloc/include/jemalloc/internal/stats.h
type tcache_bin_stats_t (line 4) | typedef struct tcache_bin_stats_s tcache_bin_stats_t;
type malloc_bin_stats_t (line 5) | typedef struct malloc_bin_stats_s malloc_bin_stats_t;
type malloc_large_stats_t (line 6) | typedef struct malloc_large_stats_s malloc_large_stats_t;
type arena_stats_t (line 7) | typedef struct arena_stats_s arena_stats_t;
type chunk_stats_t (line 8) | typedef struct chunk_stats_s chunk_stats_t;
type tcache_bin_stats_s (line 14) | struct tcache_bin_stats_s {
type malloc_bin_stats_s (line 22) | struct malloc_bin_stats_s {
type malloc_large_stats_s (line 64) | struct malloc_large_stats_s {
type arena_stats_s (line 85) | struct arena_stats_s {
type chunk_stats_s (line 113) | struct chunk_stats_s {
function JEMALLOC_INLINE (line 150) | JEMALLOC_INLINE size_t
function JEMALLOC_INLINE (line 157) | JEMALLOC_INLINE void
function JEMALLOC_INLINE (line 164) | JEMALLOC_INLINE void
FILE: deps/jemalloc/include/jemalloc/internal/tcache.h
type tcache_bin_info_t (line 4) | typedef struct tcache_bin_info_s tcache_bin_info_t;
type tcache_bin_t (line 5) | typedef struct tcache_bin_s tcache_bin_t;
type tcache_t (line 6) | typedef struct tcache_s tcache_t;
type tcache_enabled_t (line 48) | typedef enum {
type tcache_bin_info_s (line 58) | struct tcache_bin_info_s {
type tcache_bin_s (line 62) | struct tcache_bin_s {
type tcache_s (line 70) | struct tcache_s {
function JEMALLOC_INLINE (line 165) | JEMALLOC_INLINE bool
function JEMALLOC_INLINE (line 181) | JEMALLOC_INLINE void
function JEMALLOC_INLINE (line 209) | JEMALLOC_INLINE tcache_t *
function JEMALLOC_INLINE (line 261) | JEMALLOC_INLINE void
function JEMALLOC_INLINE (line 274) | JEMALLOC_INLINE void *
function JEMALLOC_INLINE (line 290) | JEMALLOC_INLINE void *
function JEMALLOC_INLINE (line 333) | JEMALLOC_INLINE void *
function JEMALLOC_INLINE (line 385) | JEMALLOC_INLINE void
function JEMALLOC_INLINE (line 409) | JEMALLOC_INLINE void
FILE: deps/jemalloc/include/jemalloc/internal/tsd.h
function a_attr (line 138) | a_attr a_type * \
function a_attr (line 145) | a_attr void \
function a_attr (line 170) | a_attr a_type * \
function a_attr (line 177) | a_attr void \
function a_attr (line 202) | a_attr bool \
function a_attr (line 225) | a_attr bool \
FILE: deps/jemalloc/include/jemalloc/internal/util.h
function JEMALLOC_INLINE (line 117) | JEMALLOC_INLINE size_t
function JEMALLOC_INLINE (line 135) | JEMALLOC_INLINE void
function JEMALLOC_INLINE (line 147) | JEMALLOC_INLINE int
FILE: deps/jemalloc/include/msvc_compat/inttypes.h
type imaxdiv_t (line 47) | typedef struct {
function _inline (line 284) | static
FILE: deps/jemalloc/include/msvc_compat/stdbool.h
type BOOL (line 8) | typedef BOOL _Bool;
FILE: deps/jemalloc/include/msvc_compat/stdint.h
type int_least8_t (line 94) | typedef int8_t int_least8_t;
type int_least16_t (line 95) | typedef int16_t int_least16_t;
type int_least32_t (line 96) | typedef int32_t int_least32_t;
type int_least64_t (line 97) | typedef int64_t int_least64_t;
type uint_least8_t (line 98) | typedef uint8_t uint_least8_t;
type uint_least16_t (line 99) | typedef uint16_t uint_least16_t;
type uint_least32_t (line 100) | typedef uint32_t uint_least32_t;
type uint_least64_t (line 101) | typedef uint64_t uint_least64_t;
type int_fast8_t (line 104) | typedef int8_t int_fast8_t;
type int_fast16_t (line 105) | typedef int16_t int_fast16_t;
type int_fast32_t (line 106) | typedef int32_t int_fast32_t;
type int_fast64_t (line 107) | typedef int64_t int_fast64_t;
type uint_fast8_t (line 108) | typedef uint8_t uint_fast8_t;
type uint_fast16_t (line 109) | typedef uint16_t uint_fast16_t;
type uint_fast32_t (line 110) | typedef uint32_t uint_fast32_t;
type uint_fast64_t (line 111) | typedef uint64_t uint_fast64_t;
type intmax_t (line 123) | typedef int64_t intmax_t;
type uintmax_t (line 124) | typedef uint64_t uintmax_t;
FILE: deps/jemalloc/include/msvc_compat/strings.h
function ffsl (line 8) | static __forceinline int ffsl(long x)
function ffs (line 17) | static __forceinline int ffs(int x)
FILE: deps/jemalloc/src/arena.c
function arena_run_comp (line 90) | static inline int
function arena_avail_adjac_succ (line 223) | static inline bool
function arena_avail_adjac (line 239) | static inline bool
function arena_avail_insert (line 247) | static void
function arena_avail_remove (line 280) | static void
function arena_run_reg_dalloc (line 335) | static inline void
function arena_chunk_validate_zeroed (line 361) | static inline void
function arena_run_split (line 371) | static void
function arena_chunk_t (line 513) | static arena_chunk_t *
function arena_chunk_dealloc (line 588) | static void
function arena_run_t (line 620) | static arena_run_t *
function arena_run_t (line 644) | static arena_run_t *
function arena_maybe_purge (line 679) | static inline void
function arena_chunk_purge (line 702) | static inline size_t
function arena_chunk_t (line 850) | static arena_chunk_t *
function arena_purge (line 860) | static void
function arena_purge_all (line 951) | void
function arena_run_dalloc (line 960) | static void
function arena_run_trim_head (line 1096) | static void
function arena_run_trim_tail (line 1128) | static void
function arena_run_t (line 1161) | static arena_run_t *
function arena_bin_runs_insert (line 1182) | static void
function arena_bin_runs_remove (line 1194) | static void
function arena_run_t (line 1206) | static arena_run_t *
function arena_run_t (line 1218) | static arena_run_t *
function arena_prof_accum (line 1324) | void
function arena_tcache_fill_small (line 1339) | void
function arena_alloc_junk_small (line 1383) | void
function arena_dalloc_junk_small (line 1399) | void
function arena_prof_promoted (line 1580) | void
function arena_dissociate_bin_run (line 1603) | static void
function arena_dalloc_bin_run (line 1626) | static void
function arena_bin_lower_run (line 1677) | static void
function arena_dalloc_bin_locked (line 1698) | void
function arena_dalloc_bin (line 1733) | void
function arena_dalloc_small (line 1748) | void
function arena_dalloc_large_locked (line 1763) | void
function arena_dalloc_large (line 1784) | void
function arena_ralloc_large_shrink (line 1793) | static void
function arena_ralloc_large_grow (line 1823) | static bool
function arena_ralloc_large (line 1893) | static bool
function dss_prec_t (line 2029) | dss_prec_t
function arena_dss_prec_set (line 2040) | void
function arena_stats_merge (line 2049) | void
function arena_new (line 2097) | bool
function bin_info_run_size_calc (line 2162) | static size_t
function bin_info_init (line 2301) | static void
function arena_boot (line 2316) | void
function arena_prefork (line 2348) | void
function arena_postfork_parent (line 2358) | void
function arena_postfork_child (line 2368) | void
FILE: deps/jemalloc/src/base.c
function base_pages_alloc (line 26) | static bool
function extent_node_t (line 81) | extent_node_t *
function base_node_dealloc (line 99) | void
function base_boot (line 109) | bool
function base_prefork (line 120) | void
function base_postfork_parent (line 127) | void
function base_postfork_child (line 134) | void
FILE: deps/jemalloc/src/bitmap.c
function bits2groups (line 11) | static size_t
function bitmap_info_init (line 19) | void
function bitmap_info_ngroups (line 47) | size_t
function bitmap_size (line 54) | size_t
function bitmap_init (line 63) | void
FILE: deps/jemalloc/src/chunk.c
function chunk_record (line 209) | static void
function chunk_unmap (line 286) | void
function chunk_dealloc (line 300) | void
function chunk_boot (line 322) | bool
function chunk_prefork (line 353) | void
function chunk_postfork_parent (line 363) | void
function chunk_postfork_child (line 373) | void
FILE: deps/jemalloc/src/chunk_dss.c
function dss_prec_t (line 42) | dss_prec_t
function chunk_dss_prec_set (line 55) | bool
function chunk_in_dss (line 140) | bool
function chunk_dss_boot (line 158) | bool
function chunk_dss_prefork (line 173) | void
function chunk_dss_postfork_parent (line 181) | void
function chunk_dss_postfork_child (line 189) | void
FILE: deps/jemalloc/src/chunk_mmap.c
function pages_purge (line 116) | bool
function chunk_dealloc_mmap (line 202) | bool
FILE: deps/jemalloc/src/ckh.c
function JEMALLOC_INLINE (line 52) | JEMALLOC_INLINE size_t
function JEMALLOC_INLINE (line 70) | JEMALLOC_INLINE size_t
function JEMALLOC_INLINE (line 91) | JEMALLOC_INLINE bool
function JEMALLOC_INLINE (line 123) | JEMALLOC_INLINE bool
function JEMALLOC_INLINE (line 192) | JEMALLOC_INLINE bool
function JEMALLOC_INLINE (line 221) | JEMALLOC_INLINE bool
function ckh_grow (line 244) | static bool
function ckh_shrink (line 299) | static void
function ckh_new (line 346) | bool
function ckh_delete (line 401) | void
function ckh_count (line 425) | size_t
function ckh_iter (line 434) | bool
function ckh_insert (line 454) | bool
function ckh_remove (line 478) | bool
function ckh_search (line 509) | bool
function ckh_string_hash (line 528) | void
function ckh_string_keycomp (line 556) | bool
function ckh_pointer_hash (line 566) | void
function ckh_pointer_keycomp (line 604) | bool
FILE: deps/jemalloc/src/ctl.c
function ctl_named_node_t (line 20) | static inline const ctl_named_node_t *
function ctl_named_node_t (line 27) | static inline const ctl_named_node_t *
function ctl_indexed_node_t (line 35) | static inline const ctl_indexed_node_t *
function CTL_PROTO (line 67) | CTL_PROTO(version)
function arena_i_purge_ctl (line 1300) | static int
function arena_i_dss_ctl (line 1317) | static int
function ctl_named_node_t (line 1368) | static const ctl_named_node_t *
function ctl_named_node_t (line 1391) | static const ctl_named_node_t *
function ctl_named_node_t (line 1401) | static const ctl_named_node_t *
function arenas_narenas_ctl (line 1410) | static int
function arenas_initialized_ctl (line 1432) | static int
function arenas_purge_ctl (line 1465) | static int
function arenas_extend_ctl (line 1490) | static int
function prof_active_ctl (line 1512) | static int
function prof_dump_ctl (line 1541) | static int
function ctl_named_node_t (line 1611) | static const ctl_named_node_t *
function ctl_named_node_t (line 1629) | static const ctl_named_node_t *
FILE: deps/jemalloc/src/extent.c
function extent_szad_comp (line 6) | static inline int
function extent_ad_comp (line 25) | rb_gen(, extent_tree_szad_, extent_tree_t, extent_node_t, link_szad,
FILE: deps/jemalloc/src/huge.c
function huge_dalloc (line 189) | void
function huge_salloc (line 219) | size_t
function prof_ctx_t (line 239) | prof_ctx_t *
function huge_prof_ctx_set (line 259) | void
function huge_boot (line 276) | bool
function huge_prefork (line 294) | void
function huge_postfork_parent (line 301) | void
function huge_postfork_child (line 308) | void
FILE: deps/jemalloc/src/jemalloc.c
function malloc_tsd_data (line 7) | malloc_tsd_data(, arenas, arena_t *, NULL)
type malloc_utrace_t (line 77) | typedef struct {
function arena_t (line 117) | arena_t *
function arena_t (line 143) | arena_t *
function stats_print_atexit (line 203) | static void
function malloc_ncpus (line 247) | static unsigned
function arenas_cleanup (line 270) | void
function malloc_init (line 280) | static inline bool
function malloc_conf_next (line 290) | static bool
function malloc_conf_error (line 366) | static void
function malloc_conf_init (line 375) | static void
function malloc_init_hard (line 636) | static bool
function imemalign (line 891) | static int
function je_posix_memalign (line 977) | int
function je_free (line 1223) | void
function je_malloc_usable_size (line 1311) | size_t
function je_malloc_stats_print (line 1326) | void
function je_mallctl (line 1334) | int
function je_mallctlnametomib (line 1345) | int
function je_mallctlbymib (line 1355) | int
function JEMALLOC_INLINE (line 1375) | JEMALLOC_INLINE void *
function je_allocm (line 1391) | int
function je_rallocm (line 1471) | int
function je_sallocm (line 1599) | int
function je_dallocm (line 1618) | int
function je_nallocm (line 1654) | int
function jemalloc_constructor (line 1698) | JEMALLOC_ATTR(constructor)
function jemalloc_prefork (line 1707) | void
function jemalloc_postfork_parent (line 1736) | void
function jemalloc_postfork_child (line 1764) | void
function a0free (line 1821) | void
FILE: deps/jemalloc/src/mutex.c
function pthread_create_once (line 37) | static void
function JEMALLOC_EXPORT (line 51) | JEMALLOC_EXPORT int
function malloc_mutex_init (line 71) | bool
function malloc_mutex_prefork (line 105) | void
function malloc_mutex_postfork_parent (line 112) | void
function malloc_mutex_postfork_child (line 119) | void
function mutex_boot (line 135) | bool
FILE: deps/jemalloc/src/prof.c
type _Unwind_Context (line 74) | struct _Unwind_Context
type _Unwind_Context (line 76) | struct _Unwind_Context
function bt_init (line 100) | void
function bt_destroy (line 110) | static void
function prof_bt_t (line 119) | static prof_bt_t *
function prof_enter (line 145) | static inline void
function prof_leave (line 157) | static inline void
function prof_backtrace (line 180) | void
function _Unwind_Reason_Code (line 215) | static _Unwind_Reason_Code
function _Unwind_Reason_Code (line 224) | static _Unwind_Reason_Code
function prof_backtrace (line 243) | void
function prof_backtrace (line 253) | void
function prof_backtrace (line 422) | void
function prof_thr_cnt_t (line 431) | prof_thr_cnt_t *
function prof_flush (line 555) | static bool
function prof_write (line 578) | static bool
function prof_printf (line 609) | static bool
function prof_ctx_sum (line 624) | static void
function prof_ctx_destroy (line 674) | static void
function prof_ctx_merge (line 716) | static void
function prof_dump_ctx (line 754) | static bool
function prof_dump_maps (line 795) | static bool
function prof_dump (line 830) | static bool
function prof_dump_filename (line 922) | static void
function prof_fdump (line 942) | static void
function prof_idump (line 960) | void
function prof_mdump (line 991) | bool
function prof_gdump (line 1014) | void
function prof_bt_hash (line 1045) | static void
function prof_bt_keycomp (line 1076) | static bool
function malloc_mutex_t (line 1089) | static malloc_mutex_t *
function prof_tdata_t (line 1097) | prof_tdata_t *
function prof_tdata_cleanup (line 1136) | void
function prof_boot0 (line 1181) | void
function prof_boot1 (line 1191) | void
function prof_boot2 (line 1221) | bool
function prof_prefork (line 1273) | void
function prof_postfork_parent (line 1287) | void
function prof_postfork_child (line 1301) | void
FILE: deps/jemalloc/src/quarantine.c
type quarantine_obj_t (line 14) | typedef struct quarantine_obj_s quarantine_obj_t;
type quarantine_t (line 15) | typedef struct quarantine_s quarantine_t;
type quarantine_obj_s (line 17) | struct quarantine_obj_s {
type quarantine_s (line 22) | struct quarantine_s {
function quarantine_t (line 46) | static quarantine_t *
function quarantine_t (line 65) | static quarantine_t *
function quarantine_drain (line 96) | static void
function quarantine (line 111) | void
function quarantine_cleanup (line 172) | static void
function quarantine_boot (line 200) | bool
FILE: deps/jemalloc/src/rtree.c
function rtree_t (line 4) | rtree_t *
function rtree_prefork (line 48) | void
function rtree_postfork_parent (line 55) | void
function rtree_postfork_child (line 62) | void
FILE: deps/jemalloc/src/stats.c
function stats_arena_bins_print (line 56) | static void
function stats_arena_lruns_print (line 158) | static void
function stats_arena_print (line 204) | static void
function stats_print (line 268) | void
FILE: deps/jemalloc/src/tcache.c
function tcache_salloc (line 21) | size_t tcache_salloc(const void *ptr)
function tcache_event_hard (line 27) | void
function tcache_bin_flush_small (line 81) | void
function tcache_bin_flush_large (line 163) | void
function tcache_arena_associate (line 237) | void
function tcache_arena_dissociate (line 251) | void
function tcache_t (line 264) | tcache_t *
function tcache_destroy (line 311) | void
function tcache_thread_cleanup (line 370) | void
function tcache_stats_merge (line 400) | void
function tcache_boot0 (line 424) | bool
function tcache_boot1 (line 466) | bool
FILE: deps/jemalloc/src/tsd.c
function malloc_tsd_dalloc (line 20) | void
function malloc_tsd_no_cleanup (line 27) | void
function _malloc_thread_cleanup (line 38) | void
function malloc_tsd_cleanup_register (line 60) | void
function malloc_tsd_boot (line 69) | void
function BOOL (line 77) | static BOOL WINAPI
FILE: deps/jemalloc/src/util.c
function wrtmessage (line 43) | static void
function malloc_write (line 65) | void
function buferror (line 79) | int
function uintmax_t (line 99) | uintmax_t
function malloc_vsnprintf (line 297) | int
function malloc_cprintf (line 620) | void
function malloc_printf (line 633) | void
FILE: deps/jemalloc/src/zone.c
type malloc_introspection_t (line 17) | struct malloc_introspection_t
function zone_size (line 46) | static size_t
function zone_free (line 86) | static void
function zone_free_definite_size (line 121) | static void
function zone_good_size (line 144) | static size_t
function zone_force_lock (line 153) | static void
function zone_force_unlock (line 161) | static void
function register_zone (line 169) | JEMALLOC_ATTR(constructor)
FILE: deps/jemalloc/test/ALLOCM_ARENA.c
function main (line 48) | int
FILE: deps/jemalloc/test/aligned_alloc.c
function main (line 9) | int
FILE: deps/jemalloc/test/allocated.c
function main (line 96) | int
FILE: deps/jemalloc/test/allocm.c
function main (line 9) | int
FILE: deps/jemalloc/test/bitmap.c
function test_bitmap_size (line 10) | static void
function test_bitmap_init (line 23) | static void
function test_bitmap_set (line 45) | static void
function test_bitmap_unset (line 67) | static void
function test_bitmap_sfu (line 94) | static void
function main (line 140) | int
FILE: deps/jemalloc/test/mremap.c
function main (line 4) | int
FILE: deps/jemalloc/test/posix_memalign.c
function main (line 9) | int
FILE: deps/jemalloc/test/rallocm.c
function main (line 4) | int
FILE: deps/jemalloc/test/thread_arena.c
function main (line 41) | int
FILE: deps/jemalloc/test/thread_tcache_enabled.c
function main (line 69) | int
FILE: deps/linenoise/example.c
function completion (line 6) | void completion(const char *buf, linenoiseCompletions *lc) {
function main (line 13) | int main(void) {
FILE: deps/linenoise/linenoise.c
type termios (line 115) | struct termios
type linenoiseState (line 126) | struct linenoiseState {
type KEY_ACTION (line 141) | enum KEY_ACTION{
type linenoiseState (line 165) | struct linenoiseState
function linenoiseSetMultiLine (line 189) | void linenoiseSetMultiLine(int ml) {
function isUnsupportedTerm (line 195) | static int isUnsupportedTerm(void) {
function enableRawMode (line 206) | static int enableRawMode(int fd) {
function disableRawMode (line 241) | static void disableRawMode(int fd) {
function getCursorPosition (line 250) | static int getCursorPosition(int ifd, int ofd) {
function getColumns (line 274) | static int getColumns(int ifd, int ofd) {
function linenoiseClearScreen (line 308) | void linenoiseClearScreen(void) {
function linenoiseBeep (line 316) | static void linenoiseBeep(void) {
function freeCompletions (line 324) | static void freeCompletions(linenoiseCompletions *lc) {
function completeLine (line 338) | static int completeLine(struct linenoiseState *ls) {
function linenoiseSetCompletionCallback (line 397) | void linenoiseSetCompletionCallback(linenoiseCompletionCallback *fn) {
function linenoiseAddCompletion (line 405) | void linenoiseAddCompletion(linenoiseCompletions *lc, const char *str) {
type abuf (line 427) | struct abuf {
function abInit (line 432) | static void abInit(struct abuf *ab) {
function abAppend (line 437) | static void abAppend(struct abuf *ab, const char *s, int len) {
function abFree (line 446) | static void abFree(struct abuf *ab) {
function refreshSingleLine (line 454) | static void refreshSingleLine(struct linenoiseState *l) {
function refreshMultiLine (line 493) | static void refreshMultiLine(struct linenoiseState *l) {
function refreshLine (line 570) | static void refreshLine(struct linenoiseState *l) {
function linenoiseEditInsert (line 580) | int linenoiseEditInsert(struct linenoiseState *l, char c) {
function linenoiseEditMoveLeft (line 607) | void linenoiseEditMoveLeft(struct linenoiseState *l) {
function linenoiseEditMoveRight (line 615) | void linenoiseEditMoveRight(struct linenoiseState *l) {
function linenoiseEditMoveHome (line 623) | void linenoiseEditMoveHome(struct linenoiseState *l) {
function linenoiseEditMoveEnd (line 631) | void linenoiseEditMoveEnd(struct linenoiseState *l) {
function linenoiseEditHistoryNext (line 642) | void linenoiseEditHistoryNext(struct linenoiseState *l, int dir) {
function linenoiseEditDelete (line 666) | void linenoiseEditDelete(struct linenoiseState *l) {
function linenoiseEditBackspace (line 676) | void linenoiseEditBackspace(struct linenoiseState *l) {
function linenoiseEditDeletePrevWord (line 688) | void linenoiseEditDeletePrevWord(struct linenoiseState *l) {
function linenoiseEdit (line 710) | static int linenoiseEdit(int stdin_fd, int stdout_fd, char *buf, size_t ...
function linenoisePrintKeyCodes (line 888) | void linenoisePrintKeyCodes(void) {
function linenoiseRaw (line 915) | static int linenoiseRaw(char *buf, size_t buflen, const char *prompt) {
function freeHistory (line 972) | static void freeHistory(void) {
function linenoiseAtExit (line 983) | static void linenoiseAtExit(void) {
function linenoiseHistoryAdd (line 995) | int linenoiseHistoryAdd(const char *line) {
function linenoiseHistorySetMaxLen (line 1028) | int linenoiseHistorySetMaxLen(int len) {
function linenoiseHistorySave (line 1058) | int linenoiseHistorySave(const char *filename) {
function linenoiseHistoryLoad (line 1074) | int linenoiseHistoryLoad(const char *filename) {
FILE: deps/linenoise/linenoise.h
type linenoiseCompletions (line 44) | typedef struct linenoiseCompletions {
FILE: deps/lua/etc/min.c
function print (line 12) | static int print(lua_State *L)
function main (line 32) | int main(void)
FILE: deps/lua/etc/noparser.c
function LUAI_FUNC (line 21) | LUAI_FUNC void luaX_init (lua_State *L) {
function LUAI_FUNC (line 25) | LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const...
function LUAI_FUNC (line 37) | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, voi...
FILE: deps/lua/src/lapi.c
function TValue (line 49) | static TValue *index2adr (lua_State *L, int idx) {
function Table (line 79) | static Table *getcurrenv (lua_State *L) {
function luaA_pushobject (line 89) | void luaA_pushobject (lua_State *L, const TValue *o) {
function LUA_API (line 95) | LUA_API int lua_checkstack (lua_State *L, int size) {
function LUA_API (line 110) | LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) {
function LUA_API (line 125) | LUA_API void lua_setlevel (lua_State *from, lua_State *to) {
function LUA_API (line 130) | LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) {
function LUA_API (line 140) | LUA_API lua_State *lua_newthread (lua_State *L) {
function LUA_API (line 159) | LUA_API int lua_gettop (lua_State *L) {
function LUA_API (line 164) | LUA_API void lua_settop (lua_State *L, int idx) {
function LUA_API (line 180) | LUA_API void lua_remove (lua_State *L, int idx) {
function LUA_API (line 191) | LUA_API void lua_insert (lua_State *L, int idx) {
function LUA_API (line 203) | LUA_API void lua_replace (lua_State *L, int idx) {
function LUA_API (line 228) | LUA_API void lua_pushvalue (lua_State *L, int idx) {
function LUA_API (line 242) | LUA_API int lua_type (lua_State *L, int idx) {
function LUA_API (line 248) | LUA_API const char *lua_typename (lua_State *L, int t) {
function LUA_API (line 254) | LUA_API int lua_iscfunction (lua_State *L, int idx) {
function LUA_API (line 260) | LUA_API int lua_isnumber (lua_State *L, int idx) {
function LUA_API (line 267) | LUA_API int lua_isstring (lua_State *L, int idx) {
function LUA_API (line 273) | LUA_API int lua_isuserdata (lua_State *L, int idx) {
function LUA_API (line 279) | LUA_API int lua_rawequal (lua_State *L, int index1, int index2) {
function LUA_API (line 287) | LUA_API int lua_equal (lua_State *L, int index1, int index2) {
function LUA_API (line 299) | LUA_API int lua_lessthan (lua_State *L, int index1, int index2) {
function LUA_API (line 313) | LUA_API lua_Number lua_tonumber (lua_State *L, int idx) {
function LUA_API (line 323) | LUA_API lua_Integer lua_tointeger (lua_State *L, int idx) {
function LUA_API (line 337) | LUA_API int lua_toboolean (lua_State *L, int idx) {
function LUA_API (line 343) | LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) {
function LUA_API (line 361) | LUA_API size_t lua_objlen (lua_State *L, int idx) {
function LUA_API (line 379) | LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) {
function LUA_API (line 385) | LUA_API void *lua_touserdata (lua_State *L, int idx) {
function LUA_API (line 395) | LUA_API lua_State *lua_tothread (lua_State *L, int idx) {
function LUA_API (line 401) | LUA_API const void *lua_topointer (lua_State *L, int idx) {
function LUA_API (line 421) | LUA_API void lua_pushnil (lua_State *L) {
function LUA_API (line 429) | LUA_API void lua_pushnumber (lua_State *L, lua_Number n) {
function LUA_API (line 437) | LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) {
function LUA_API (line 445) | LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) {
function LUA_API (line 454) | LUA_API void lua_pushstring (lua_State *L, const char *s) {
function LUA_API (line 462) | LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt,
function LUA_API (line 473) | LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) {
function LUA_API (line 486) | LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
function LUA_API (line 503) | LUA_API void lua_pushboolean (lua_State *L, int b) {
function LUA_API (line 511) | LUA_API void lua_pushlightuserdata (lua_State *L, void *p) {
function LUA_API (line 519) | LUA_API int lua_pushthread (lua_State *L) {
function LUA_API (line 534) | LUA_API void lua_gettable (lua_State *L, int idx) {
function LUA_API (line 544) | LUA_API void lua_getfield (lua_State *L, int idx, const char *k) {
function LUA_API (line 557) | LUA_API void lua_rawget (lua_State *L, int idx) {
function LUA_API (line 567) | LUA_API void lua_rawgeti (lua_State *L, int idx, int n) {
function LUA_API (line 578) | LUA_API void lua_createtable (lua_State *L, int narray, int nrec) {
function LUA_API (line 587) | LUA_API int lua_getmetatable (lua_State *L, int objindex) {
function LUA_API (line 616) | LUA_API void lua_getfenv (lua_State *L, int idx) {
function LUA_API (line 645) | LUA_API void lua_settable (lua_State *L, int idx) {
function LUA_API (line 657) | LUA_API void lua_setfield (lua_State *L, int idx, const char *k) {
function LUA_API (line 671) | LUA_API void lua_rawset (lua_State *L, int idx) {
function LUA_API (line 684) | LUA_API void lua_rawseti (lua_State *L, int idx, int n) {
function LUA_API (line 697) | LUA_API int lua_setmetatable (lua_State *L, int objindex) {
function LUA_API (line 734) | LUA_API int lua_setfenv (lua_State *L, int idx) {
function LUA_API (line 776) | LUA_API void lua_call (lua_State *L, int nargs, int nresults) {
type CallS (line 792) | struct CallS { /* data to `f_call' */
function f_call (line 798) | static void f_call (lua_State *L, void *ud) {
function LUA_API (line 805) | LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfun...
type CCallS (line 831) | struct CCallS { /* data to `f_Ccall' */
function f_Ccall (line 837) | static void f_Ccall (lua_State *L, void *ud) {
function LUA_API (line 850) | LUA_API int lua_cpcall (lua_State *L, lua_CFunction func, void *ud) {
function LUA_API (line 862) | LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data,
function LUA_API (line 875) | LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data) {
function LUA_API (line 890) | LUA_API int lua_status (lua_State *L) {
function LUA_API (line 899) | LUA_API int lua_gc (lua_State *L, int what, int data) {
function LUA_API (line 964) | LUA_API int lua_error (lua_State *L) {
function LUA_API (line 973) | LUA_API int lua_next (lua_State *L, int idx) {
function LUA_API (line 990) | LUA_API void lua_concat (lua_State *L, int n) {
function LUA_API (line 1007) | LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) {
function LUA_API (line 1017) | LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) {
function LUA_API (line 1025) | LUA_API void *lua_newuserdata (lua_State *L, size_t size) {
function LUA_API (line 1057) | LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) {
function LUA_API (line 1071) | LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) {
FILE: deps/lua/src/lauxlib.c
function LUALIB_API (line 43) | LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extram...
function LUALIB_API (line 61) | LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) {
function tag_error (line 68) | static void tag_error (lua_State *L, int narg, int tag) {
function LUALIB_API (line 73) | LUALIB_API void luaL_where (lua_State *L, int level) {
function LUALIB_API (line 86) | LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) {
function LUALIB_API (line 99) | LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def,
function LUALIB_API (line 112) | LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) {
function LUALIB_API (line 124) | LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tnam...
function LUALIB_API (line 140) | LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *me...
function LUALIB_API (line 146) | LUALIB_API void luaL_checktype (lua_State *L, int narg, int t) {
function LUALIB_API (line 152) | LUALIB_API void luaL_checkany (lua_State *L, int narg) {
function LUALIB_API (line 158) | LUALIB_API const char *luaL_checklstring (lua_State *L, int narg, size_t...
function LUALIB_API (line 165) | LUALIB_API const char *luaL_optlstring (lua_State *L, int narg,
function LUALIB_API (line 176) | LUALIB_API lua_Number luaL_checknumber (lua_State *L, int narg) {
function LUALIB_API (line 184) | LUALIB_API lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number...
function LUALIB_API (line 189) | LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int narg) {
function LUALIB_API (line 197) | LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg,
function LUALIB_API (line 203) | LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *eve...
function LUALIB_API (line 219) | LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) {
function LUALIB_API (line 229) | LUALIB_API void (luaL_register) (lua_State *L, const char *libname,
function libsize (line 235) | static int libsize (const luaL_Reg *l) {
function LUALIB_API (line 242) | LUALIB_API void luaI_openlib (lua_State *L, const char *libname,
function checkint (line 280) | static int checkint (lua_State *L, int topop) {
function getsizes (line 287) | static void getsizes (lua_State *L) {
function LUALIB_API (line 302) | LUALIB_API void luaL_setn (lua_State *L, int t, int n) {
function LUALIB_API (line 321) | LUALIB_API int luaL_getn (lua_State *L, int t) {
function LUALIB_API (line 340) | LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const cha...
function LUALIB_API (line 357) | LUALIB_API const char *luaL_findtable (lua_State *L, int idx,
function emptybuffer (line 398) | static int emptybuffer (luaL_Buffer *B) {
function adjuststack (line 410) | static void adjuststack (luaL_Buffer *B) {
function LUALIB_API (line 429) | LUALIB_API char *luaL_prepbuffer (luaL_Buffer *B) {
function LUALIB_API (line 436) | LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) {
function LUALIB_API (line 442) | LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) {
function LUALIB_API (line 447) | LUALIB_API void luaL_pushresult (luaL_Buffer *B) {
function LUALIB_API (line 454) | LUALIB_API void luaL_addvalue (luaL_Buffer *B) {
function LUALIB_API (line 472) | LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) {
function LUALIB_API (line 481) | LUALIB_API int luaL_ref (lua_State *L, int t) {
function LUALIB_API (line 504) | LUALIB_API void luaL_unref (lua_State *L, int t, int ref) {
type LoadF (line 522) | typedef struct LoadF {
function errfile (line 543) | static int errfile (lua_State *L, const char *what, int fnameindex) {
function LUALIB_API (line 552) | LUALIB_API int luaL_loadfile (lua_State *L, const char *filename) {
type LoadS (line 593) | typedef struct LoadS {
function LUALIB_API (line 609) | LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t s...
function LUALIB_API (line 618) | LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s) {
function panic (line 639) | static int panic (lua_State *L) {
function LUALIB_API (line 647) | LUALIB_API lua_State *luaL_newstate (void) {
FILE: deps/lua/src/lauxlib.h
type luaL_Reg (line 35) | typedef struct luaL_Reg {
type luaL_Buffer (line 129) | typedef struct luaL_Buffer {
FILE: deps/lua/src/lbaselib.c
function luaB_print (line 31) | static int luaB_print (lua_State *L) {
function luaB_tonumber (line 53) | static int luaB_tonumber (lua_State *L) {
function luaB_error (line 81) | static int luaB_error (lua_State *L) {
function luaB_getmetatable (line 93) | static int luaB_getmetatable (lua_State *L) {
function luaB_setmetatable (line 104) | static int luaB_setmetatable (lua_State *L) {
function getfunc (line 117) | static void getfunc (lua_State *L, int opt) {
function luaB_getfenv (line 133) | static int luaB_getfenv (lua_State *L) {
function luaB_setfenv (line 143) | static int luaB_setfenv (lua_State *L) {
function luaB_rawequal (line 161) | static int luaB_rawequal (lua_State *L) {
function luaB_rawget (line 169) | static int luaB_rawget (lua_State *L) {
function luaB_rawset (line 177) | static int luaB_rawset (lua_State *L) {
function luaB_gcinfo (line 187) | static int luaB_gcinfo (lua_State *L) {
function luaB_collectgarbage (line 193) | static int luaB_collectgarbage (lua_State *L) {
function luaB_type (line 219) | static int luaB_type (lua_State *L) {
function luaB_next (line 226) | static int luaB_next (lua_State *L) {
function luaB_pairs (line 238) | static int luaB_pairs (lua_State *L) {
function ipairsaux (line 247) | static int ipairsaux (lua_State *L) {
function luaB_ipairs (line 257) | static int luaB_ipairs (lua_State *L) {
function load_aux (line 266) | static int load_aux (lua_State *L, int status) {
function luaB_loadstring (line 277) | static int luaB_loadstring (lua_State *L) {
function luaB_loadfile (line 285) | static int luaB_loadfile (lua_State *L) {
function luaB_load (line 315) | static int luaB_load (lua_State *L) {
function luaB_dofile (line 325) | static int luaB_dofile (lua_State *L) {
function luaB_assert (line 334) | static int luaB_assert (lua_State *L) {
function luaB_unpack (line 342) | static int luaB_unpack (lua_State *L) {
function luaB_select (line 358) | static int luaB_select (lua_State *L) {
function luaB_pcall (line 374) | static int luaB_pcall (lua_State *L) {
function luaB_xpcall (line 384) | static int luaB_xpcall (lua_State *L) {
function luaB_tostring (line 396) | static int luaB_tostring (lua_State *L) {
function luaB_newproxy (line 421) | static int luaB_newproxy (lua_State *L) {
function costatus (line 490) | static int costatus (lua_State *L, lua_State *co) {
function luaB_costatus (line 510) | static int luaB_costatus (lua_State *L) {
function auxresume (line 518) | static int auxresume (lua_State *L, lua_State *co, int narg) {
function luaB_coresume (line 543) | static int luaB_coresume (lua_State *L) {
function luaB_auxwrap (line 561) | static int luaB_auxwrap (lua_State *L) {
function luaB_cocreate (line 576) | static int luaB_cocreate (lua_State *L) {
function luaB_cowrap (line 586) | static int luaB_cowrap (lua_State *L) {
function luaB_yield (line 593) | static int luaB_yield (lua_State *L) {
function luaB_corunning (line 598) | static int luaB_corunning (lua_State *L) {
function auxopen (line 618) | static void auxopen (lua_State *L, const char *name,
function base_open (line 626) | static void base_open (lua_State *L) {
function LUALIB_API (line 648) | LUALIB_API int luaopen_base (lua_State *L) {
FILE: deps/lua/src/lcode.c
function isnumeral (line 30) | static int isnumeral(expdesc *e) {
function luaK_nil (line 35) | void luaK_nil (FuncState *fs, int from, int n) {
function luaK_jump (line 59) | int luaK_jump (FuncState *fs) {
function luaK_ret (line 69) | void luaK_ret (FuncState *fs, int first, int nret) {
function condjump (line 74) | static int condjump (FuncState *fs, OpCode op, int A, int B, int C) {
function fixjump (line 80) | static void fixjump (FuncState *fs, int pc, int dest) {
function luaK_getlabel (line 94) | int luaK_getlabel (FuncState *fs) {
function getjump (line 100) | static int getjump (FuncState *fs, int pc) {
function Instruction (line 109) | static Instruction *getjumpcontrol (FuncState *fs, int pc) {
function need_value (line 122) | static int need_value (FuncState *fs, int list) {
function patchtestreg (line 131) | static int patchtestreg (FuncState *fs, int node, int reg) {
function removevalues (line 144) | static void removevalues (FuncState *fs, int list) {
function patchlistaux (line 150) | static void patchlistaux (FuncState *fs, int list, int vtarget, int reg,
function dischargejpc (line 163) | static void dischargejpc (FuncState *fs) {
function luaK_patchlist (line 169) | void luaK_patchlist (FuncState *fs, int list, int target) {
function luaK_patchtohere (line 179) | void luaK_patchtohere (FuncState *fs, int list) {
function luaK_concat (line 185) | void luaK_concat (FuncState *fs, int *l1, int l2) {
function luaK_checkstack (line 199) | void luaK_checkstack (FuncState *fs, int n) {
function luaK_reserveregs (line 209) | void luaK_reserveregs (FuncState *fs, int n) {
function freereg (line 215) | static void freereg (FuncState *fs, int reg) {
function freeexp (line 223) | static void freeexp (FuncState *fs, expdesc *e) {
function addk (line 229) | static int addk (FuncState *fs, TValue *k, TValue *v) {
function luaK_stringK (line 250) | int luaK_stringK (FuncState *fs, TString *s) {
function luaK_numberK (line 257) | int luaK_numberK (FuncState *fs, lua_Number r) {
function boolK (line 264) | static int boolK (FuncState *fs, int b) {
function nilK (line 271) | static int nilK (FuncState *fs) {
function luaK_setreturns (line 280) | void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) {
function luaK_setoneret (line 292) | void luaK_setoneret (FuncState *fs, expdesc *e) {
function luaK_dischargevars (line 304) | void luaK_dischargevars (FuncState *fs, expdesc *e) {
function code_label (line 337) | static int code_label (FuncState *fs, int A, int b, int jump) {
function discharge2reg (line 343) | static void discharge2reg (FuncState *fs, expdesc *e, int reg) {
function discharge2anyreg (line 382) | static void discharge2anyreg (FuncState *fs, expdesc *e) {
function exp2reg (line 390) | static void exp2reg (FuncState *fs, expdesc *e, int reg) {
function luaK_exp2nextreg (line 414) | void luaK_exp2nextreg (FuncState *fs, expdesc *e) {
function luaK_exp2anyreg (line 422) | int luaK_exp2anyreg (FuncState *fs, expdesc *e) {
function luaK_exp2val (line 436) | void luaK_exp2val (FuncState *fs, expdesc *e) {
function luaK_exp2RK (line 444) | int luaK_exp2RK (FuncState *fs, expdesc *e) {
function luaK_storevar (line 472) | void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) {
function luaK_self (line 503) | void luaK_self (FuncState *fs, expdesc *e, expdesc *key) {
function invertjump (line 516) | static void invertjump (FuncState *fs, expdesc *e) {
function jumponcond (line 524) | static int jumponcond (FuncState *fs, expdesc *e, int cond) {
function luaK_goiftrue (line 539) | void luaK_goiftrue (FuncState *fs, expdesc *e) {
function luaK_goiffalse (line 563) | static void luaK_goiffalse (FuncState *fs, expdesc *e) {
function codenot (line 586) | static void codenot (FuncState *fs, expdesc *e) {
function luaK_indexed (line 621) | void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) {
function constfolding (line 627) | static int constfolding (OpCode op, expdesc *e1, expdesc *e2) {
function codearith (line 653) | static void codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e...
function codecomp (line 673) | static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1,
function luaK_prefix (line 689) | void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) {
function luaK_infix (line 710) | void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) {
function luaK_posfix (line 737) | void luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2) {
function luaK_fixline (line 784) | void luaK_fixline (FuncState *fs, int line) {
function luaK_code (line 789) | static int luaK_code (FuncState *fs, Instruction i, int line) {
function luaK_codeABC (line 804) | int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) {
function luaK_codeABx (line 812) | int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) {
function luaK_setlist (line 819) | void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) {
FILE: deps/lua/src/lcode.h
type BinOpr (line 26) | typedef enum BinOpr {
type UnOpr (line 36) | typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr;
FILE: deps/lua/src/ldblib.c
function db_getregistry (line 22) | static int db_getregistry (lua_State *L) {
function db_getmetatable (line 28) | static int db_getmetatable (lua_State *L) {
function db_setmetatable (line 37) | static int db_setmetatable (lua_State *L) {
function db_getfenv (line 47) | static int db_getfenv (lua_State *L) {
function db_setfenv (line 54) | static int db_setfenv (lua_State *L) {
function settabss (line 64) | static void settabss (lua_State *L, const char *i, const char *v) {
function settabsi (line 70) | static void settabsi (lua_State *L, const char *i, int v) {
function lua_State (line 76) | static lua_State *getthread (lua_State *L, int *arg) {
function treatstackoption (line 88) | static void treatstackoption (lua_State *L, lua_State *L1, const char *f...
function db_getinfo (line 99) | static int db_getinfo (lua_State *L) {
function db_getlocal (line 144) | static int db_getlocal (lua_State *L) {
function db_setlocal (line 165) | static int db_setlocal (lua_State *L) {
function auxupvalue (line 179) | static int auxupvalue (lua_State *L, int get) {
function db_getupvalue (line 192) | static int db_getupvalue (lua_State *L) {
function db_setupvalue (line 197) | static int db_setupvalue (lua_State *L) {
function hookf (line 207) | static void hookf (lua_State *L, lua_Debug *ar) {
function makemask (line 225) | static int makemask (const char *smask, int count) {
function gethooktable (line 245) | static void gethooktable (lua_State *L) {
function db_sethook (line 258) | static int db_sethook (lua_State *L) {
function db_gethook (line 282) | static int db_gethook (lua_State *L) {
function db_debug (line 302) | static int db_debug (lua_State *L) {
function db_errorfb (line 322) | static int db_errorfb (lua_State *L) {
function LUALIB_API (line 394) | LUALIB_API int luaopen_debug (lua_State *L) {
FILE: deps/lua/src/ldebug.c
function currentpc (line 36) | static int currentpc (lua_State *L, CallInfo *ci) {
function currentline (line 44) | static int currentline (lua_State *L, CallInfo *ci) {
function LUA_API (line 56) | LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int coun...
function LUA_API (line 69) | LUA_API lua_Hook lua_gethook (lua_State *L) {
function LUA_API (line 74) | LUA_API int lua_gethookmask (lua_State *L) {
function LUA_API (line 79) | LUA_API int lua_gethookcount (lua_State *L) {
function LUA_API (line 84) | LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) {
function Proto (line 107) | static Proto *getluaproto (CallInfo *ci) {
function LUA_API (line 127) | LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int...
function LUA_API (line 138) | LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int...
function funcinfo (line 150) | static void funcinfo (lua_Debug *ar, Closure *cl) {
function info_tailcall (line 167) | static void info_tailcall (lua_Debug *ar) {
function collectvalidlines (line 177) | static void collectvalidlines (lua_State *L, Closure *f) {
function auxgetinfo (line 193) | static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar,
function LUA_API (line 232) | LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {
function precheck (line 276) | static int precheck (const Proto *pt) {
function luaG_checkopenop (line 290) | int luaG_checkopenop (Instruction i) {
function checkArgMode (line 304) | static int checkArgMode (const Proto *pt, int r, enum OpArgMask mode) {
function Instruction (line 317) | static Instruction symbexec (const Proto *pt, int lastpc, int reg) {
function luaG_checkcode (line 484) | int luaG_checkcode (const Proto *pt) {
function isinstack (line 559) | static int isinstack (CallInfo *ci, const TValue *o) {
function luaG_typeerror (line 567) | void luaG_typeerror (lua_State *L, const TValue *o, const char *op) {
function luaG_concaterror (line 581) | void luaG_concaterror (lua_State *L, StkId p1, StkId p2) {
function luaG_aritherror (line 588) | void luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) {
function luaG_ordererror (line 596) | int luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) {
function addinfo (line 607) | static void addinfo (lua_State *L, const char *msg) {
function luaG_errormsg (line 618) | void luaG_errormsg (lua_State *L) {
function luaG_runerror (line 631) | void luaG_runerror (lua_State *L, const char *fmt, ...) {
FILE: deps/lua/src/ldo.c
type lua_longjmp (line 44) | struct lua_longjmp {
function luaD_seterrorobj (line 51) | void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop) {
function restore_stack_limit (line 71) | static void restore_stack_limit (lua_State *L) {
function resetstack (line 81) | static void resetstack (lua_State *L, int status) {
function luaD_throw (line 94) | void luaD_throw (lua_State *L, int errcode) {
function luaD_rawrunprotected (line 111) | int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) {
function correctstack (line 126) | static void correctstack (lua_State *L, TValue *oldstack) {
function luaD_reallocstack (line 141) | void luaD_reallocstack (lua_State *L, int newsize) {
function luaD_reallocCI (line 152) | void luaD_reallocCI (lua_State *L, int newsize) {
function luaD_growstack (line 161) | void luaD_growstack (lua_State *L, int n) {
function CallInfo (line 169) | static CallInfo *growCI (lua_State *L) {
function luaD_callhook (line 181) | void luaD_callhook (lua_State *L, int event, int line) {
function StkId (line 208) | static StkId adjust_varargs (lua_State *L, Proto *p, int actual) {
function StkId (line 244) | static StkId tryfuncTM (lua_State *L, StkId func) {
function luaD_precall (line 265) | int luaD_precall (lua_State *L, StkId func, int nresults) {
function StkId (line 332) | static StkId callrethooks (lua_State *L, StkId firstResult) {
function luaD_poscall (line 343) | int luaD_poscall (lua_State *L, StkId firstResult) {
function luaD_call (line 370) | void luaD_call (lua_State *L, StkId func, int nResults) {
function resume (line 384) | static void resume (lua_State *L, void *ud) {
function resume_error (line 409) | static int resume_error (lua_State *L, const char *msg) {
function LUA_API (line 418) | LUA_API int lua_resume (lua_State *L, int nargs) {
function LUA_API (line 444) | LUA_API int lua_yield (lua_State *L, int nresults) {
function luaD_pcall (line 456) | int luaD_pcall (lua_State *L, Pfunc func, void *u,
type SParser (line 485) | struct SParser { /* data to `f_parser' */
function f_parser (line 491) | static void f_parser (lua_State *L, void *ud) {
function luaD_protectedparser (line 509) | int luaD_protectedparser (lua_State *L, ZIO *z, const char *name) {
FILE: deps/lua/src/ldump.c
type DumpState (line 18) | typedef struct {
function DumpBlock (line 29) | static void DumpBlock(const void* b, size_t size, DumpState* D)
function DumpChar (line 39) | static void DumpChar(int y, DumpState* D)
function DumpInt (line 45) | static void DumpInt(int x, DumpState* D)
function DumpNumber (line 50) | static void DumpNumber(lua_Number x, DumpState* D)
function DumpVector (line 55) | static void DumpVector(const void* b, int n, size_t size, DumpState* D)
function DumpString (line 61) | static void DumpString(const TString* s, DumpState* D)
function DumpConstants (line 80) | static void DumpConstants(const Proto* f, DumpState* D)
function DumpDebug (line 111) | static void DumpDebug(const Proto* f, DumpState* D)
function DumpFunction (line 129) | static void DumpFunction(const Proto* f, const TString* p, DumpState* D)
function DumpHeader (line 143) | static void DumpHeader(DumpState* D)
function luaU_dump (line 153) | int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, i...
FILE: deps/lua/src/lfunc.c
function Closure (line 23) | Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e) {
function Closure (line 33) | Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e) {
function UpVal (line 44) | UpVal *luaF_newupval (lua_State *L) {
function UpVal (line 53) | UpVal *luaF_findupval (lua_State *L, StkId level) {
function unlinkupval (line 82) | static void unlinkupval (UpVal *uv) {
function luaF_freeupval (line 89) | void luaF_freeupval (lua_State *L, UpVal *uv) {
function luaF_close (line 96) | void luaF_close (lua_State *L, StkId level) {
function Proto (line 115) | Proto *luaF_newproto (lua_State *L) {
function luaF_freeproto (line 141) | void luaF_freeproto (lua_State *L, Proto *f) {
function luaF_freeclosure (line 152) | void luaF_freeclosure (lua_State *L, Closure *c) {
FILE: deps/lua/src/lgc.c
function removeentry (line 62) | static void removeentry (Node *n) {
function reallymarkobject (line 69) | static void reallymarkobject (global_State *g, GCObject *o) {
function marktmu (line 115) | static void marktmu (global_State *g) {
function luaC_separateudata (line 128) | size_t luaC_separateudata (lua_State *L, int all) {
function traversetable (line 158) | static int traversetable (global_State *g, Table *h) {
function traverseproto (line 203) | static void traverseproto (global_State *g, Proto *f) {
function traverseclosure (line 224) | static void traverseclosure (global_State *g, Closure *cl) {
function checkstacksizes (line 241) | static void checkstacksizes (lua_State *L, StkId max) {
function traversestack (line 256) | static void traversestack (global_State *g, lua_State *l) {
function l_mem (line 277) | static l_mem propagatemark (global_State *g) {
function propagateall (line 323) | static size_t propagateall (global_State *g) {
function iscleared (line 337) | static int iscleared (const TValue *o, int iskey) {
function cleartable (line 351) | static void cleartable (GCObject *l) {
function freeobj (line 378) | static void freeobj (lua_State *L, GCObject *o) {
function GCObject (line 407) | static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) {
function checkSizes (line 431) | static void checkSizes (lua_State *L) {
function GCTM (line 445) | static void GCTM (lua_State *L) {
function luaC_callGCTM (line 477) | void luaC_callGCTM (lua_State *L) {
function luaC_freeall (line 483) | void luaC_freeall (lua_State *L) {
function markmt (line 493) | static void markmt (global_State *g) {
function markroot (line 501) | static void markroot (lua_State *L) {
function remarkupvals (line 515) | static void remarkupvals (global_State *g) {
function atomic (line 525) | static void atomic (lua_State *L) {
function l_mem (line 556) | static l_mem singlestep (lua_State *L) {
function luaC_step (line 610) | void luaC_step (lua_State *L) {
function luaC_fullgc (line 635) | void luaC_fullgc (lua_State *L) {
function luaC_barrierf (line 661) | void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v) {
function luaC_barrierback (line 674) | void luaC_barrierback (lua_State *L, Table *t) {
function luaC_link (line 685) | void luaC_link (lua_State *L, GCObject *o, lu_byte tt) {
function luaC_linkupval (line 694) | void luaC_linkupval (lua_State *L, UpVal *uv) {
FILE: deps/lua/src/linit.c
function LUALIB_API (line 30) | LUALIB_API void luaL_openlibs (lua_State *L) {
FILE: deps/lua/src/liolib.c
function pushresult (line 30) | static int pushresult (lua_State *L, int i, const char *filename) {
function fileerror (line 48) | static void fileerror (lua_State *L, int arg, const char *filename) {
function io_type (line 57) | static int io_type (lua_State *L) {
function FILE (line 72) | static FILE *tofile (lua_State *L) {
function FILE (line 86) | static FILE **newfile (lua_State *L) {
function io_noclose (line 98) | static int io_noclose (lua_State *L) {
function io_pclose (line 108) | static int io_pclose (lua_State *L) {
function io_fclose (line 119) | static int io_fclose (lua_State *L) {
function aux_close (line 127) | static int aux_close (lua_State *L) {
function io_close (line 134) | static int io_close (lua_State *L) {
function io_gc (line 142) | static int io_gc (lua_State *L) {
function io_tostring (line 151) | static int io_tostring (lua_State *L) {
function io_open (line 161) | static int io_open (lua_State *L) {
function io_popen (line 174) | static int io_popen (lua_State *L) {
function io_tmpfile (line 183) | static int io_tmpfile (lua_State *L) {
function FILE (line 190) | static FILE *getiofile (lua_State *L, int findex) {
function g_iofile (line 200) | static int g_iofile (lua_State *L, int f, const char *mode) {
function io_input (line 221) | static int io_input (lua_State *L) {
function io_output (line 226) | static int io_output (lua_State *L) {
function aux_lines (line 234) | static void aux_lines (lua_State *L, int idx, int toclose) {
function f_lines (line 241) | static int f_lines (lua_State *L) {
function io_lines (line 248) | static int io_lines (lua_State *L) {
function read_number (line 273) | static int read_number (lua_State *L, FILE *f) {
function test_eof (line 286) | static int test_eof (lua_State *L, FILE *f) {
function read_line (line 294) | static int read_line (lua_State *L, FILE *f) {
function read_chars (line 316) | static int read_chars (lua_State *L, FILE *f, size_t n) {
function g_read (line 334) | static int g_read (lua_State *L, FILE *f, int first) {
function io_read (line 381) | static int io_read (lua_State *L) {
function f_read (line 386) | static int f_read (lua_State *L) {
function io_readline (line 391) | static int io_readline (lua_State *L) {
function g_write (line 413) | static int g_write (lua_State *L, FILE *f, int arg) {
function io_write (line 432) | static int io_write (lua_State *L) {
function f_write (line 437) | static int f_write (lua_State *L) {
function f_seek (line 442) | static int f_seek (lua_State *L) {
function f_setvbuf (line 458) | static int f_setvbuf (lua_State *L) {
function io_flush (line 470) | static int io_flush (lua_State *L) {
function f_flush (line 475) | static int f_flush (lua_State *L) {
function createmeta (line 510) | static void createmeta (lua_State *L) {
function createstdfile (line 518) | static void createstdfile (lua_State *L, FILE *f, int k, const char *fna...
function newfenv (line 530) | static void newfenv (lua_State *L, lua_CFunction cls) {
function LUALIB_API (line 537) | LUALIB_API int luaopen_io (lua_State *L) {
FILE: deps/lua/src/llex.c
function save (line 51) | static void save (LexState *ls, int c) {
function luaX_init (line 64) | void luaX_init (lua_State *L) {
function luaX_lexerror (line 102) | void luaX_lexerror (LexState *ls, const char *msg, int token) {
function luaX_syntaxerror (line 112) | void luaX_syntaxerror (LexState *ls, const char *msg) {
function TString (line 117) | TString *luaX_newstring (LexState *ls, const char *str, size_t l) {
function inclinenumber (line 129) | static void inclinenumber (LexState *ls) {
function luaX_setinput (line 140) | void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source) {
function check_next (line 163) | static int check_next (LexState *ls, const char *set) {
function buffreplace (line 171) | static void buffreplace (LexState *ls, char from, char to) {
function trydecpoint (line 179) | static void trydecpoint (LexState *ls, SemInfo *seminfo) {
function read_numeral (line 194) | static void read_numeral (LexState *ls, SemInfo *seminfo) {
function skip_sep (line 210) | static int skip_sep (LexState *ls) {
function read_long_string (line 223) | static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) {
function read_string (line 278) | static void read_string (LexState *ls, int del, SemInfo *seminfo) {
function llex (line 334) | static int llex (LexState *ls, SemInfo *seminfo) {
function luaX_next (line 448) | void luaX_next (LexState *ls) {
function luaX_lookahead (line 459) | void luaX_lookahead (LexState *ls) {
FILE: deps/lua/src/llex.h
type RESERVED (line 24) | enum RESERVED {
type SemInfo (line 43) | typedef union {
type Token (line 49) | typedef struct Token {
type LexState (line 55) | typedef struct LexState {
FILE: deps/lua/src/llimits.h
type LUAI_UINT32 (line 18) | typedef LUAI_UINT32 lu_int32;
type LUAI_UMEM (line 20) | typedef LUAI_UMEM lu_mem;
type LUAI_MEM (line 22) | typedef LUAI_MEM l_mem;
type lu_byte (line 27) | typedef unsigned char lu_byte;
type LUAI_USER_ALIGNMENT_T (line 47) | typedef LUAI_USER_ALIGNMENT_T L_Umaxalign;
type LUAI_UACNUMBER (line 51) | typedef LUAI_UACNUMBER l_uacNumber;
type lu_int32 (line 88) | typedef lu_int32 Instruction;
FILE: deps/lua/src/lmathlib.c
function math_abs (line 26) | static int math_abs (lua_State *L) {
function math_sin (line 31) | static int math_sin (lua_State *L) {
function math_sinh (line 36) | static int math_sinh (lua_State *L) {
function math_cos (line 41) | static int math_cos (lua_State *L) {
function math_cosh (line 46) | static int math_cosh (lua_State *L) {
function math_tan (line 51) | static int math_tan (lua_State *L) {
function math_tanh (line 56) | static int math_tanh (lua_State *L) {
function math_asin (line 61) | static int math_asin (lua_State *L) {
function math_acos (line 66) | static int math_acos (lua_State *L) {
function math_atan (line 71) | static int math_atan (lua_State *L) {
function math_atan2 (line 76) | static int math_atan2 (lua_State *L) {
function math_ceil (line 81) | static int math_ceil (lua_State *L) {
function math_floor (line 86) | static int math_floor (lua_State *L) {
function math_fmod (line 91) | static int math_fmod (lua_State *L) {
function math_modf (line 96) | static int math_modf (lua_State *L) {
function math_sqrt (line 104) | static int math_sqrt (lua_State *L) {
function math_pow (line 109) | static int math_pow (lua_State *L) {
function math_log (line 114) | static int math_log (lua_State *L) {
function math_log10 (line 119) | static int math_log10 (lua_State *L) {
function math_exp (line 124) | static int math_exp (lua_State *L) {
function math_deg (line 129) | static int math_deg (lua_State *L) {
function math_rad (line 134) | static int math_rad (lua_State *L) {
function math_frexp (line 139) | static int math_frexp (lua_State *L) {
function math_ldexp (line 146) | static int math_ldexp (lua_State *L) {
function math_min (line 153) | static int math_min (lua_State *L) {
function math_max (line 167) | static int math_max (lua_State *L) {
function math_random (line 181) | static int math_random (lua_State *L) {
function math_randomseed (line 209) | static int math_randomseed (lua_State *L) {
function LUALIB_API (line 251) | LUALIB_API int luaopen_math (lua_State *L) {
FILE: deps/lua/src/loadlib.c
function ll_unloadlib (line 63) | static void ll_unloadlib (void *lib) {
function lua_CFunction (line 75) | static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {
function setprogdir (line 97) | static void setprogdir (lua_State *L) {
function pusherror (line 112) | static void pusherror (lua_State *L) {
function ll_unloadlib (line 122) | static void ll_unloadlib (void *lib) {
function lua_CFunction (line 134) | static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {
function pusherror (line 159) | static void pusherror (lua_State *L) {
function ll_unloadlib (line 186) | static void ll_unloadlib (void *lib) {
function lua_CFunction (line 212) | static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {
function ll_unloadlib (line 239) | static void ll_unloadlib (void *lib) {
function lua_CFunction (line 251) | static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {
function gctm (line 286) | static int gctm (lua_State *L) {
function ll_loadfunc (line 294) | static int ll_loadfunc (lua_State *L, const char *path, const char *sym) {
function ll_loadlib (line 309) | static int ll_loadlib (lua_State *L) {
function readable (line 332) | static int readable (const char *filename) {
function loaderror (line 374) | static void loaderror (lua_State *L, const char *filename) {
function loader_Lua (line 380) | static int loader_Lua (lua_State *L) {
function loader_C (line 402) | static int loader_C (lua_State *L) {
function loader_Croot (line 414) | static int loader_Croot (lua_State *L) {
function loader_preload (line 435) | static int loader_preload (lua_State *L) {
function ll_require (line 451) | static int ll_require (lua_State *L) {
function setfenv (line 507) | static void setfenv (lua_State *L) {
function dooptions (line 519) | static void dooptions (lua_State *L, int n) {
function modinit (line 529) | static void modinit (lua_State *L, const char *modname) {
function ll_module (line 544) | static int ll_module (lua_State *L) {
function ll_seeall (line 572) | static int ll_seeall (lua_State *L) {
function setpath (line 592) | static void setpath (lua_State *L, const char *fieldname, const char *en...
function LUALIB_API (line 627) | LUALIB_API int luaopen_package (lua_State *L) {
FILE: deps/lua/src/lobject.c
function luaO_int2fb (line 35) | int luaO_int2fb (unsigned int x) {
function luaO_fb2int (line 47) | int luaO_fb2int (int x) {
function luaO_log2 (line 54) | int luaO_log2 (unsigned int x) {
function luaO_rawequalObj (line 72) | int luaO_rawequalObj (const TValue *t1, const TValue *t2) {
function luaO_str2d (line 90) | int luaO_str2d (const char *s, lua_Number *result) {
function pushstr (line 104) | static void pushstr (lua_State *L, const char *str) {
function luaO_chunkid (line 182) | void luaO_chunkid (char *out, const char *source, size_t bufflen) {
FILE: deps/lua/src/lobject.h
type GCObject (line 36) | typedef union GCObject GCObject;
type GCheader (line 49) | typedef struct GCheader {
type Value (line 59) | typedef union {
type TValue (line 73) | typedef struct lua_TValue {
type TValue (line 193) | typedef TValue *StkId;
type TString (line 199) | typedef union TString {
type Udata (line 215) | typedef union Udata {
type Proto (line 231) | typedef struct Proto {
type LocVar (line 262) | typedef struct LocVar {
type UpVal (line 274) | typedef struct UpVal {
type CClosure (line 295) | typedef struct CClosure {
type LClosure (line 302) | typedef struct LClosure {
type Closure (line 309) | typedef union Closure {
type TKey (line 323) | typedef union TKey {
type Node (line 332) | typedef struct Node {
type Table (line 338) | typedef struct Table {
FILE: deps/lua/src/lopcodes.h
type OpMode (line 31) | enum OpMode {iABC, iABx, iAsBx}
type OpCode (line 150) | typedef enum {
type OpArgMask (line 245) | enum OpArgMask {
FILE: deps/lua/src/loslib.c
function os_pushresult (line 23) | static int os_pushresult (lua_State *L, int i, const char *filename) {
function os_execute (line 38) | static int os_execute (lua_State *L) {
function os_remove (line 44) | static int os_remove (lua_State *L) {
function os_rename (line 50) | static int os_rename (lua_State *L) {
function os_tmpname (line 57) | static int os_tmpname (lua_State *L) {
function os_getenv (line 68) | static int os_getenv (lua_State *L) {
function os_clock (line 74) | static int os_clock (lua_State *L) {
function setfield (line 88) | static void setfield (lua_State *L, const char *key, int value) {
function setboolfield (line 93) | static void setboolfield (lua_State *L, const char *key, int value) {
function getboolfield (line 100) | static int getboolfield (lua_State *L, const char *key) {
function getfield (line 109) | static int getfield (lua_State *L, const char *key, int d) {
function os_date (line 124) | static int os_date (lua_State *L) {
function os_time (line 170) | static int os_time (lua_State *L) {
function os_difftime (line 195) | static int os_difftime (lua_State *L) {
function os_setlocale (line 204) | static int os_setlocale (lua_State *L) {
function os_exit (line 216) | static int os_exit (lua_State *L) {
function LUALIB_API (line 239) | LUALIB_API int luaopen_os (lua_State *L) {
FILE: deps/lua/src/lparser.c
type BlockCnt (line 40) | typedef struct BlockCnt {
function anchor_token (line 57) | static void anchor_token (LexState *ls) {
function error_expected (line 65) | static void error_expected (LexState *ls, int token) {
function errorlimit (line 71) | static void errorlimit (FuncState *fs, int limit, const char *what) {
function testnext (line 80) | static int testnext (LexState *ls, int c) {
function check (line 89) | static void check (LexState *ls, int c) {
function checknext (line 94) | static void checknext (LexState *ls, int c) {
function check_match (line 104) | static void check_match (LexState *ls, int what, int who, int where) {
function TString (line 117) | static TString *str_checkname (LexState *ls) {
function init_exp (line 126) | static void init_exp (expdesc *e, expkind k, int i) {
function codestring (line 133) | static void codestring (LexState *ls, expdesc *e, TString *s) {
function checkname (line 138) | static void checkname(LexState *ls, expdesc *e) {
function registerlocalvar (line 143) | static int registerlocalvar (LexState *ls, TString *varname) {
function new_localvar (line 160) | static void new_localvar (LexState *ls, TString *name, int n) {
function adjustlocalvars (line 167) | static void adjustlocalvars (LexState *ls, int nvars) {
function removevars (line 176) | static void removevars (LexState *ls, int tolevel) {
function indexupvalue (line 183) | static int indexupvalue (FuncState *fs, TString *name, expdesc *v) {
function searchvar (line 207) | static int searchvar (FuncState *fs, TString *n) {
function markupval (line 217) | static void markupval (FuncState *fs, int level) {
function singlevaraux (line 224) | static int singlevaraux (FuncState *fs, TString *n, expdesc *var, int ba...
function singlevar (line 248) | static void singlevar (LexState *ls, expdesc *var) {
function adjust_assign (line 256) | static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *...
function enterlevel (line 276) | static void enterlevel (LexState *ls) {
function enterblock (line 285) | static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isbreakable) {
function leaveblock (line 296) | static void leaveblock (FuncState *fs) {
function pushclosure (line 310) | static void pushclosure (LexState *ls, FuncState *func, expdesc *v) {
function open_func (line 328) | static void open_func (LexState *ls, FuncState *fs) {
function close_func (line 356) | static void close_func (LexState *ls) {
function Proto (line 383) | Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *nam...
function field (line 407) | static void field (LexState *ls, expdesc *v) {
function yindex (line 418) | static void yindex (LexState *ls, expdesc *v) {
type ConsControl (line 434) | struct ConsControl {
function recfield (line 443) | static void recfield (LexState *ls, struct ConsControl *cc) {
function closelistfield (line 464) | static void closelistfield (FuncState *fs, struct ConsControl *cc) {
function lastlistfield (line 475) | static void lastlistfield (FuncState *fs, struct ConsControl *cc) {
function listfield (line 490) | static void listfield (LexState *ls, struct ConsControl *cc) {
function constructor (line 498) | static void constructor (LexState *ls, expdesc *t) {
function parlist (line 543) | static void parlist (LexState *ls) {
function body (line 576) | static void body (LexState *ls, expdesc *e, int needself, int line) {
function explist1 (line 596) | static int explist1 (LexState *ls, expdesc *v) {
function funcargs (line 609) | static void funcargs (LexState *ls, expdesc *f) {
function prefixexp (line 667) | static void prefixexp (LexState *ls, expdesc *v) {
function primaryexp (line 690) | static void primaryexp (LexState *ls, expdesc *v) {
function simpleexp (line 727) | static void simpleexp (LexState *ls, expdesc *v) {
function UnOpr (line 778) | static UnOpr getunopr (int op) {
function BinOpr (line 788) | static BinOpr getbinopr (int op) {
function BinOpr (line 828) | static BinOpr subexpr (LexState *ls, expdesc *v, unsigned int limit) {
function expr (line 856) | static void expr (LexState *ls, expdesc *v) {
function block_follow (line 871) | static int block_follow (int token) {
function block (line 881) | static void block (LexState *ls) {
type LHS_assign (line 896) | struct LHS_assign {
function check_conflict (line 908) | static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc...
function assignment (line 931) | static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) {
function cond (line 965) | static int cond (LexState *ls) {
function breakstat (line 975) | static void breakstat (LexState *ls) {
function whilestat (line 991) | static void whilestat (LexState *ls, int line) {
function repeatstat (line 1010) | static void repeatstat (LexState *ls, int line) {
function exp1 (line 1036) | static int exp1 (LexState *ls) {
function forbody (line 1046) | static void forbody (LexState *ls, int base, int line, int nvars, int is...
function fornum (line 1067) | static void fornum (LexState *ls, TString *varname, int line) {
function forlist (line 1089) | static void forlist (LexState *ls, TString *indexname) {
function forstat (line 1112) | static void forstat (LexState *ls, int line) {
FILE: deps/lua/src/lparser.h
type expkind (line 19) | typedef enum {
type expdesc (line 37) | typedef struct expdesc {
type upvaldesc (line 48) | typedef struct upvaldesc {
type BlockCnt (line 54) | struct BlockCnt
type FuncState (line 58) | typedef struct FuncState {
FILE: deps/lua/src/lstate.c
type LG (line 35) | typedef struct LG {
function stack_init (line 42) | static void stack_init (lua_State *L1, lua_State *L) {
function freestack (line 61) | static void freestack (lua_State *L, lua_State *L1) {
function f_luaopen (line 70) | static void f_luaopen (lua_State *L, void *ud) {
function preinit_state (line 84) | static void preinit_state (lua_State *L, global_State *g) {
function close_state (line 105) | static void close_state (lua_State *L) {
function lua_State (line 119) | lua_State *luaE_newthread (lua_State *L) {
function luaE_freethread (line 134) | void luaE_freethread (lua_State *L, lua_State *L1) {
function LUA_API (line 143) | LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
function callallgcTM (line 193) | static void callallgcTM (lua_State *L, void *ud) {
function LUA_API (line 199) | LUA_API void lua_close (lua_State *L) {
FILE: deps/lua/src/lstate.h
type lua_longjmp (line 18) | struct lua_longjmp
type stringtable (line 38) | typedef struct stringtable {
type CallInfo (line 48) | typedef struct CallInfo {
type global_State (line 68) | typedef struct global_State {
type lua_State (line 100) | struct lua_State {
type Table (line 141) | struct Table
type Proto (line 142) | struct Proto
type UpVal (line 143) | struct UpVal
type lua_State (line 144) | struct lua_State
FILE: deps/lua/src/lstring.c
function luaS_resize (line 22) | void luaS_resize (lua_State *L, int newsize) {
function TString (line 50) | static TString *newlstr (lua_State *L, const char *str, size_t l,
function TString (line 75) | TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
function Udata (line 96) | Udata *luaS_newudata (lua_State *L, size_t s, Table *e) {
FILE: deps/lua/src/lstrlib.c
function str_len (line 28) | static int str_len (lua_State *L) {
function posrelat (line 36) | static ptrdiff_t posrelat (ptrdiff_t pos, size_t len) {
function str_sub (line 43) | static int str_sub (lua_State *L) {
function str_reverse (line 57) | static int str_reverse (lua_State *L) {
function str_lower (line 68) | static int str_lower (lua_State *L) {
function str_upper (line 81) | static int str_upper (lua_State *L) {
function str_rep (line 93) | static int str_rep (lua_State *L) {
function str_byte (line 106) | static int str_byte (lua_State *L) {
function str_char (line 125) | static int str_char (lua_State *L) {
function writer (line 140) | static int writer (lua_State *L, const void* b, size_t size, void* B) {
function str_dump (line 147) | static int str_dump (lua_State *L) {
type MatchState (line 170) | typedef struct MatchState {
function check_capture (line 186) | static int check_capture (MatchState *ms, int l) {
function capture_to_close (line 194) | static int capture_to_close (MatchState *ms) {
function match_class (line 226) | static int match_class (int c, int cl) {
function matchbracketclass (line 245) | static int matchbracketclass (int c, const char *p, const char *ec) {
function singlematch (line 268) | static int singlematch (int c, const char *p, const char *ep) {
function push_onecapture (line 466) | static void push_onecapture (MatchState *ms, int i, const char *s,
function push_captures (line 485) | static int push_captures (MatchState *ms, const char *s, const char *e) {
function str_find_aux (line 495) | static int str_find_aux (lua_State *L, int find) {
function str_find (line 538) | static int str_find (lua_State *L) {
function str_match (line 543) | static int str_match (lua_State *L) {
function gmatch_aux (line 548) | static int gmatch_aux (lua_State *L) {
function gmatch (line 574) | static int gmatch (lua_State *L) {
function gfind_nodef (line 584) | static int gfind_nodef (lua_State *L) {
function add_s (line 590) | static void add_s (MatchState *ms, luaL_Buffer *b, const char *s,
function add_value (line 612) | static void add_value (MatchState *ms, luaL_Buffer *b, const char *s,
function str_gsub (line 644) | static int str_gsub (lua_State *L) {
function addquoted (line 696) | static void addquoted (lua_State *L, luaL_Buffer *b, int arg) {
function addintlen (line 747) | static void addintlen (char *form) {
function str_format (line 756) | static int str_format (lua_State *L) {
function createmetatable (line 847) | static void createmetatable (lua_State *L) {
function LUALIB_API (line 862) | LUALIB_API int luaopen_string (lua_State *L) {
FILE: deps/lua/src/ltable.c
function Node (line 84) | static Node *hashnum (const Table *t, lua_Number n) {
function Node (line 100) | static Node *mainposition (const Table *t, const TValue *key) {
function arrayindex (line 120) | static int arrayindex (const TValue *key) {
function findindex (line 137) | static int findindex (lua_State *L, Table *t, StkId key) {
function luaH_next (line 162) | int luaH_next (lua_State *L, Table *t, StkId key) {
function computesizes (line 189) | static int computesizes (int nums[], int *narray) {
function countint (line 211) | static int countint (const TValue *key, int *nums) {
function numusearray (line 222) | static int numusearray (const Table *t, int *nums) {
function numusehash (line 247) | static int numusehash (const Table *t, int *nums, int *pnasize) {
function setarrayvector (line 263) | static void setarrayvector (lua_State *L, Table *t, int size) {
function setnodevector (line 272) | static void setnodevector (lua_State *L, Table *t, int size) {
function resize (line 297) | static void resize (lua_State *L, Table *t, int nasize, int nhsize) {
function luaH_resizearray (line 327) | void luaH_resizearray (lua_State *L, Table *t, int nasize) {
function rehash (line 333) | static void rehash (lua_State *L, Table *t, const TValue *ek) {
function Table (line 358) | Table *luaH_new (lua_State *L, int narray, int nhash) {
function luaH_free (line 374) | void luaH_free (lua_State *L, Table *t) {
function Node (line 382) | static Node *getfreepos (Table *t) {
function TValue (line 399) | static TValue *newkey (lua_State *L, Table *t, const TValue *key) {
function TValue (line 435) | const TValue *luaH_getnum (Table *t, int key) {
function TValue (line 455) | const TValue *luaH_getstr (Table *t, TString *key) {
function TValue (line 469) | const TValue *luaH_get (Table *t, const TValue *key) {
function TValue (line 494) | TValue *luaH_set (lua_State *L, Table *t, const TValue *key) {
function TValue (line 508) | TValue *luaH_setnum (lua_State *L, Table *t, int key) {
function TValue (line 520) | TValue *luaH_setstr (lua_State *L, Table *t, TString *key) {
function unbound_search (line 532) | static int unbound_search (Table *t, unsigned int j) {
function luaH_getn (line 560) | int luaH_getn (Table *t) {
function Node (line 582) | Node *luaH_mainposition (const Table *t, const TValue *key) {
function luaH_isdummy (line 586) | int luaH_isdummy (Node *n) { return n == dummynode; }
FILE: deps/lua/src/ltablib.c
function foreachi (line 22) | static int foreachi (lua_State *L) {
function foreach (line 39) | static int foreach (lua_State *L) {
function maxn (line 56) | static int maxn (lua_State *L) {
function getn (line 72) | static int getn (lua_State *L) {
function setn (line 78) | static int setn (lua_State *L) {
function tinsert (line 90) | static int tinsert (lua_State *L) {
function tremove (line 118) | static int tremove (lua_State *L) {
function addfield (line 135) | static void addfield (lua_State *L, luaL_Buffer *b, int i) {
function tconcat (line 144) | static int tconcat (lua_State *L) {
function set2 (line 173) | static void set2 (lua_State *L, int i, int j) {
function sort_comp (line 178) | static int sort_comp (lua_State *L, int a, int b) {
function auxsort (line 193) | static void auxsort (lua_State *L, int l, int u) {
function sort (line 256) | static int sort (lua_State *L) {
function LUALIB_API (line 283) | LUALIB_API int luaopen_table (lua_State *L) {
FILE: deps/lua/src/ltm.c
function luaT_init (line 30) | void luaT_init (lua_State *L) {
function TValue (line 50) | const TValue *luaT_gettm (Table *events, TMS event, TString *ename) {
function TValue (line 61) | const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) {
FILE: deps/lua/src/ltm.h
type TMS (line 18) | typedef enum {
FILE: deps/lua/src/lua.c
function lstop (line 28) | static void lstop (lua_State *L, lua_Debug *ar) {
function laction (line 35) | static void laction (int i) {
function print_usage (line 42) | static void print_usage (void) {
function l_message (line 58) | static void l_message (const char *pname, const char *msg) {
function report (line 65) | static int report (lua_State *L, int status) {
function traceback (line 76) | static int traceback (lua_State *L) {
function docall (line 96) | static int docall (lua_State *L, int narg, int clear) {
function print_version (line 111) | static void print_version (void) {
function getargs (line 116) | static int getargs (lua_State *L, char **argv, int n) {
function dofile (line 134) | static int dofile (lua_State *L, const char *name) {
function dostring (line 140) | static int dostring (lua_State *L, const char *s, const char *name) {
function dolibrary (line 146) | static int dolibrary (lua_State *L, const char *name) {
function incomplete (line 163) | static int incomplete (lua_State *L, int status) {
function pushline (line 177) | static int pushline (lua_State *L, int firstline) {
function loadline (line 196) | static int loadline (lua_State *L) {
function dotty (line 216) | static void dotty (lua_State *L) {
function handle_script (line 239) | static int handle_script (lua_State *L, char **argv, int n) {
function collectargs (line 261) | static int collectargs (char **argv, int *pi, int *pv, int *pe) {
function runargs (line 294) | static int runargs (lua_State *L, char **argv, int n) {
function handle_luainit (line 323) | static int handle_luainit (lua_State *L) {
type Smain (line 333) | struct Smain {
function pmain (line 340) | static int pmain (lua_State *L) {
function main (line 377) | int main (int argc, char **argv) {
FILE: deps/lua/src/lua.h
type lua_State (line 50) | typedef struct lua_State lua_State;
type LUA_NUMBER (line 99) | typedef LUA_NUMBER lua_Number;
type LUA_INTEGER (line 103) | typedef LUA_INTEGER lua_Integer;
type lua_Debug (line 326) | typedef struct lua_Debug lua_Debug;
type lua_Debug (line 346) | struct lua_Debug {
FILE: deps/lua/src/lua_cjson.c
type json_token_type_t (line 61) | typedef enum {
type json_config_t (line 96) | typedef struct {
type json_parse_t (line 117) | typedef struct {
type json_token_t (line 124) | typedef struct {
function json_config_t (line 178) | static json_config_t *json_fetch_config(lua_State *l)
function json_verify_arg_count (line 193) | static void json_verify_arg_count(lua_State *l, int args)
function json_cfg_encode_sparse_array (line 203) | static int json_cfg_encode_sparse_array(lua_State *l)
function json_cfg_encode_max_depth (line 234) | static int json_cfg_encode_max_depth(lua_State *l)
function json_set_number_precision (line 253) | static void json_set_number_precision(json_config_t *cfg, int prec)
function json_cfg_encode_number_precision (line 260) | static int json_cfg_encode_number_precision(lua_State *l)
function json_cfg_encode_keep_buffer (line 281) | static int json_cfg_encode_keep_buffer(lua_State *l)
function json_enum_option (line 301) | static void json_enum_option(lua_State *l, const char **options,
function json_cfg_refuse_invalid_numbers (line 326) | static int json_cfg_refuse_invalid_numbers(lua_State *l)
function json_destroy_config (line 342) | static int json_destroy_config(lua_State *l)
function json_create_config (line 354) | static void json_create_config(lua_State *l)
function json_encode_exception (line 452) | static void json_encode_exception(lua_State *l, json_config_t *cfg, int ...
function json_append_string (line 467) | static void json_append_string(lua_State *l, strbuf_t *json, int lindex)
function lua_array_length (line 497) | static int lua_array_length(lua_State *l, json_config_t *cfg)
function json_encode_descend (line 540) | static void json_encode_descend(lua_State *l, json_config_t *cfg)
function json_append_array (line 558) | static void json_append_array(lua_State *l, json_config_t *cfg, strbuf_t...
function json_append_number (line 584) | static void json_append_number(lua_State *l, strbuf_t *json, int index,
function json_append_object (line 600) | static void json_append_object(lua_State *l, json_config_t *cfg,
function json_append_data (line 646) | static void json_append_data(lua_State *l, json_config_t *cfg, strbuf_t ...
function json_encode (line 686) | static int json_encode(lua_State *l)
function hexdigit2int (line 722) | static int hexdigit2int(char hex)
function decode_hex4 (line 735) | static int decode_hex4(const char *hex)
function codepoint_to_utf8 (line 758) | static int codepoint_to_utf8(char *utf8, int codepoint)
function json_append_unicode_escape (line 802) | static int json_append_unicode_escape(json_parse_t *json)
function json_set_token_error (line 860) | static void json_set_token_error(json_token_t *token, json_parse_t *json,
function json_next_string_token (line 868) | static void json_next_string_token(json_parse_t *json, json_token_t *token)
function json_is_invalid_number (line 940) | static int json_is_invalid_number(json_parse_t *json)
function json_next_number_token (line 977) | static void json_next_number_token(json_parse_t *json, json_token_t *token)
function json_next_token (line 997) | static void json_next_token(json_parse_t *json, json_token_t *token)
function json_throw_parse_error (line 1077) | static void json_throw_parse_error(lua_State *l, json_parse_t *json,
function json_decode_checkstack (line 1094) | static void json_decode_checkstack(lua_State *l, json_parse_t *json, int n)
function json_parse_object_context (line 1103) | static void json_parse_object_context(lua_State *l, json_parse_t *json)
function json_parse_array_context (line 1151) | static void json_parse_array_context(lua_State *l, json_parse_t *json)
function json_process_value (line 1185) | static void json_process_value(lua_State *l, json_parse_t *json,
function lua_json_decode (line 1215) | static void lua_json_decode(lua_State *l, const char *json_text, int jso...
function json_decode (line 1241) | static int json_decode(lua_State *l)
function luaopen_cjson (line 1265) | int luaopen_cjson(lua_State *l)
FILE: deps/lua/src/lua_cmsgpack.c
function memrevifle (line 43) | static void memrevifle(void *ptr, size_t len) {
type mp_buf (line 65) | typedef struct mp_buf {
function mp_buf (line 70) | static mp_buf *mp_buf_new(void) {
function mp_buf_append (line 78) | void mp_buf_append(mp_buf *buf, const unsigned char *s, size_t len) {
function mp_buf_free (line 90) | void mp_buf_free(mp_buf *buf) {
type mp_cur (line 108) | typedef struct mp_cur {
function mp_cur (line 114) | static mp_cur *mp_cur_new(const unsigned char *s, size_t len) {
function mp_cur_free (line 123) | static void mp_cur_free(mp_cur *cursor) {
function mp_encode_bytes (line 141) | static void mp_encode_bytes(mp_buf *buf, const unsigned char *s, size_t ...
function mp_encode_double (line 166) | static void mp_encode_double(mp_buf *buf, double d) {
function mp_encode_int (line 184) | static void mp_encode_int(mp_buf *buf, int64_t n) {
function mp_encode_array (line 256) | static void mp_encode_array(mp_buf *buf, int64_t n) {
function mp_encode_map (line 279) | static void mp_encode_map(mp_buf *buf, int64_t n) {
function mp_encode_lua_string (line 304) | static void mp_encode_lua_string(lua_State *L, mp_buf *buf) {
function mp_encode_lua_bool (line 312) | static void mp_encode_lua_bool(lua_State *L, mp_buf *buf) {
function mp_encode_lua_number (line 317) | static void mp_encode_lua_number(lua_State *L, mp_buf *buf) {
function mp_encode_lua_table_as_array (line 330) | static void mp_encode_lua_table_as_array(lua_State *L, mp_buf *buf, int ...
function mp_encode_lua_table_as_map (line 342) | static void mp_encode_lua_table_as_map(lua_State *L, mp_buf *buf, int le...
function table_is_an_array (line 369) | static int table_is_an_array(lua_State *L) {
function mp_encode_lua_table (line 399) | static void mp_encode_lua_table(lua_State *L, mp_buf *buf, int level) {
function mp_encode_lua_null (line 406) | static void mp_encode_lua_null(lua_State *L, mp_buf *buf) {
function mp_encode_lua_type (line 413) | static void mp_encode_lua_type(lua_State *L, mp_buf *buf, int level) {
function mp_pack (line 429) | static int mp_pack(lua_State *L) {
function mp_decode_to_lua_array (line 442) | void mp_decode_to_lua_array(lua_State *L, mp_cur *c, size_t len) {
function mp_decode_to_lua_hash (line 454) | void mp_decode_to_lua_hash(lua_State *L, mp_cur *c, size_t len) {
function mp_decode_to_lua_type (line 467) | void mp_decode_to_lua_type(lua_State *L, mp_cur *c) {
function mp_unpack (line 657) | static int mp_unpack(lua_State *L) {
type luaL_reg (line 690) | struct luaL_reg
function LUALIB_API (line 696) | LUALIB_API int luaopen_cmsgpack (lua_State *L) {
FILE: deps/lua/src/lua_struct.c
type STRUCT_INT (line 52) | typedef STRUCT_INT Inttype;
type Uinttype (line 55) | typedef unsigned STRUCT_INT Uinttype;
type cD (line 65) | struct cD {
type Header (line 86) | typedef struct Header {
function getnum (line 92) | static int getnum (const char **fmt, int df) {
function optsize (line 109) | static size_t optsize (lua_State *L, char opt, const char **fmt) {
function gettoalign (line 135) | static int gettoalign (size_t len, Header *h, int opt, size_t size) {
function controloptions (line 146) | static void controloptions (lua_State *L, int opt, const char **fmt,
function putinteger (line 167) | static void putinteger (lua_State *L, luaL_Buffer *b, int arg, int endian,
function correctbytes (line 194) | static void correctbytes (char *b, int size, int endian) {
function b_pack (line 206) | static int b_pack (lua_State *L) {
function lua_Number (line 264) | static lua_Number getinteger (const char *buff, int endian,
function b_unpack (line 291) | static int b_unpack (lua_State *L) {
function b_size (line 358) | static int b_size (lua_State *L) {
type luaL_Reg (line 383) | struct luaL_Reg
function LUALIB_API (line 393) | LUALIB_API int luaopen_struct (lua_State *L) {
FILE: deps/lua/src/luac.c
function fatal (line 36) | static void fatal(const char* message)
function cannot (line 42) | static void cannot(const char* what)
function usage (line 48) | static void usage(const char* message)
function doargs (line 70) | static int doargs(int argc, char* argv[])
function Proto (line 119) | static const Proto* combine(lua_State* L, int n)
function writer (line 147) | static int writer(lua_State* L, const void* p, size_t size, void* u)
type Smain (line 153) | struct Smain {
function pmain (line 158) | static int pmain(lua_State* L)
function main (line 186) | int main(int argc, char* argv[])
FILE: deps/lua/src/lundump.c
type LoadState (line 23) | typedef struct {
function error (line 36) | static void error(LoadState* S, const char* why)
function LoadBlock (line 48) | static void LoadBlock(LoadState* S, void* b, size_t size)
function LoadChar (line 54) | static int LoadChar(LoadState* S)
function LoadInt (line 61) | static int LoadInt(LoadState* S)
function lua_Number (line 69) | static lua_Number LoadNumber(LoadState* S)
function TString (line 76) | static TString* LoadString(LoadState* S)
function LoadCode (line 90) | static void LoadCode(LoadState* S, Proto* f)
function LoadConstants (line 100) | static void LoadConstants(LoadState* S, Proto* f)
function LoadDebug (line 137) | static void LoadDebug(LoadState* S, Proto* f)
function Proto (line 161) | static Proto* LoadFunction(LoadState* S, TString* p)
function LoadHeader (line 183) | static void LoadHeader(LoadState* S)
function Proto (line 195) | Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name)
function luaU_header (line 214) | void luaU_header (char* h)
FILE: deps/lua/src/lvm.c
function TValue (line 35) | const TValue *luaV_tonumber (const TValue *obj, TValue *n) {
function luaV_tostring (line 47) | int luaV_tostring (lua_State *L, StkId obj) {
function traceexec (line 60) | static void traceexec (lua_State *L, const Instruction *pc) {
function callTMres (line 80) | static void callTMres (lua_State *L, StkId res, const TValue *f,
function callTM (line 96) | static void callTM (lua_State *L, const TValue *f, const TValue *p1,
function luaV_gettable (line 108) | void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId va...
function luaV_settable (line 134) | void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId va...
function call_binTM (line 165) | static int call_binTM (lua_State *L, const TValue *p1, const TValue *p2,
function TValue (line 176) | static const TValue *get_compTM (lua_State *L, Table *mt1, Table *mt2,
function call_orderTM (line 190) | static int call_orderTM (lua_State *L, const TValue *p1, const TValue *p2,
function l_strcmp (line 203) | static int l_strcmp (const TString *ls, const TString *rs) {
function luaV_lessthan (line 225) | int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) {
function lessequal (line 239) | static int lessequal (lua_State *L, const TValue *l, const TValue *r) {
function luaV_equalval (line 255) | int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2) {
function luaV_concat (line 282) | void luaV_concat (lua_State *L, int total, int last) {
function Arith (line 317) | static void Arith (lua_State *L, StkId ra, const TValue *rb,
function luaV_execute (line 377) | void luaV_execute (lua_State *L, int nexeccalls) {
FILE: deps/lua/src/lzio.c
function luaZ_fill (line 21) | int luaZ_fill (ZIO *z) {
function luaZ_lookahead (line 35) | int luaZ_lookahead (ZIO *z) {
function luaZ_init (line 48) | void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) {
function luaZ_read (line 58) | size_t luaZ_read (ZIO *z, void *b, size_t n) {
FILE: deps/lua/src/lzio.h
type ZIO (line 18) | typedef struct Zio ZIO;
type Mbuffer (line 24) | typedef struct Mbuffer {
type Zio (line 56) | struct Zio {
FILE: deps/lua/src/print.c
function PrintString (line 23) | static void PrintString(const TString* ts)
function PrintConstant (line 51) | static void PrintConstant(const Proto* f, int i)
function PrintCode (line 74) | static void PrintCode(const Proto* f)
function PrintHeader (line 161) | static void PrintHeader(const Proto* f)
function PrintConstants (line 181) | static void PrintConstants(const Proto* f)
function PrintLocals (line 193) | static void PrintLocals(const Proto* f)
function PrintUpvalues (line 204) | static void PrintUpvalues(const Proto* f)
function PrintFunction (line 215) | void PrintFunction(const Proto* f, int full)
FILE: deps/lua/src/strbuf.c
function die (line 32) | void die(const char *fmt, ...)
function strbuf_init (line 44) | void strbuf_init(strbuf_t *s, int len)
function strbuf_t (line 68) | strbuf_t *strbuf_new(int len)
function strbuf_set_increment (line 84) | void strbuf_set_increment(strbuf_t *s, int increment)
function debug_stats (line 94) | static inline void debug_stats(strbuf_t *s)
function strbuf_free (line 104) | void strbuf_free(strbuf_t *s)
function calculate_new_size (line 134) | static int calculate_new_size(strbuf_t *s, int len)
function strbuf_resize (line 164) | void strbuf_resize(strbuf_t *s, int len)
function strbuf_append_string (line 182) | void strbuf_append_string(strbuf_t *s, const char *str)
function strbuf_append_fmt (line 202) | void strbuf_append_fmt(strbuf_t *s, int len, const char *fmt, ...)
function strbuf_append_fmt_retry (line 221) | void strbuf_append_fmt_retry(strbuf_t *s, const char *fmt, ...)
FILE: deps/lua/src/strbuf.h
type strbuf_t (line 34) | typedef struct {
function strbuf_reset (line 76) | static inline void strbuf_reset(strbuf_t *s)
function strbuf_allocated (line 81) | static inline int strbuf_allocated(strbuf_t *s)
function strbuf_empty_length (line 88) | static inline int strbuf_empty_length(strbuf_t *s)
function strbuf_ensure_empty_length (line 93) | static inline void strbuf_ensure_empty_length(strbuf_t *s, int len)
function strbuf_length (line 99) | static inline int strbuf_length(strbuf_t *s)
function strbuf_append_char (line 104) | static inline void strbuf_append_char(strbuf_t *s, const char c)
function strbuf_append_char_unsafe (line 110) | static inline void strbuf_append_char_unsafe(strbuf_t *s, const char c)
function strbuf_append_mem (line 115) | static inline void strbuf_append_mem(strbuf_t *s, const char *c, int len)
function strbuf_append_mem_unsafe (line 122) | static inline void strbuf_append_mem_unsafe(strbuf_t *s, const char *c, ...
function strbuf_ensure_null (line 128) | static inline void strbuf_ensure_null(strbuf_t *s)
FILE: src/adlist.c
function list (line 48) | list *listCreate(void)
function listRelease (line 74) | void listRelease(list *list)
function list (line 114) | list *listAddNodeHead(list *list, void *value)
function list (line 158) | list *listAddNodeTail(list *list, void *value)
function list (line 195) | list *listInsertNode(list *list, listNode *old_node, void *value, int af...
function listDelNode (line 249) | void listDelNode(list *list, listNode *node)
function listIter (line 287) | listIter *listGetIterator(list *list, int direction)
function listReleaseIterator (line 311) | void listReleaseIterator(listIter *iter) {
function listRewind (line 322) | void listRewind(list *list, listIter *li) {
function listRewindTail (line 333) | void listRewindTail(list *list, listIter *li) {
function listNode (line 366) | listNode *listNext(listIter *iter)
function list (line 404) | list *listDup(list *orig)
function listNode (line 471) | listNode *listSearchKey(list *list, void *key)
function listNode (line 516) | listNode *listIndex(list *list, long index) {
function listRotate (line 539) | void listRotate(list *list) {
FILE: src/adlist.h
type listNode (line 39) | typedef struct listNode {
type listIter (line 55) | typedef struct listIter {
type list (line 68) | typedef struct list {
FILE: src/ae.c
function aeEventLoop (line 66) | aeEventLoop *aeCreateEventLoop(int setsize) {
function aeGetSetSize (line 111) | int aeGetSetSize(aeEventLoop *eventLoop) {
function aeResizeSetSize (line 131) | int aeResizeSetSize(aeEventLoop *eventLoop, int setsize) {
function aeDeleteEventLoop (line 152) | void aeDeleteEventLoop(aeEventLoop *eventLoop) {
function aeStop (line 162) | void aeStop(aeEventLoop *eventLoop) {
function aeCreateFileEvent (line 170) | int aeCreateFileEvent(aeEventLoop *eventLoop, int fd, int mask,
function aeDeleteFileEvent (line 205) | void aeDeleteFileEvent(aeEventLoop *eventLoop, int fd, int mask)
function aeGetFileEvents (line 233) | int aeGetFileEvents(aeEventLoop *eventLoop, int fd) {
function aeGetTime (line 244) | static void aeGetTime(long *seconds, long *milliseconds)
function aeAddMillisecondsToNow (line 257) | static void aeAddMillisecondsToNow(long long milliseconds, long *sec, lo...
function aeCreateTimeEvent (line 283) | long long aeCreateTimeEvent(aeEventLoop *eventLoop, long long milliseconds,
function aeDeleteTimeEvent (line 317) | int aeDeleteTimeEvent(aeEventLoop *eventLoop, long long id)
function aeTimeEvent (line 362) | static aeTimeEvent *aeSearchNearestTimer(aeEventLoop *eventLoop)
function processTimeEvents (line 381) | static int processTimeEvents(aeEventLoop *eventLoop) {
function aeProcessEvents (line 498) | int aeProcessEvents(aeEventLoop *eventLoop, int flags)
function aeWait (line 601) | int aeWait(int fd, int mask, long long milliseconds) {
function aeMain (line 624) | void aeMain(aeEventLoop *eventLoop) {
function aeSetBeforeSleepProc (line 649) | void aeSetBeforeSleepProc(aeEventLoop *eventLoop, aeBeforeSleepProc *bef...
FILE: src/ae.h
type aeEventLoop (line 77) | struct aeEventLoop
type aeEventLoop (line 83) | struct aeEventLoop
type aeEventLoop (line 84) | struct aeEventLoop
type aeEventLoop (line 85) | struct aeEventLoop
type aeEventLoop (line 86) | struct aeEventLoop
type aeFileEvent (line 92) | typedef struct aeFileEvent {
type aeTimeEvent (line 114) | typedef struct aeTimeEvent {
type aeFiredEvent (line 141) | typedef struct aeFiredEvent {
type aeEventLoop (line 157) | typedef struct aeEventLoop {
FILE: src/ae_epoll.c
type aeApiState (line 37) | typedef struct aeApiState {
function aeApiCreate (line 50) | static int aeApiCreate(aeEventLoop *eventLoop) {
function aeApiResize (line 79) | static int aeApiResize(aeEventLoop *eventLoop, int setsize) {
function aeApiFree (line 89) | static void aeApiFree(aeEventLoop *eventLoop) {
function aeApiAddEvent (line 100) | static int aeApiAddEvent(aeEventLoop *eventLoop, int fd, int mask) {
function aeApiDelEvent (line 130) | static void aeApiDelEvent(aeEventLoop *eventLoop, int fd, int delmask) {
function aeApiPoll (line 153) | static int aeApiPoll(aeEventLoop *eventLoop, struct timeval *tvp) {
FILE: src/ae_evport.c
type aeApiState (line 68) | typedef struct aeApiState {
function aeApiCreate (line 75) | static int aeApiCreate(aeEventLoop *eventLoop) {
function aeApiResize (line 97) | static int aeApiResize(aeEventLoop *eventLoop, int setsize) {
function aeApiFree (line 102) | static void aeApiFree(aeEventLoop *eventLoop) {
function aeApiLookupPending (line 109) | static int aeApiLookupPending(aeApiState *state, int fd) {
function aeApiAssociate (line 123) | static int aeApiAssociate(const char *where, int portfd, int fd, int mas...
function aeApiAddEvent (line 152) | static int aeApiAddEvent(aeEventLoop *eventLoop, int fd, int mask) {
function aeApiDelEvent (line 183) | static void aeApiDelEvent(aeEventLoop *eventLoop, int fd, int mask) {
function aeApiPoll (line 243) | static int aeApiPoll(aeEventLoop *eventLoop, struct timeval *tvp) {
FILE: src/ae_kqueue.c
type aeApiState (line 36) | typedef struct aeApiState {
function aeApiCreate (line 41) | static int aeApiCreate(aeEventLoop *eventLoop) {
function aeApiResize (line 60) | static int aeApiResize(aeEventLoop *eventLoop, int setsize) {
function aeApiFree (line 67) | static void aeApiFree(aeEventLoop *eventLoop) {
function aeApiAddEvent (line 75) | static int aeApiAddEvent(aeEventLoop *eventLoop, int fd, int mask) {
function aeApiDelEvent (line 90) | static void aeApiDelEvent(aeEventLoop *eventLoop, int fd, int mask) {
function aeApiPoll (line 104) | static int aeApiPoll(aeEventLoop *eventLoop, struct timeval *tvp) {
FILE: src/ae_select.c
type aeApiState (line 34) | typedef struct aeApiState {
function aeApiCreate (line 41) | static int aeApiCreate(aeEventLoop *eventLoop) {
function aeApiResize (line 51) | static int aeApiResize(aeEventLoop *eventLoop, int setsize) {
function aeApiFree (line 57) | static void aeApiFree(aeEventLoop *eventLoop) {
function aeApiAddEvent (line 61) | static int aeApiAddEvent(aeEventLoop *eventLoop, int fd, int mask) {
function aeApiDelEvent (line 69) | static void aeApiDelEvent(aeEventLoop *eventLoop, int fd, int mask) {
function aeApiPoll (line 76) | static int aeApiPoll(aeEventLoop *eventLoop, struct timeval *tvp) {
FILE: src/anet.c
function anetSetError (line 53) | static void anetSetError(char *err, const char *fmt, ...)
function anetNonBlock (line 66) | int anetNonBlock(char *err, int fd)
function anetKeepAlive (line 90) | int anetKeepAlive(char *err, int fd, int interval)
function anetSetTcpNoDelay (line 137) | static int anetSetTcpNoDelay(char *err, int fd, int val)
function anetEnableTcpNoDelay (line 150) | int anetEnableTcpNoDelay(char *err, int fd)
function anetDisableTcpNoDelay (line 158) | int anetDisableTcpNoDelay(char *err, int fd)
function anetSetSendBuffer (line 166) | int anetSetSendBuffer(char *err, int fd, int buffsize)
function anetTcpKeepAlive (line 179) | int anetTcpKeepAlive(char *err, int fd)
function anetGenericResolve (line 197) | int anetGenericResolve(char *err, char *host, char *ipbuf, size_t ipbuf_...
function anetResolve (line 224) | int anetResolve(char *err, char *host, char *ipbuf, size_t ipbuf_len) {
function anetResolveIP (line 228) | int anetResolveIP(char *err, char *host, char *ipbuf, size_t ipbuf_len) {
function anetSetReuseAddr (line 233) | static int anetSetReuseAddr(char *err, int fd) {
function anetCreateSocket (line 247) | static int anetCreateSocket(char *err, int domain) {
function anetTcpGenericConnect (line 266) | static int anetTcpGenericConnect(char *err, char *addr, int port,
function anetTcpConnect (line 339) | int anetTcpConnect(char *err, char *addr, int port)
function anetTcpNonBlockConnect (line 347) | int anetTcpNonBlockConnect(char *err, char *addr, int port)
function anetTcpNonBlockBindConnect (line 352) | int anetTcpNonBlockBindConnect(char *err, char *addr, int port, char *so...
function anetUnixGenericConnect (line 357) | int anetUnixGenericConnect(char *err, char *path, int flags)
function anetUnixConnect (line 386) | int anetUnixConnect(char *err, char *path)
function anetUnixNonBlockConnect (line 394) | int anetUnixNonBlockConnect(char *err, char *path)
function anetRead (line 404) | int anetRead(int fd, char *buf, int count)
function anetWrite (line 422) | int anetWrite(int fd, char *buf, int count)
function anetListen (line 438) | static int anetListen(char *err, int s, struct sockaddr *sa, socklen_t l...
function anetV6Only (line 453) | static int anetV6Only(char *err, int s) {
function _anetTcpServer (line 463) | static int _anetTcpServer(char *err, int port, char *bindaddr, int af, i...
function anetTcpServer (line 500) | int anetTcpServer(char *err, int port, char *bindaddr, int backlog)
function anetTcp6Server (line 505) | int anetTcp6Server(char *err, int port, char *bindaddr, int backlog)
function anetUnixServer (line 513) | int anetUnixServer(char *err, char *path, mode_t perm, int backlog)
function anetGenericAccept (line 531) | static int anetGenericAccept(char *err, int s, struct sockaddr *sa, sock...
function anetTcpAccept (line 551) | int anetTcpAccept(char *err, int s, char *ip, size_t ip_len, int *port) {
function anetUnixAccept (line 573) | int anetUnixAccept(char *err, int s) {
function anetPeerToString (line 586) | int anetPeerToString(int fd, char *ip, size_t ip_len, int *port) {
function anetSockName (line 611) | int anetSockName(int fd, char *ip, size_t ip_len, int *port) {
FILE: src/aof.c
type aofrwblock (line 72) | typedef struct aofrwblock {
function aofRewriteBufferReset (line 90) | void aofRewriteBufferReset(void) {
function aofRewriteBufferSize (line 105) | unsigned long aofRewriteBufferSize(void) {
function aofRewriteBufferAppend (line 127) | void aofRewriteBufferAppend(unsigned char *s, unsigned long len) {
function aofRewriteBufferWrite (line 188) | ssize_t aofRewriteBufferWrite(int fd) {
function aof_background_fsync (line 225) | void aof_background_fsync(int fd) {
function stopAppendOnly (line 234) | void stopAppendOnly(void) {
function startAppendOnly (line 285) | int startAppendOnly(void) {
function flushAppendOnlyFile (line 358) | void flushAppendOnlyFile(int force) {
function sds (line 578) | sds catAppendOnlyGenericCommand(sds dst, int argc, robj **argv) {
function sds (line 630) | sds catAppendOnlyExpireAtCommand(sds buf, struct redisCommand *cmd, robj...
function feedAppendOnlyFile (line 681) | void feedAppendOnlyFile(struct redisCommand *cmd, int dictid, robj **arg...
type redisClient (line 771) | struct redisClient
type redisClient (line 772) | struct redisClient
function freeFakeClient (line 806) | void freeFakeClient(struct redisClient *c) {
function loadAppendOnlyFile (line 835) | int loadAppendOnlyFile(char *filename) {
function rioWriteBulkObject (line 1014) | int rioWriteBulkObject(rio *r, robj *obj) {
function rewriteListObject (line 1035) | int rewriteListObject(rio *r, robj *key, robj *o) {
function rewriteSetObject (line 1112) | int rewriteSetObject(rio *r, robj *key, robj *o) {
function rewriteSortedSetObject (line 1166) | int rewriteSortedSetObject(rio *r, robj *key, robj *o) {
function rioWriteHashIteratorCursor (line 1250) | static int rioWriteHashIteratorCursor(rio *r, hashTypeIterator *hi, int ...
function rewriteHashObject (line 1284) | int rewriteHashObject(rio *r, robj *key, robj *o) {
function rewriteAppendOnlyFile (line 1328) | int rewriteAppendOnlyFile(char *filename) {
function rewriteAppendOnlyFileBackground (line 1510) | int rewriteAppendOnlyFileBackground(void) {
function bgrewriteaofCommand (line 1586) | void bgrewriteaofCommand(redisClient *c) {
function aofRemoveTempFile (line 1610) | void aofRemoveTempFile(pid_t childpid) {
function aofUpdateCurrentSize (line 1626) | void aofUpdateCurrentSize(void) {
function backgroundRewriteDoneHandler (line 1644) | void backgroundRewriteDoneHandler(int exitcode, int bysignal) {
FILE: src/bio.c
type bio_job (line 113) | struct bio_job {
function bioInit (line 139) | void bioInit(void) {
function bioCreateBackgroundJob (line 185) | void bioCreateBackgroundJob(int type, void *arg1, void *arg2, void *arg3) {
type bio_job (line 208) | struct bio_job
function bioPendingJobsOfType (line 273) | unsigned long long bioPendingJobsOfType(int type) {
function bioKillThreads (line 291) | void bioKillThreads(void) {
FILE: src/bitops.c
function getBitOffsetFromArgument (line 42) | static int getBitOffsetFromArgument(redisClient *c, robj *o, size_t *off...
function redisPopcount (line 65) | size_t redisPopcount(void *s, long count) {
function redisBitpos (line 123) | long redisBitpos(void *s, long count, int bit) {
function setbitCommand (line 213) | void setbitCommand(redisClient *c) {
function getbitCommand (line 287) | void getbitCommand(redisClient *c) {
function bitopCommand (line 323) | void bitopCommand(redisClient *c) {
function bitcountCommand (line 530) | void bitcountCommand(redisClient *c) {
function bitposCommand (line 589) | void bitposCommand(redisClient *c) {
FILE: src/blocked.c
function getTimeoutFromObjectOrReply (line 75) | int getTimeoutFromObjectOrReply(redisClient *c, robj *object, mstime_t *...
function blockClient (line 100) | void blockClient(redisClient *c, int btype) {
function processUnblockedClients (line 110) | void processUnblockedClients(void) {
function unblockClient (line 134) | void unblockClient(redisClient *c) {
function replyToBlockedClientTimedOut (line 154) | void replyToBlockedClientTimedOut(redisClient *c) {
FILE: src/cluster.c
function clusterGetMaxEpoch (line 82) | uint64_t clusterGetMaxEpoch(void) {
function clusterLoadConfig (line 105) | int clusterLoadConfig(char *filename) {
function clusterSaveConfig (line 349) | int clusterSaveConfig(int do_fsync) {
function clusterSaveConfigOrDie (line 397) | void clusterSaveConfigOrDie(int do_fsync) {
function clusterLockConfig (line 413) | int clusterLockConfig(char *filename) {
function clusterInit (line 445) | void clusterInit(void) {
function clusterReset (line 534) | void clusterReset(int hard) {
function clusterLink (line 590) | clusterLink *createClusterLink(clusterNode *node) {
function freeClusterLink (line 605) | void freeClusterLink(clusterLink *link) {
function clusterAcceptHandler (line 630) | void clusterAcceptHandler(aeEventLoop *el, int fd, void *privdata, int m...
function keyHashSlot (line 678) | unsigned int keyHashSlot(char *key, int keylen) {
function clusterNode (line 721) | clusterNode *createClusterNode(char *nodename, int flags) {
function clusterNodeAddFailureReport (line 776) | int clusterNodeAddFailureReport(clusterNode *failing, clusterNode *sende...
function clusterNodeCleanupFailureReports (line 824) | void clusterNodeCleanupFailureReports(clusterNode *node) {
function clusterNodeDelFailureReport (line 873) | int clusterNodeDelFailureReport(clusterNode *node, clusterNode *sender) {
function clusterNodeFailureReportsCount (line 905) | int clusterNodeFailureReportsCount(clusterNode *node) {
function clusterNodeRemoveSlave (line 915) | int clusterNodeRemoveSlave(clusterNode *master, clusterNode *slave) {
function clusterNodeAddSlave (line 932) | int clusterNodeAddSlave(clusterNode *master, clusterNode *slave) {
function clusterNodeResetSlaves (line 950) | void clusterNodeResetSlaves(clusterNode *n) {
function clusterCountNonFailingSlaves (line 956) | int clusterCountNonFailingSlaves(clusterNode *n) {
function freeClusterNode (line 965) | void freeClusterNode(clusterNode *n) {
function clusterAddNode (line 989) | int clusterAddNode(clusterNode *node) {
function clusterDelNode (line 1013) | void clusterDelNode(clusterNode *delnode) {
function clusterNode (line 1054) | clusterNode *clusterLookupNode(char *name) {
function clusterRenameNode (line 1075) | void clusterRenameNode(clusterNode *node, char *newname) {
function clusterBlacklistCleanup (line 1146) | void clusterBlacklistCleanup(void) {
function clusterBlacklistAddNode (line 1164) | void clusterBlacklistAddNode(clusterNode *node) {
function clusterBlacklistExists (line 1188) | int clusterBlacklistExists(char *nodeid) {
function markNodeAsFailingIfNeeded (line 1252) | void markNodeAsFailingIfNeeded(clusterNode *node) {
function clearNodeFailureIfNeeded (line 1294) | void clearNodeFailureIfNeeded(clusterNode *node) {
function clusterHandshakeInProgress (line 1351) | int clusterHandshakeInProgress(char *ip, int port) {
function clusterStartHandshake (line 1386) | int clusterStartHandshake(char *ip, int port) {
function clusterProcessGossipSection (line 1456) | void clusterProcessGossipSection(clusterMsg *hdr, clusterLink *link) {
function nodeIp2String (line 1575) | void nodeIp2String(char *buf, clusterLink *link) {
function nodeUpdateAddressIfNeeded (line 1599) | int nodeUpdateAddressIfNeeded(clusterNode *node, clusterLink *link, int ...
function clusterSetNodeAsMaster (line 1640) | void clusterSetNodeAsMaster(clusterNode *n) {
function clusterUpdateSlotsConfigWith (line 1685) | void clusterUpdateSlotsConfigWith(clusterNode *sender, uint64_t senderCo...
function clusterHandleConfigEpochCollision (line 1847) | void clusterHandleConfigEpochCollision(clusterNode *sender) {
function clusterProcessPacket (line 1881) | int clusterProcessPacket(clusterLink *link) {
function handleLinkIOError (line 2479) | void handleLinkIOError(clusterLink *link) {
function clusterWriteHandler (line 2489) | void clusterWriteHandler(aeEventLoop *el, int fd, void *privdata, int ma...
function clusterReadHandler (line 2522) | void clusterReadHandler(aeEventLoop *el, int fd, void *privdata, int mas...
function clusterSendMessage (line 2609) | void clusterSendMessage(clusterLink *link, unsigned char *msg, size_t ms...
function clusterBroadcastMessage (line 2631) | void clusterBroadcastMessage(void *buf, size_t len) {
function clusterBuildMessageHdr (line 2655) | void clusterBuildMessageHdr(clusterMsg *hdr, int type) {
function clusterSendPing (line 2746) | void clusterSendPing(clusterLink *link, int type) {
function clusterBroadcastPong (line 2876) | void clusterBroadcastPong(int target) {
function clusterSendPublish (line 2908) | void clusterSendPublish(clusterLink *link, robj *channel, robj *message) {
function clusterSendFail (line 2974) | void clusterSendFail(char *nodename) {
function clusterSendUpdate (line 2995) | void clusterSendUpdate(clusterLink *link, clusterNode *node) {
function clusterPropagatePublish (line 3025) | void clusterPropagatePublish(robj *channel, robj *message) {
function clusterRequestFailoverAuth (line 3045) | void clusterRequestFailoverAuth(void) {
function clusterSendFailoverAuth (line 3065) | void clusterSendFailoverAuth(clusterNode *node) {
function clusterSendMFStart (line 3079) | void clusterSendMFStart(clusterNode *node) {
function clusterSendFailoverAuthIfNeeded (line 3093) | void clusterSendFailoverAuthIfNeeded(clusterNode *node, clusterMsg *requ...
function clusterGetSlaveRank (line 3181) | int clusterGetSlaveRank(void) {
function clusterHandleSlaveFailover (line 3214) | void clusterHandleSlaveFailover(void) {
function clusterHandleSlaveMigration (line 3448) | void clusterHandleSlaveMigration(int max_slaves) {
function resetManualFailover (line 3547) | void resetManualFailover(void) {
function manualFailoverCheckTimeout (line 3559) | void manualFailoverCheckTimeout(void) {
function clusterHandleManualFailover (line 3568) | void clusterHandleManualFailover(void) {
function clusterCron (line 3594) | void clusterCron(void) {
function clusterBeforeSleep (line 3885) | void clusterBeforeSleep(void) {
function clusterDoBeforeSleep (line 3913) | void clusterDoBeforeSleep(int flags) {
function bitmapTestBit (line 3925) | int bitmapTestBit(unsigned char *bitmap, int pos) {
function bitmapSetBit (line 3933) | void bitmapSetBit(unsigned char *bitmap, int pos) {
function bitmapClearBit (line 3941) | void bitmapClearBit(unsigned char *bitmap, int pos) {
function clusterNodeSetSlotBit (line 3949) | int clusterNodeSetSlotBit(clusterNode *n, int slot) {
function clusterNodeClearSlotBit (line 3958) | int clusterNodeClearSlotBit(clusterNode *n, int slot) {
function clusterNodeGetSlotBit (line 3967) | int clusterNodeGetSlotBit(clusterNode *n, int slot) {
function clusterAddSlot (line 3978) | int clusterAddSlot(clusterNode *n, int slot) {
function clusterDelSlot (line 4002) | int clusterDelSlot(int slot) {
function clusterDelNodeSlots (line 4021) | int clusterDelNodeSlots(clusterNode *node) {
function clusterCloseAllSlots (line 4036) | void clusterCloseAllSlots(void) {
function clusterUpdateState (line 4056) | void clusterUpdateState(void) {
function verifyClusterConfigWithData (line 4186) | int verifyClusterConfigWithData(void) {
function clusterSetMaster (line 4249) | void clusterSetMaster(clusterNode *n) {
function sds (line 4280) | sds clusterGenNodeDescription(clusterNode *node) {
function sds (line 4375) | sds clusterGenNodesDescription(int filter) {
function getSlotOrReply (line 4399) | int getSlotOrReply(redisClient *c, robj *o) {
function clusterCommand (line 4412) | void clusterCommand(redisClient *c) {
function createDumpPayload (line 5019) | void createDumpPayload(rio *payload, robj *o) {
function verifyDumpPayload (line 5078) | int verifyDumpPayload(unsigned char *p, size_t len) {
function dumpCommand (line 5107) | void dumpCommand(redisClient *c) {
function restoreCommand (line 5133) | void restoreCommand(redisClient *c) {
type migrateCachedSocket (line 5220) | typedef struct migrateCachedSocket {
function migrateGetSocket (line 5251) | int migrateGetSocket(redisClient *c, robj *host, robj *port, long timeou...
function migrateCloseSocket (line 5319) | void migrateCloseSocket(robj *host, robj *port) {
function migrateCloseTimedoutSockets (line 5344) | void migrateCloseTimedoutSockets(void) {
function migrateCommand (line 5363) | void migrateCommand(redisClient *c) {
function askingCommand (line 5552) | void askingCommand(redisClient *c) {
function readonlyCommand (line 5568) | void readonlyCommand(redisClient *c) {
function readwriteCommand (line 5578) | void readwriteCommand(redisClient *c) {
function clusterNode (line 5607) | clusterNode *getNodeByQuery(redisClient *c, struct redisCommand *cmd, ro...
FILE: src/cluster.h
type clusterNode (line 58) | struct clusterNode
type clusterLink (line 63) | typedef struct clusterLink {
type clusterNodeFailReport (line 117) | struct clusterNodeFailReport {
type clusterNode (line 130) | struct clusterNode {
type clusterNode (line 198) | typedef struct clusterNode clusterNode;
type clusterState (line 205) | typedef struct clusterState {
type clusterMsgDataGossip (line 339) | typedef struct {
type clusterMsgDataFail (line 366) | typedef struct {
type clusterMsgDataPublish (line 373) | typedef struct {
type clusterMsgDataUpdate (line 388) | typedef struct {
type clusterMsg (line 428) | typedef struct {
type redisCommand (line 494) | struct redisCommand
FILE: src/config.c
function yesnotoi (line 63) | int yesnotoi(char *s) {
function appendServerSaveParams (line 69) | void appendServerSaveParams(time_t seconds, int changes) {
function resetServerSaveParams (line 76) | void resetServerSaveParams() {
function loadServerConfigFromString (line 82) | void loadServerConfigFromString(char *config) {
function loadServerConfig (line 556) | void loadServerConfig(char *filename, char *options) {
function configSetCommand (line 596) | void configSetCommand(redisClient *c) {
function configGetCommand (line 968) | void configGetCommand(redisClient *c) {
type rewriteConfigState (line 1197) | struct rewriteConfigState
type rewriteConfigState (line 1218) | struct rewriteConfigState {
function rewriteConfigAppendLine (line 1228) | void rewriteConfigAppendLine(struct rewriteConfigState *state, sds line) {
function rewriteConfigAddLineNumberToOption (line 1234) | void rewriteConfigAddLineNumberToOption(struct rewriteConfigState *state...
function rewriteConfigMarkAsProcessed (line 1248) | void rewriteConfigMarkAsProcessed(struct rewriteConfigState *state, char...
type rewriteConfigState (line 1259) | struct rewriteConfigState
type rewriteConfigState (line 1261) | struct rewriteConfigState
function rewriteConfigRewriteLine (line 1332) | void rewriteConfigRewriteLine(struct rewriteConfigState *state, char *op...
function rewriteConfigFormatMemory (line 1369) | int rewriteConfigFormatMemory(char *buf, size_t len, long long bytes) {
function rewriteConfigBytesOption (line 1386) | void rewriteConfigBytesOption(struct rewriteConfigState *state, char *op...
function rewriteConfigYesNoOption (line 1397) | void rewriteConfigYesNoOption(struct rewriteConfigState *state, char *op...
function rewriteConfigStringOption (line 1406) | void rewriteConfigStringOption(struct rewriteConfigState *state, char *o...
function rewriteConfigNumericalOption (line 1428) | void rewriteConfigNumericalOption(struct rewriteConfigState *state, char...
function rewriteConfigOctalOption (line 1436) | void rewriteConfigOctalOption(struct rewriteConfigState *state, char *op...
function rewriteConfigEnumOption (line 1446) | void rewriteConfigEnumOption(struct rewriteConfigState *state, char *opt...
function rewriteConfigSyslogfacilityOption (line 1470) | void rewriteConfigSyslogfacilityOption(struct rewriteConfigState *state) {
function rewriteConfigSaveOption (line 1487) | void rewriteConfigSaveOption(struct rewriteConfigState *state) {
function rewriteConfigDirOption (line 1504) | void rewriteConfigDirOption(struct rewriteConfigState *state) {
function rewriteConfigSlaveofOption (line 1515) | void rewriteConfigSlaveofOption(struct rewriteConfigState *state) {
function rewriteConfigNotifykeyspaceeventsOption (line 1532) | void rewriteConfigNotifykeyspaceeventsOption(struct rewriteConfigState *...
function rewriteConfigClientoutputbufferlimitOption (line 1546) | void rewriteConfigClientoutputbufferlimitOption(struct rewriteConfigStat...
function rewriteConfigBindOption (line 1573) | void rewriteConfigBindOption(struct rewriteConfigState *state) {
function sds (line 1596) | sds rewriteConfigGetContentFromState(struct rewriteConfigState *state) {
function rewriteConfigReleaseState (line 1615) | void rewriteConfigReleaseState(struct rewriteConfigState *state) {
function rewriteConfigRemoveOrphaned (line 1630) | void rewriteConfigRemoveOrphaned(struct rewriteConfigState *state) {
function rewriteConfigOverwriteFile (line 1669) | int rewriteConfigOverwriteFile(char *configfile, sds content) {
function rewriteConfig (line 1722) | int rewriteConfig(char *path) {
function configCommand (line 1834) | void configCommand(redisClient *c) {
FILE: src/crc16.c
function crc16 (line 82) | uint16_t crc16(const char *buf, int len) {
FILE: src/crc64.c
function crc64 (line 173) | uint64_t crc64(uint64_t crc, const unsigned char *s, uint64_t l) {
function main (line 186) | int main(void) {
FILE: src/db.c
function robj (line 49) | robj *lookupKey(redisDb *db, robj *key) {
function robj (line 85) | robj *lookupKeyRead(redisDb *db, robj *key) {
function robj (line 111) | robj *lookupKeyWrite(redisDb *db, robj *key) {
function robj (line 127) | robj *lookupKeyReadOrReply(redisClient *c, robj *key, robj *reply) {
function robj (line 146) | robj *lookupKeyWriteOrReply(redisClient *c, robj *key, robj *reply) {
function dbAdd (line 166) | void dbAdd(redisDb *db, robj *key, robj *val) {
function dbOverwrite (line 196) | void dbOverwrite(redisDb *db, robj *key, robj *val) {
function setKey (line 222) | void setKey(redisDb *db, robj *key, robj *val) {
function dbExists (line 243) | int dbExists(redisDb *db, robj *key) {
function robj (line 258) | robj *dbRandomKey(redisDb *db) {
function dbDelete (line 295) | int dbDelete(redisDb *db, robj *key) {
function robj (line 340) | robj *dbUnshareStringValue(redisDb *db, robj *key, robj *o) {
function emptyDb (line 354) | long long emptyDb(void(callback)(void*)) {
function selectDb (line 380) | int selectDb(redisClient *c, int id) {
function signalModifiedKey (line 407) | void signalModifiedKey(redisDb *db, robj *key) {
function signalFlushedDb (line 411) | void signalFlushedDb(int dbid) {
function flushdbCommand (line 424) | void flushdbCommand(redisClient *c) {
function flushallCommand (line 444) | void flushallCommand(redisClient *c) {
function delCommand (line 476) | void delCommand(redisClient *c) {
function existsCommand (line 505) | void existsCommand(redisClient *c) {
function selectCommand (line 519) | void selectCommand(redisClient *c) {
function randomkeyCommand (line 540) | void randomkeyCommand(redisClient *c) {
function keysCommand (line 553) | void keysCommand(redisClient *c) {
function scanCallback (line 593) | void scanCallback(void *privdata, const dictEntry *de) {
function parseScanCursorOrReply (line 626) | int parseScanCursorOrReply(redisClient *c, robj *o, unsigned long *curso...
function scanGenericCommand (line 664) | void scanGenericCommand(redisClient *c, robj *o, unsigned long cursor) {
function scanCommand (line 864) | void scanCommand(redisClient *c) {
function dbsizeCommand (line 870) | void dbsizeCommand(redisClient *c) {
function lastsaveCommand (line 874) | void lastsaveCommand(redisClient *c) {
function typeCommand (line 878) | void typeCommand(redisClient *c) {
function shutdownCommand (line 900) | void shutdownCommand(redisClient *c) {
function renameGenericCommand (line 936) | void renameGenericCommand(redisClient *c, int nx) {
function renameCommand (line 996) | void renameCommand(redisClient *c) {
function renamenxCommand (line 1000) | void renamenxCommand(redisClient *c) {
function moveCommand (line 1004) | void moveCommand(redisClient *c) {
function removeExpire (line 1076) | int removeExpire(redisDb *db, robj *key) {
function setExpire (line 1089) | void setExpire(redisDb *db, robj *key, long long when) {
function getExpire (line 1114) | long long getExpire(redisDb *db, robj *key) {
function propagateExpire (line 1149) | void propagateExpire(redisDb *db, robj *key) {
function expireIfNeeded (line 1176) | int expireIfNeeded(redisDb *db, robj *key) {
function expireGenericCommand (line 1251) | void expireGenericCommand(redisClient *c, long long basetime, int unit) {
function expireCommand (line 1324) | void expireCommand(redisClient *c) {
function expireatCommand (line 1328) | void expireatCommand(redisClient *c) {
function pexpireCommand (line 1332) | void pexpireCommand(redisClient *c) {
function pexpireatCommand (line 1336) | void pexpireatCommand(redisClient *c) {
function ttlGenericCommand (line 1349) | void ttlGenericCommand(redisClient *c, int output_ms) {
function ttlCommand (line 1380) | void ttlCommand(redisClient *c) {
function pttlCommand (line 1384) | void pttlCommand(redisClient *c) {
function persistCommand (line 1388) | void persistCommand(redisClient *c) {
type redisCommand (line 1418) | struct redisCommand
type redisCommand (line 1448) | struct redisCommand
function getKeysFreeResult (line 1457) | void getKeysFreeResult(int *result) {
type redisCommand (line 1464) | struct redisCommand
type redisCommand (line 1493) | struct redisCommand
type redisCommand (line 1521) | struct redisCommand
function slotToKeyAdd (line 1568) | void slotToKeyAdd(robj *key) {
function slotToKeyDel (line 1579) | void slotToKeyDel(robj *key) {
function slotToKeyFlush (line 1586) | void slotToKeyFlush(void) {
function getKeysInSlot (line 1593) | unsigned int getKeysInSlot(unsigned int hashslot, robj **keys, unsigned ...
function delKeysInSlot (line 1616) | unsigned int delKeysInSlot(unsigned int hashslot) {
function countKeysInSlot (line 1637) | unsigned int countKeysInSlot(unsigned int hashslot) {
FILE: src/debug.c
function xorDigest (line 52) | void xorDigest(unsigned char *digest, void *ptr, size_t len) {
function xorObjectDigest (line 65) | void xorObjectDigest(unsigned char *digest, robj *o) {
function mixDigest (line 85) | void mixDigest(unsigned char *digest, void *ptr, size_t len) {
function mixObjectDigest (line 95) | void mixObjectDigest(unsigned char *digest, robj *o) {
function computeDatasetDigest (line 107) | void computeDatasetDigest(unsigned char *final) {
function debugCommand (line 249) | void debugCommand(redisClient *c) {
function _redisAssert (line 400) | void _redisAssert(char *estr, char *file, int line) {
function _redisAssertPrintClientInfo (line 413) | void _redisAssertPrintClientInfo(redisClient *c) {
function redisLogObjectDebugInfo (line 437) | void redisLogObjectDebugInfo(robj *o) {
function _redisAssertPrintObject (line 461) | void _redisAssertPrintObject(robj *o) {
function _redisAssertWithInfo (line 467) | void _redisAssertWithInfo(redisClient *c, robj *o, char *estr, char *fil...
function _redisPanic (line 473) | void _redisPanic(char *msg, char *file, int line) {
function bugReportStart (line 485) | void bugReportStart(void) {
function logStackContent (line 525) | void logStackContent(void **sp) {
function logRegisters (line 538) | void logRegisters(ucontext_t *uc) {
function logStackTrace (line 669) | void logStackTrace(ucontext_t *uc) {
function logCurrentClient (line 697) | void logCurrentClient(void) {
function memtest_test_linux_anonymous_maps (line 737) | int memtest_test_linux_anonymous_maps(void) {
function sigsegvHandler (line 815) | void sigsegvHandler(int sig, siginfo_t *info, void *secret) {
function redisLogHexDump (line 884) | void redisLogHexDump(int level, char *descr, void *value, size_t len) {
function watchdogSignalHandler (line 909) | void watchdogSignalHandler(int sig, siginfo_t *info, void *secret) {
function watchdogScheduleSignal (line 928) | void watchdogScheduleSignal(int period) {
function enableWatchdog (line 941) | void enableWatchdog(int period) {
function disableWatchdog (line 964) | void disableWatchdog(void) {
FILE: src/dict.c
function dictIntHashFunction (line 83) | unsigned int dictIntHashFunction(unsigned int key)
function dictIdentityHashFunction (line 95) | unsigned int dictIdentityHashFunction(unsigned int key)
function dictSetHashFunctionSeed (line 102) | void dictSetHashFunctionSeed(uint32_t seed) {
function dictGetHashFunctionSeed (line 106) | uint32_t dictGetHashFunctionSeed(void) {
function dictGenHashFunction (line 121) | unsigned int dictGenHashFunction(const void *key, int len) {
function dictGenCaseHashFunction (line 165) | unsigned int dictGenCaseHashFunction(const unsigned char *buf, int len) {
function _dictReset (line 184) | static void _dictReset(dictht *ht)
function dict (line 198) | dict *dictCreate(dictType *type,
function _dictInit (line 214) | int _dictInit(dict *d, dictType *type,
function dictResize (line 249) | int dictResize(dict *d)
function dictExpand (line 280) | int dictExpand(dict *d, unsigned long size)
function dictRehash (line 354) | int dictRehash(dict *d, int n) {
function timeInMilliseconds (line 428) | long long timeInMilliseconds(void) {
function dictRehashMilliseconds (line 441) | int dictRehashMilliseconds(dict *d, int ms) {
function _dictRehashStep (line 474) | static void _dictRehashStep(dict *d) {
function dictAdd (line 488) | int dictAdd(dict *d, void *key, void *val)
function dictEntry (line 530) | dictEntry *dictAddRaw(dict *d, void *key)
function dictReplace (line 582) | int dictReplace(dict *d, void *key, void *val)
function dictEntry (line 632) | dictEntry *dictReplaceRaw(dict *d, void *key) {
function dictGenericDelete (line 654) | static int dictGenericDelete(dict *d, const void *key, int nofree)
function dictDelete (line 729) | int dictDelete(dict *ht, const void *key) {
function dictDeleteNoFree (line 741) | int dictDeleteNoFree(dict *ht, const void *key) {
function _dictClear (line 751) | int _dictClear(dict *d, dictht *ht, void(callback)(void *)) {
function dictRelease (line 801) | void dictRelease(dict *d)
function dictEntry (line 817) | dictEntry *dictFind(dict *d, const void *key)
function dictFingerprint (line 881) | long long dictFingerprint(dict *d) {
function dictIterator (line 918) | dictIterator *dictGetIterator(dict *d)
function dictIterator (line 937) | dictIterator *dictGetSafeIterator(dict *d) {
function dictEntry (line 953) | dictEntry *dictNext(dictIterator *iter)
function dictReleaseIterator (line 1020) | void dictReleaseIterator(dictIterator *iter)
function dictEntry (line 1045) | dictEntry *dictGetRandomKey(dict *d)
function dictGetRandomKeys (line 1117) | int dictGetRandomKeys(dict *d, dictEntry **des, int count) {
function rev (line 1152) | static unsigned long rev(unsigned long v) {
function dictScan (line 1300) | unsigned long dictScan(dict *d,
function _dictExpandIfNeeded (line 1397) | static int _dictExpandIfNeeded(dict *d)
function _dictNextPower (line 1434) | static unsigned long _dictNextPower(unsigned long size)
function _dictKeyIndex (line 1461) | static int _dictKeyIndex(dict *d, const void *key)
function dictEmpty (line 1505) | void dictEmpty(dict *d, void(callback)(void*)) {
function dictEnableResize (line 1521) | void dictEnableResize(void) {
function dictDisableResize (line 1530) | void dictDisableResize(void) {
function _dictPrintStatsHt (line 1542) | static void _dictPrintStatsHt(dictht *ht) {
function dictPrintStats (line 1586) | void dictPrintStats(dict *d) {
function _dictStringCopyHTHashFunction (line 1596) | static unsigned int _dictStringCopyHTHashFunction(const void *key)
function _dictStringCopyHTKeyCompare (line 1612) | static int _dictStringCopyHTKeyCompare(void *privdata, const void *key1,
function _dictStringDestructor (line 1620) | static void _dictStringDestructor(void *privdata, void *key)
FILE: src/dict.h
type dictEntry (line 64) | typedef struct dictEntry {
type dictType (line 85) | typedef struct dictType {
type dictht (line 115) | typedef struct dictht {
type dict (line 135) | typedef struct dict {
type dictIterator (line 168) | typedef struct dictIterator {
FILE: src/endianconv.c
function memrev16 (line 49) | void memrev16(void *p) {
function memrev32 (line 59) | void memrev32(void *p) {
function memrev64 (line 72) | void memrev64(void *p) {
function intrev16 (line 89) | uint16_t intrev16(uint16_t v) {
function intrev32 (line 94) | uint32_t intrev32(uint32_t v) {
function intrev64 (line 99) | uint64_t intrev64(uint64_t v) {
function main (line 107) | int main(void) {
FILE: src/help.h
type commandHelp (line 21) | struct commandHelp {
FILE: src/hyperloglog.c
type hllhdr (line 182) | struct hllhdr {
function MurmurHash64A (line 393) | uint64_t MurmurHash64A (const void * key, int len, unsigned int seed) {
function hllPatLen (line 444) | int hllPatLen(unsigned char *ele, size_t elesize, long *regp) {
function hllDenseAdd (line 485) | int hllDenseAdd(uint8_t *registers, unsigned char *ele, size_t elesize) {
function hllDenseSum (line 504) | double hllDenseSum(uint8_t *registers, double *PE, int *ezp) {
function hllSparseToDense (line 568) | int hllSparseToDense(robj *o) {
function hllSparseAdd (line 638) | int hllSparseAdd(robj *o, unsigned char *ele, size_t elesize) {
function hllSparseSum (line 888) | double hllSparseSum(uint8_t *sparse, int sparselen, double *PE, int *ezp...
function hllRawSum (line 928) | double hllRawSum(uint8_t *registers, double *PE, int *ezp) {
function hllCount (line 967) | uint64_t hllCount(struct hllhdr *hdr, int *invalid) {
function hllAdd (line 1027) | int hllAdd(robj *o, unsigned char *ele, size_t elesize) {
function hllMerge (line 1044) | int hllMerge(uint8_t *max, robj *hll) {
function robj (line 1089) | robj *createHLLObject(void) {
function isHLLObjectOrReply (line 1124) | int isHLLObjectOrReply(redisClient *c, robj *o) {
function pfaddCommand (line 1155) | void pfaddCommand(redisClient *c) {
function pfcountCommand (line 1195) | void pfcountCommand(redisClient *c) {
function pfmergeCommand (line 1285) | void pfmergeCommand(redisClient *c) {
function pfselftestCommand (line 1351) | void pfselftestCommand(redisClient *c) {
function pfdebugCommand (line 1447) | void pfdebugCommand(redisClient *c) {
FILE: src/intset.c
function _intsetValueEncoding (line 53) | static uint8_t _intsetValueEncoding(int64_t v) {
function _intsetGetEncoded (line 68) | static int64_t _intsetGetEncoded(intset *is, int pos, uint8_t enc) {
function _intsetGet (line 99) | static int64_t _intsetGet(intset *is, int pos) {
function _intsetSet (line 109) | static void _intsetSet(intset *is, int pos, int64_t value) {
function intset (line 137) | intset *intsetNew(void) {
function intset (line 162) | static intset *intsetResize(intset *is, uint32_t len) {
function intsetSearch (line 193) | static uint8_t intsetSearch(intset *is, int64_t value, uint32_t *pos) {
function intset (line 253) | static intset *intsetUpgradeAndAdd(intset *is, int64_t value) {
function intsetMoveTail (line 350) | static void intsetMoveTail(intset *is, uint32_t from, uint32_t to) {
function intset (line 393) | intset *intsetAdd(intset *is, int64_t value, uint8_t *success) {
function intset (line 486) | intset *intsetRemove(intset *is, int64_t value, int *success) {
function intsetFind (line 538) | uint8_t intsetFind(intset *is, int64_t value) {
function intsetRandom (line 557) | int64_t intsetRandom(intset *is) {
function intsetGet (line 575) | uint8_t intsetGet(intset *is, uint32_t pos, int64_t *value) {
function intsetLen (line 598) | uint32_t intsetLen(intset *is) {
function intsetBlobLen (line 609) | size_t intsetBlobLen(intset *is) {
function intsetRepr (line 616) | void intsetRepr(intset *is) {
function error (line 624) | void error(char *err) {
function ok (line 629) | void ok(void) {
function usec (line 633) | long long usec(void) {
function _assert (line 640) | void _assert(char *estr, char *file, int line) {
function intset (line 645) | intset *createSet(int bits, int size) {
function checkConsistency (line 661) | void checkConsistency(intset *is) {
function main (line 680) | int main(int argc, char **argv) {
FILE: src/intset.h
type intset (line 35) | typedef struct intset {
FILE: src/lzfP.h
type u8 (line 127) | typedef unsigned char u8;
type u8 (line 129) | typedef const u8 *LZF_STATE[1 << (HLOG)];
type u16 (line 135) | typedef unsigned short u16;
type u16 (line 137) | typedef unsigned int u16;
FILE: src/lzf_c.c
function lzf_compress (line 98) | unsigned int
FILE: src/lzf_d.c
function lzf_decompress (line 55) | unsigned int
FILE: src/memtest.c
type winsize (line 56) | struct winsize
function memtest_progress_start (line 60) | void memtest_progress_start(char *title, int pass) {
function memtest_progress_end (line 75) | void memtest_progress_end(void) {
function memtest_progress_step (line 79) | void memtest_progress_step(size_t curr, size_t size, char c) {
function memtest_addressing (line 90) | void memtest_addressing(unsigned long *l, size_t bytes) {
function memtest_fill_random (line 118) | void memtest_fill_random(unsigned long *l, size_t bytes) {
function memtest_fill_value (line 148) | void memtest_fill_value(unsigned long *l, size_t bytes, unsigned long v1,
function memtest_compare (line 179) | void memtest_compare(unsigned long *l, size_t bytes) {
function memtest_compare_times (line 198) | void memtest_compare_times(unsigned long *m, size_t bytes, int pass, int...
function memtest_test (line 208) | void memtest_test(size_t megabytes, int passes) {
function memtest_non_destructive_invert (line 242) | void memtest_non_destructive_invert(void *addr, size_t size) {
function memtest_non_destructive_swap (line 252) | void memtest_non_destructive_swap(void *addr, size_t size) {
function memtest (line 268) | void memtest(size_t megabytes, int passes) {
FILE: src/multi.c
function initClientMultiState (line 38) | void initClientMultiState(redisClient *c) {
function freeClientMultiState (line 51) | void freeClientMultiState(redisClient *c) {
function queueMultiCommand (line 75) | void queueMultiCommand(redisClient *c) {
function discardTransaction (line 98) | void discardTransaction(redisClient *c) {
function flagTransaction (line 119) | void flagTransaction(redisClient *c) {
function multiCommand (line 124) | void multiCommand(redisClient *c) {
function discardCommand (line 138) | void discardCommand(redisClient *c) {
function execCommandPropagateMulti (line 156) | void execCommandPropagateMulti(redisClient *c) {
function execCommand (line 165) | void execCommand(redisClient *c) {
type watchedKey (line 309) | typedef struct watchedKey {
function watchForKey (line 323) | void watchForKey(redisClient *c, robj *key) {
function unwatchAllKeys (line 405) | void unwatchAllKeys(redisClient *c) {
function touchWatchedKey (line 449) | void touchWatchedKey(redisDb *db, robj *key) {
function touchWatchedKeysOnFlush (line 485) | void touchWatchedKeysOnFlush(int dbid) {
function watchCommand (line 520) | void watchCommand(redisClient *c) {
function unwatchCommand (line 536) | void unwatchCommand(redisClient *c) {
FILE: src/networking.c
function zmalloc_size_sds (line 41) | size_t zmalloc_size_sds(sds s) {
function getStringObjectSdsUsedMemory (line 48) | size_t getStringObjectSdsUsedMemory(robj *o) {
function listMatchObjects (line 68) | int listMatchObjects(void *a, void *b) {
function redisClient (line 75) | redisClient *createClient(int fd) {
function prepareClientToWrite (line 217) | int prepareClientToWrite(redisClient *c) {
function robj (line 244) | robj *dupLastObjectIfNeeded(list *reply) {
function _addReplyToBuffer (line 265) | int _addReplyToBuffer(redisClient *c, char *s, size_t len) {
function _addReplyObjectToList (line 290) | void _addReplyObjectToList(redisClient *c, robj *o) {
function _addReplySdsToList (line 337) | void _addReplySdsToList(redisClient *c, sds s) {
function _addReplyStringToList (line 368) | void _addReplyStringToList(redisClient *c, char *s, size_t len) {
function addReply (line 407) | void addReply(redisClient *c, robj *obj) {
function addReplySds (line 462) | void addReplySds(redisClient *c, sds s) {
function addReplyString (line 479) | void addReplyString(redisClient *c, char *s, size_t len) {
function addReplyErrorLength (line 485) | void addReplyErrorLength(redisClient *c, char *s, size_t len) {
function addReplyError (line 496) | void addReplyError(redisClient *c, char *err) {
function addReplyErrorFormat (line 500) | void addReplyErrorFormat(redisClient *c, const char *fmt, ...) {
function addReplyStatusLength (line 516) | void addReplyStatusLength(redisClient *c, char *s, size_t len) {
function addReplyStatus (line 527) | void addReplyStatus(redisClient *c, char *status) {
function addReplyStatusFormat (line 531) | void addReplyStatusFormat(redisClient *c, const char *fmt, ...) {
function setDeferredMultiBulkLength (line 554) | void setDeferredMultiBulkLength(redisClient *c, void *node, long length) {
function addReplyDouble (line 586) | void addReplyDouble(redisClient *c, double d) {
function addReplyLongLongWithPrefix (line 614) | void addReplyLongLongWithPrefix(redisClient *c, long long ll, char prefi...
function addReplyLongLong (line 643) | void addReplyLongLong(redisClient *c, long long ll) {
function addReplyMultiBulkLen (line 652) | void addReplyMultiBulkLen(redisClient *c, long length) {
function addReplyBulkLen (line 660) | void addReplyBulkLen(redisClient *c, robj *obj) {
function addReplyBulk (line 689) | void addReplyBulk(redisClient *c, robj *obj) {
function addReplyBulkCBuffer (line 699) | void addReplyBulkCBuffer(redisClient *c, void *p, size_t len) {
function addReplyBulkCString (line 709) | void addReplyBulkCString(redisClient *c, char *s) {
function addReplyBulkLongLong (line 721) | void addReplyBulkLongLong(redisClient *c, long long ll) {
function copyClientOutputBuffer (line 733) | void copyClientOutputBuffer(redisClient *dst, redisClient *src) {
function acceptCommonHandler (line 752) | static void acceptCommonHandler(int fd, int flags) {
function acceptTcpHandler (line 794) | void acceptTcpHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
function acceptUnixHandler (line 819) | void acceptUnixHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
function freeClientArgv (line 843) | static void freeClientArgv(redisClient *c) {
function disconnectSlaves (line 855) | void disconnectSlaves(void) {
function replicationHandleMasterDisconnection (line 865) | void replicationHandleMasterDisconnection(void) {
function freeClient (line 887) | void freeClient(redisClient *c) {
function freeClientAsync (line 1020) | void freeClientAsync(redisClient *c) {
function freeClientsInAsyncFreeQueue (line 1027) | void freeClientsInAsyncFreeQueue(void) {
function sendReplyToClient (line 1045) | void sendReplyToClient(aeEventLoop *el, int fd, void *privdata, int mask) {
function resetClient (line 1173) | void resetClient(redisClient *c) {
function processInlineBuffer (line 1201) | int processInlineBuffer(redisClient *c) {
function setProtocolError (line 1279) | static void setProtocolError(redisClient *c, int pos) {
function processMultibulkBuffer (line 1299) | int processMultibulkBuffer(redisClient *c) {
function processInputBuffer (line 1485) | void processInputBuffer(redisClient *c) {
function readQueryFromClient (line 1548) | void readQueryFromClient(aeEventLoop *el, int fd, void *privdata, int ma...
function getClientsMaxBuffers (line 1637) | void getClientsMaxBuffers(unsigned long *longest_output_list,
function formatPeerId (line 1659) | void formatPeerId(char *peerid, size_t peerid_len, char *ip, int port) {
function genClientPeerId (line 1679) | int genClientPeerId(redisClient *client, char *peerid, size_t peerid_len) {
function sds (line 1712) | sds catClientInfoString(sds s, redisClient *client) {
function sds (line 1764) | sds getAllClientsInfoString(void) {
function clientCommand (line 1783) | void clientCommand(redisClient *c) {
function rewriteClientCommandVector (line 1869) | void rewriteClientCommandVector(redisClient *c, int argc, ...) {
function rewriteClientCommandArgument (line 1903) | void rewriteClientCommandArgument(redisClient *c, int i, robj *newval) {
function getClientOutputBufferMemoryUsage (line 1943) | unsigned long getClientOutputBufferMemoryUsage(redisClient *c) {
function getClientLimitClass (line 1967) | int getClientLimitClass(redisClient *c) {
function getClientLimitClassByName (line 1975) | int getClientLimitClassByName(char *name) {
function checkClientOutputBufferLimits (line 2005) | int checkClientOutputBufferLimits(redisClient *c) {
function asyncCloseClientOnOutputBufferLimitReached (line 2073) | void asyncCloseClientOnOutputBufferLimitReached(redisClient *c) {
function flushSlavesOutputBuffers (line 2094) | void flushSlavesOutputBuffers(void) {
function pauseClients (line 2132) | void pauseClients(mstime_t end) {
function clientsArePaused (line 2145) | int clientsArePaused(void) {
function processEventsWhileBlocked (line 2179) | int processEventsWhileBlocked(void) {
FILE: src/notify.c
function keyspaceEventsStringToFlags (line 45) | int keyspaceEventsStringToFlags(char *classes) {
function sds (line 77) | sds keyspaceEventsFlagsToString(int flags) {
function notifyKeyspaceEvent (line 115) | void notifyKeyspaceEvent(int type, char *event, robj *key, int dbid) {
FILE: src/object.c
function robj (line 38) | robj *createObject(int type, void *ptr) {
function robj (line 56) | robj *createRawStringObject(char *ptr, size_t len) {
function robj (line 66) | robj *createEmbeddedStringObject(char *ptr, size_t len) {
function robj (line 94) | robj *createStringObject(char *ptr, size_t len) {
function robj (line 107) | robj *createStringObjectFromLongLong(long long value) {
function robj (line 143) | robj *createStringObjectFromLongDouble(long double value) {
function robj (line 189) | robj *dupStringObject(robj *o) {
function robj (line 217) | robj *createListObject(void) {
function robj (line 233) | robj *createZiplistObject(void) {
function robj (line 247) | robj *createSetObject(void) {
function robj (line 261) | robj *createIntsetObject(void) {
function robj (line 275) | robj *createHashObject(void) {
function robj (line 289) | robj *createZsetObject(void) {
function robj (line 308) | robj *createZsetZiplistObject(void) {
function freeStringObject (line 322) | void freeStringObject(robj *o) {
function freeListObject (line 331) | void freeListObject(robj *o) {
function freeSetObject (line 351) | void freeSetObject(robj *o) {
function freeZsetObject (line 371) | void freeZsetObject(robj *o) {
function freeHashObject (line 396) | void freeHashObject(robj *o) {
function incrRefCount (line 417) | void incrRefCount(robj *o) {
function decrRefCount (line 426) | void decrRefCount(robj *o) {
function decrRefCountVoid (line 454) | void decrRefCountVoid(void *o) {
function robj (line 478) | robj *resetRefCount(robj *obj) {
function checkType (line 490) | int checkType(redisClient *c, robj *o, int type) {
function isObjectRepresentableAsLongLong (line 507) | int isObjectRepresentableAsLongLong(robj *o, long long *llval) {
function robj (line 524) | robj *tryObjectEncoding(robj *o) {
function robj (line 617) | robj *getDecodedObject(robj *o) {
function compareStringObjectsWithFlags (line 660) | int compareStringObjectsWithFlags(robj *a, robj *b, int flags) {
function compareStringObjects (line 701) | int compareStringObjects(robj *a, robj *b) {
function collateStringObjects (line 706) | int collateStringObjects(robj *a, robj *b) {
function equalStringObjects (line 720) | int equalStringObjects(robj *a, robj *b) {
function stringObjectLen (line 739) | size_t stringObjectLen(robj *o) {
function getDoubleFromObject (line 761) | int getDoubleFromObject(robj *o, double *target) {
function getDoubleFromObjectOrReply (line 804) | int getDoubleFromObjectOrReply(redisClient *c, robj *o, double *target, ...
function getLongDoubleFromObject (line 828) | int getLongDoubleFromObject(robj *o, long double *target) {
function getLongDoubleFromObjectOrReply (line 866) | int getLongDoubleFromObjectOrReply(redisClient *c, robj *o, long double ...
function getLongLongFromObject (line 896) | int getLongLongFromObject(robj *o, long long *target) {
function getLongLongFromObjectOrReply (line 940) | int getLongLongFromObjectOrReply(redisClient *c, robj *o, long long *tar...
function getLongFromObjectOrReply (line 967) | int getLongFromObjectOrReply(redisClient *c, robj *o, long *target, cons...
function estimateObjectIdleTime (line 1009) | unsigned long long estimateObjectIdleTime(robj *o) {
function robj (line 1024) | robj *objectCommandLookup(redisClient *c, robj *key) {
function robj (line 1036) | robj *objectCommandLookupOrReply(redisClient *c, robj *key, robj *reply) {
function objectCommand (line 1045) | void objectCommand(redisClient *c) {
FILE: src/pqsort.c
function swapfunc (line 68) | static inline void
function _pqsort (line 98) | static void
function pqsort (line 179) | void
FILE: src/pubsub.c
function freePubsubPattern (line 39) | void freePubsubPattern(void *p) {
function listMatchPubsubPattern (line 49) | int listMatchPubsubPattern(void *a, void *b) {
function pubsubSubscribeChannel (line 63) | int pubsubSubscribeChannel(redisClient *c, robj *channel) {
function pubsubUnsubscribeChannel (line 127) | int pubsubUnsubscribeChannel(redisClient *c, robj *channel, int notify) {
function pubsubSubscribePattern (line 216) | int pubsubSubscribePattern(redisClient *c, robj *pattern) {
function pubsubUnsubscribePattern (line 270) | int pubsubUnsubscribePattern(redisClient *c, robj *pattern, int notify) {
function pubsubUnsubscribeAllChannels (line 319) | int pubsubUnsubscribeAllChannels(redisClient *c, int notify) {
function pubsubUnsubscribeAllPatterns (line 357) | int pubsubUnsubscribeAllPatterns(redisClient *c, int notify) {
function pubsubPublishMessage (line 391) | int pubsubPublishMessage(robj *channel, robj *message) {
function subscribeCommand (line 476) | void subscribeCommand(redisClient *c) {
function unsubscribeCommand (line 483) | void unsubscribeCommand(redisClient *c) {
function psubscribeCommand (line 494) | void psubscribeCommand(redisClient *c) {
function punsubscribeCommand (line 501) | void punsubscribeCommand(redisClient *c) {
function publishCommand (line 512) | void publishCommand(redisClient *c) {
function pubsubCommand (line 523) | void pubsubCommand(redisClient *c) {
FILE: src/rand.c
function redisLrand48 (line 71) | int32_t redisLrand48() {
function redisSrand48 (line 76) | void redisSrand48(int32_t seedval) {
function next (line 80) | static void next() {
FILE: src/rdb.c
function rdbWriteRaw (line 48) | static int rdbWriteRaw(rio *rdb, void *p, size_t len) {
function rdbSaveType (line 57) | int rdbSaveType(rio *rdb, unsigned char type) {
function rdbLoadType (line 71) | int rdbLoadType(rio *rdb) {
function time_t (line 82) | time_t rdbLoadTime(rio *rdb) {
function rdbSaveMillisecondTime (line 91) | int rdbSaveMillisecondTime(rio *rdb, long long t) {
function rdbLoadMillisecondTime (line 99) | long long rdbLoadMillisecondTime(rio *rdb) {
function rdbSaveLen (line 113) | int rdbSaveLen(rio *rdb, uint32_t len) {
function rdbLoadLen (line 152) | uint32_t rdbLoadLen(rio *rdb, int *isencoded) {
function rdbEncodeInteger (line 201) | int rdbEncodeInteger(long long value, unsigned char *enc) {
function robj (line 237) | robj *rdbLoadIntegerObject(rio *rdb, int enctype, int encode) {
function rdbTryIntegerEncoding (line 282) | int rdbTryIntegerEncoding(char *s, size_t len, unsigned char *enc) {
function rdbSaveLzfStringObject (line 312) | int rdbSaveLzfStringObject(rio *rdb, unsigned char *s, size_t len) {
function robj (line 363) | robj *rdbLoadLzfStringObject(rio *rdb) {
function rdbSaveRawString (line 401) | int rdbSaveRawString(rio *rdb, unsigned char *s, size_t len) {
function rdbSaveLongLongAsStringObject (line 461) | int rdbSaveLongLongAsStringObject(rio *rdb, long long value) {
function rdbSaveStringObject (line 501) | int rdbSaveStringObject(rio *rdb, robj *obj) {
function robj (line 521) | robj *rdbGenericLoadStringObject(rio *rdb, int encode) {
function robj (line 562) | robj *rdbLoadStringObject(rio *rdb) {
function robj (line 566) | robj *rdbLoadEncodedStringObject(rio *rdb) {
function rdbSaveDoubleValue (line 589) | int rdbSaveDoubleValue(rio *rdb, double val) {
function rdbLoadDoubleValue (line 634) | int rdbLoadDoubleValue(rio *rdb, double *val) {
function rdbSaveObjectType (line 659) | int rdbSaveObjectType(rio *rdb, robj *o) {
function rdbLoadObjectType (line 707) | int rdbLoadObjectType(rio *rdb) {
function rdbSaveObject (line 722) | int rdbSaveObject(rio *rdb, robj *o) {
function off_t (line 872) | off_t rdbSavedObjectLen(robj *o) {
function rdbSaveKeyValuePair (line 891) | int rdbSaveKeyValuePair(rio *rdb, robj *key, robj *val,
function rdbSave (line 926) | int rdbSave(char *filename) {
function rdbSaveBackground (line 1067) | int rdbSaveBackground(char *filename) {
function rdbRemoveTempFile (line 1149) | void rdbRemoveTempFile(pid_t childpid) {
function robj (line 1164) | robj *rdbLoadObject(int rdbtype, rio *rdb) {
function startLoading (line 1558) | void startLoading(FILE *fp) {
function loadingProgress (line 1579) | void loadingProgress(off_t pos) {
function stopLoading (line 1589) | void stopLoading(void) {
function rdbLoadProgressCallback (line 1597) | void rdbLoadProgressCallback(rio *r, const void *buf, size_t len) {
function rdbLoad (line 1617) | int rdbLoad(char *filename) {
function backgroundSaveDoneHandler (line 1808) | void backgroundSaveDoneHandler(int exitcode, int bysignal) {
function saveCommand (line 1846) | void saveCommand(redisClient *c) {
function bgsaveCommand (line 1863) | void bgsaveCommand(redisClient *c) {
FILE: src/redis-benchmark.c
type config (line 52) | struct config {
type _client (line 82) | struct _client {
function ustime (line 102) | static long long ustime(void) {
function mstime (line 112) | static long long mstime(void) {
function freeClient (line 122) | static void freeClient(client c) {
function freeAllClients (line 136) | static void freeAllClients(void) {
function resetClient (line 146) | static void resetClient(client c) {
function randomizeClientKey (line 154) | static void randomizeClientKey(client c) {
function clientDone (line 170) | static void clientDone(client c) {
function readHandler (line 186) | static void readHandler(aeEventLoop *el, int fd, void *privdata, int mas...
function writeHandler (line 244) | static void writeHandler(aeEventLoop *el, int fd, void *privdata, int ma...
function client (line 303) | static client createClient(char *cmd, size_t len, client from) {
function createMissingClients (line 390) | static void createMissingClients(client c) {
function compareLatency (line 413) | static int compareLatency(const void *a, const void *b) {
function showLatencyReport (line 417) | static void showLatencyReport(void) {
function benchmark (line 447) | static void benchmark(char *title, char *cmd, int len) {
function parseOptions (line 466) | int parseOptions(int argc, const char **argv) {
function showThroughput (line 590) | int showThroughput(struct aeEventLoop *eventLoop, long long id, void *cl...
function test_is_selected (line 605) | int test_is_selected(char *name) {
function main (line 617) | int main(int argc, const char **argv) {
FILE: src/redis-check-aof.c
function consumeNewline (line 56) | int consumeNewline(char *buf) {
function readLong (line 69) | int readLong(FILE *fp, char prefix, long *target) {
function readBytes (line 97) | int readBytes(FILE *fp, char *target, long length) {
function readString (line 117) | int readString(FILE *fp, char** target) {
function readArgc (line 153) | int readArgc(FILE *fp, long *target) {
function off_t (line 164) | off_t process(FILE *fp) {
function main (line 234) | int main(int argc, char **argv) {
FILE: src/redis-check-dump.c
type pos (line 104) | typedef struct {
type errors_t (line 116) | typedef struct {
type entry (line 130) | typedef struct {
function checkType (line 145) | int checkType(unsigned char t) {
function readBytes (line 155) | int readBytes(void *target, long num) {
function processHeader (line 169) | int processHeader() {
function loadType (line 189) | int loadType(entry *e) {
function peekType (line 209) | int peekType() {
function processTime (line 217) | int processTime(int type) {
function loadLength (line 232) | uint32_t loadLength(int *isencoded) {
function processStringObject (line 346) | int processStringObject(char** store) {
function processDoubleValue (line 386) | int processDoubleValue(double** store) {
function loadPair (line 403) | int loadPair(entry *e) {
function entry (line 486) | entry loadEntry() {
function printCentered (line 544) | void printCentered(int indent, int width, char* body) {
function printValid (line 554) | void printValid(uint64_t ops, uint64_t bytes) {
function printSkipped (line 561) | void printSkipped(uint64_t bytes, uint64_t offset) {
function printErrorStack (line 568) | void printErrorStack(entry *e) {
function process (line 603) | void process() {
function main (line 708) | int main(int argc, char **argv) {
FILE: src/redis-cli.c
type config (line 64) | struct config {
function ustime (line 107) | static long long ustime(void) {
function mstime (line 117) | static long long mstime(void) {
function cliRefreshPrompt (line 121) | static void cliRefreshPrompt(void) {
type helpEntry (line 145) | typedef struct {
function sds (line 158) | static sds cliVersion() {
function cliInitHelp (line 172) | static void cliInitHelp() {
function cliOutputCommandHelp (line 201) | static void cliOutputCommandHelp(struct commandHelp *help, int group) {
function cliOutputGenericHelp (line 211) | static void cliOutputGenericHelp() {
function cliOutputHelp (line 225) | static void cliOutputHelp(int argc, char **argv) {
function completionCallback (line 269) | static void completionCallback(const char *buf, linenoiseCompletions *lc) {
function cliAuth (line 302) | static int cliAuth() {
function cliSelect (line 315) | static int cliSelect() {
function cliConnect (line 329) | static int cliConnect(int force) {
function cliPrintContextError (line 366) | static void cliPrintContextError() {
function sds (line 371) | static sds cliFormatReplyTTY(redisReply *r, char *prefix) {
function sds (line 438) | static sds cliFormatReplyRaw(redisReply *r) {
function sds (line 472) | static sds cliFormatReplyCSV(redisReply *r) {
function cliReadReply (line 508) | static int cliReadReply(int output_raw_strings) {
function cliSendCommand (line 582) | static int cliSendCommand(int argc, char **argv, int repeat) {
function redisReply (line 659) | static redisReply *reconnectingInfo(void) {
function parseOptions (line 692) | static int parseOptions(int argc, char **argv) {
function sds (line 776) | static sds readArgFromStdin(void) {
function usage (line 793) | static void usage() {
function repl (line 861) | static void repl() {
function noninteractive (line 952) | static int noninteractive(int argc, char **argv) {
function evalMode (line 969) | static int evalMode(int argc, char **argv) {
function latencyMode (line 1013) | static void latencyMode(void) {
function sendSync (line 1061) | unsigned long long sendSync(int fd) {
function slaveMode (line 1094) | static void slaveMode(void) {
function getRDB (line 1128) | static void getRDB(void) {
function pipeMode (line 1175) | static void pipeMode(void) {
function redisReply (line 1337) | static redisReply *sendScan(unsigned long long *it) {
function getDbSize (line 1365) | static int getDbSize(void) {
function toIntType (line 1383) | static int toIntType(char *key, char *type) {
function getKeyTypes (line 1402) | static void getKeyTypes(redisReply *keys, int *types) {
function getKeySizes (line 1428) | static void getKeySizes(redisReply *keys, int *types,
function findBigKeys (line 1473) | static void findBigKeys(void) {
function getLongInfoField (line 1628) | static long getLongInfoField(char *info, char *field) {
function bytesToHuman (line 1640) | void bytesToHuman(char *s, long long n) {
function statMode (line 1664) | static void statMode() {
function scanMode (line 1750) | static void scanMode() {
function compute_something_fast (line 1790) | unsigned long compute_something_fast(void) {
function intrinsicLatencyMode (line 1810) | static void intrinsicLatencyMode(void) {
function main (line 1846) | int main(int argc, char **argv) {
FILE: src/redis-trib.rb
function xputs (line 29) | def xputs(s)
class ClusterNode (line 50) | class ClusterNode
method initialize (line 51) | def initialize(addr)
method friends (line 69) | def friends
method slots (line 73) | def slots
method has_flag? (line 77) | def has_flag?(flag)
method to_s (line 81) | def to_s
method connect (line 85) | def connect(o={})
method assert_cluster (line 100) | def assert_cluster
method assert_empty (line 108) | def assert_empty
method load_info (line 116) | def load_info(o={})
method add_slots (line 171) | def add_slots(slots)
method set_as_replica (line 178) | def set_as_replica(node_id)
method flush_node_config (line 183) | def flush_node_config
method info_string (line 208) | def info_string
method get_config_signature (line 260) | def get_config_signature
method info (line 271) | def info
method is_dirty? (line 275) | def is_dirty?
method r (line 279) | def r
class RedisTrib (line 284) | class RedisTrib
method initialize (line 285) | def initialize
method check_arity (line 291) | def check_arity(req_args, num_args)
method add_node (line 299) | def add_node(node)
method cluster_error (line 303) | def cluster_error(msg)
method get_node_by_name (line 308) | def get_node_by_name(name)
method get_master_with_least_replicas (line 318) | def get_master_with_least_replicas
method check_cluster (line 326) | def check_cluster
method covered_slots (line 336) | def covered_slots
method check_slots_coverage (line 344) | def check_slots_coverage
method check_open_slots (line 356) | def check_open_slots
method nodes_with_keys_in_slot (line 379) | def nodes_with_keys_in_slot(slot)
method fix_slots_coverage (line 387) | def fix_slots_coverage
method fix_open_slot (line 451) | def fix_open_slot(slot)
method check_config_consistency (line 484) | def check_config_consistency
method is_config_consistent? (line 492) | def is_config_consistent?
method wait_cluster_join (line 500) | def wait_cluster_join
method alloc_slots (line 510) | def alloc_slots
method flush_nodes_config (line 600) | def flush_nodes_config
method show_nodes (line 606) | def show_nodes
method assign_config_epoch (line 617) | def assign_config_epoch
method join_cluster (line 628) | def join_cluster
method yes_or_die (line 641) | def yes_or_die(msg)
method load_cluster_info_from_node (line 650) | def load_cluster_info_from_node(nodeaddr)
method populate_nodes_replicas_info (line 670) | def populate_nodes_replicas_info
method compute_reshard_table (line 693) | def compute_reshard_table(sources,numslots)
method show_reshard_table (line 724) | def show_reshard_table(table)
method move_slot (line 730) | def move_slot(source,target,slot,o={})
method check_cluster_cmd (line 757) | def check_cluster_cmd(argv,opt)
method fix_cluster_cmd (line 762) | def fix_cluster_cmd(argv,opt)
method reshard_cluster_cmd (line 768) | def reshard_cluster_cmd(argv,opt)
method check_create_parameters (line 838) | def check_create_parameters
method create_cluster_cmd (line 849) | def create_cluster_cmd(argv,opt)
method addnode_cluster_cmd (line 882) | def addnode_cluster_cmd(argv,opt)
method delnode_cluster_cmd (line 926) | def delnode_cluster_cmd(argv,opt)
method set_timeout_cluster_cmd (line 964) | def set_timeout_cluster_cmd(argv,opt)
method call_cluster_cmd (line 992) | def call_cluster_cmd(argv,opt)
method import_cluster_cmd (line 1009) | def import_cluster_cmd(argv,opt)
method help_cluster_cmd (line 1057) | def help_cluster_cmd(argv,opt)
method parse_options (line 1065) | def parse_options(cmd)
FILE: src/redis.c
type sharedObjectsStruct (line 57) | struct sharedObjectsStruct
type redisServer (line 68) | struct redisServer
type redisCommand (line 69) | struct redisCommand
type redisCommand (line 180) | struct redisCommand
type evictionPoolEntry (line 343) | struct evictionPoolEntry
function redisLogRaw (line 349) | void redisLogRaw(int level, const char *msg) {
function redisLog (line 383) | void redisLog(int level, const char *fmt, ...) {
function redisLogFromHandler (line 402) | void redisLogFromHandler(int level, const char *msg) {
function ustime (line 428) | long long ustime(void) {
function mstime (line 441) | long long mstime(void) {
function exitFromChild (line 449) | void exitFromChild(int retcode) {
function dictVanillaFree (line 463) | void dictVanillaFree(void *privdata, void *val)
function dictListDestructor (line 469) | void dictListDestructor(void *privdata, void *val)
function dictSdsKeyCompare (line 475) | int dictSdsKeyCompare(void *privdata, const void *key1,
function dictSdsKeyCaseCompare (line 489) | int dictSdsKeyCaseCompare(void *privdata, const void *key1,
function dictRedisObjectDestructor (line 497) | void dictRedisObjectDestructor(void *privdata, void *val)
function dictSdsDestructor (line 505) | void dictSdsDestructor(void *privdata, void *val)
function dictObjKeyCompare (line 512) | int dictObjKeyCompare(void *privdata, const void *key1,
function dictObjHash (line 519) | unsigned int dictObjHash(const void *key) {
function dictSdsHash (line 524) | unsigned int dictSdsHash(const void *key) {
function dictSdsCaseHash (line 528) | unsigned int dictSdsCaseHash(const void *key) {
function dictEncObjKeyCompare (line 532) | int dictEncObjKeyCompare(void *privdata, const void *key1,
function dictEncObjHash (line 550) | unsigned int dictEncObjHash(const void *key) {
function htNeedsResize (line 700) | int htNeedsResize(dict *dict) {
function tryResizeHashTables (line 713) | void tryResizeHashTables(int dbid) {
function incrementallyRehash (line 734) | int incrementallyRehash(int dbid) {
function updateDictResizePolicy (line 757) | void updateDictResizePolicy(void) {
function activeExpireCycleTryExpire (line 784) | int activeExpireCycleTryExpire(redisDb *db, dictEntry *de, long long now) {
function activeExpireCycle (line 857) | void activeExpireCycle(int type) {
function getLRUClock (line 1034) | unsigned int getLRUClock(void) {
function trackOperationsPerSecond (line 1040) | void trackOperationsPerSecond(void) {
function getOperationsPerSecond (line 1065) | long long getOperationsPerSecond(void) {
function clientsCronHandleTimeout (line 108
Condensed preview — 424 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (5,403K chars).
[
{
"path": ".gitignore",
"chars": 332,
"preview": ".*.swp\n*.o\n*.log\ndump.rdb\nredis-benchmark\nredis-check-aof\nredis-check-dump\nredis-cli\nredis-sentinel\nredis-server\ndoc-too"
},
{
"path": "00-RELEASENOTES",
"chars": 633,
"preview": "Hello! This file is just a placeholder, since this is the \"unstable\" branch\nof Redis, the place where all the developmen"
},
{
"path": "BUGS",
"chars": 52,
"preview": "Plese check https://github.com/antirez/redis/issues\n"
},
{
"path": "CONTRIBUTING",
"chars": 1439,
"preview": "Note: by contributing code to the Redis project in any form, including sending\na pull request via Github, a code fragmen"
},
{
"path": "COPYING",
"chars": 1487,
"preview": "Copyright (c) 2006-2014, Salvatore Sanfilippo\nAll rights reserved.\n\nRedistribution and use in source and binary forms, w"
},
{
"path": "INSTALL",
"chars": 11,
"preview": "See README\n"
},
{
"path": "MANIFESTO",
"chars": 4223,
"preview": "[Note: this is the Redis manifesto, for general information about\n installing and running Redis read the README fi"
},
{
"path": "Makefile",
"chars": 151,
"preview": "# Top level makefile, the real shit is at src/Makefile\n\ndefault: all\n\n.DEFAULT:\n\tcd src && $(MAKE) $@\n\ninstall:\n\tcd src "
},
{
"path": "README",
"chars": 4404,
"preview": "Where to find complete Redis documentation?\n-------------------------------------------\n\nThis README is just a fast \"qui"
},
{
"path": "README.rst",
"chars": 17462,
"preview": "Redis 3.0 源码注释\n============================\n\n本项目是注释版的 Redis 3.0 源码,\n原始代码来自: https://github.com/antirez/redis 。\n\n这份注释是我在创"
},
{
"path": "deps/Makefile",
"chars": 2190,
"preview": "# Redis dependency Makefile\n\nuname_S:= $(shell sh -c 'uname -s 2>/dev/null || echo not')\n\nCCCOLOR=\"\\033[34m\"\nLINKCOLOR=\""
},
{
"path": "deps/hiredis/.gitignore",
"chars": 57,
"preview": "/hiredis-test\n/hiredis-example*\n/*.o\n/*.so\n/*.dylib\n/*.a\n"
},
{
"path": "deps/hiredis/CHANGELOG.md",
"chars": 519,
"preview": "### 0.10.1\n\n* Makefile overhaul. Important to check out if you override one or more\n variables using environment variab"
},
{
"path": "deps/hiredis/COPYING",
"chars": 1588,
"preview": "Copyright (c) 2009-2011, Salvatore Sanfilippo <antirez at gmail dot com>\nCopyright (c) 2010-2011, Pieter Noordhuis <pcno"
},
{
"path": "deps/hiredis/Makefile",
"chars": 4493,
"preview": "# Hiredis Makefile\n# Copyright (C) 2010-2011 Salvatore Sanfilippo <antirez at gmail dot com>\n# Copyright (C) 2010-2011 P"
},
{
"path": "deps/hiredis/README.md",
"chars": 17166,
"preview": "# HIREDIS\n\nHiredis is a minimalistic C client library for the [Redis](http://redis.io/) database.\n\nIt is minimalistic be"
},
{
"path": "deps/hiredis/adapters/ae.h",
"chars": 4219,
"preview": "/*\n * Copyright (c) 2010-2011, Pieter Noordhuis <pcnoordhuis at gmail dot com>\n *\n * All rights reserved.\n *\n * Redistri"
},
{
"path": "deps/hiredis/adapters/libev.h",
"chars": 4587,
"preview": "/*\n * Copyright (c) 2010-2011, Pieter Noordhuis <pcnoordhuis at gmail dot com>\n *\n * All rights reserved.\n *\n * Redistri"
},
{
"path": "deps/hiredis/adapters/libevent.h",
"chars": 3980,
"preview": "/*\n * Copyright (c) 2010-2011, Pieter Noordhuis <pcnoordhuis at gmail dot com>\n *\n * All rights reserved.\n *\n * Redistri"
},
{
"path": "deps/hiredis/async.c",
"chars": 21564,
"preview": "/*\n * Copyright (c) 2009-2011, Salvatore Sanfilippo <antirez at gmail dot com>\n * Copyright (c) 2010-2011, Pieter Noordh"
},
{
"path": "deps/hiredis/async.h",
"chars": 4928,
"preview": "/*\n * Copyright (c) 2009-2011, Salvatore Sanfilippo <antirez at gmail dot com>\n * Copyright (c) 2010-2011, Pieter Noordh"
},
{
"path": "deps/hiredis/dict.c",
"chars": 10549,
"preview": "/* Hash table implementation.\n *\n * This file implements in memory hash tables with insert/del/replace/find/\n * get-rand"
},
{
"path": "deps/hiredis/dict.h",
"chars": 4691,
"preview": "/* Hash table implementation.\n *\n * This file implements in memory hash tables with insert/del/replace/find/\n * get-rand"
},
{
"path": "deps/hiredis/example-ae.c",
"chars": 1516,
"preview": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <signal.h>\n#include \"hiredis.h\"\n#include \"async.h\"\n#"
},
{
"path": "deps/hiredis/example-libev.c",
"chars": 1404,
"preview": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <signal.h>\n#include \"hiredis.h\"\n#include \"async.h\"\n#"
},
{
"path": "deps/hiredis/example-libevent.c",
"chars": 1454,
"preview": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <signal.h>\n#include \"hiredis.h\"\n#include \"async.h\"\n#"
},
{
"path": "deps/hiredis/example.c",
"chars": 1876,
"preview": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include \"hiredis.h\"\n\nint main(void) {\n unsigned int j;\n "
},
{
"path": "deps/hiredis/fmacros.h",
"chars": 303,
"preview": "#ifndef __HIREDIS_FMACRO_H\n#define __HIREDIS_FMACRO_H\n\n#if !defined(_BSD_SOURCE)\n#define _BSD_SOURCE\n#endif\n\n#if defined"
},
{
"path": "deps/hiredis/hiredis.c",
"chars": 36704,
"preview": "/*\n * Copyright (c) 2009-2011, Salvatore Sanfilippo <antirez at gmail dot com>\n * Copyright (c) 2010-2011, Pieter Noordh"
},
{
"path": "deps/hiredis/hiredis.h",
"chars": 8919,
"preview": "/*\n * Copyright (c) 2009-2011, Salvatore Sanfilippo <antirez at gmail dot com>\n * Copyright (c) 2010-2011, Pieter Noordh"
},
{
"path": "deps/hiredis/net.c",
"chars": 9366,
"preview": "/* Extracted from anet.c to work properly with Hiredis error reporting.\n *\n * Copyright (c) 2006-2011, Salvatore Sanfili"
},
{
"path": "deps/hiredis/net.h",
"chars": 2180,
"preview": "/* Extracted from anet.c to work properly with Hiredis error reporting.\n *\n * Copyright (c) 2006-2011, Salvatore Sanfili"
},
{
"path": "deps/hiredis/sds.c",
"chars": 28337,
"preview": "/* SDSLib, A C dynamic strings library\n *\n * Copyright (c) 2006-2012, Salvatore Sanfilippo <antirez at gmail dot com>\n *"
},
{
"path": "deps/hiredis/sds.h",
"chars": 3560,
"preview": "/* SDSLib, A C dynamic strings library\n *\n * Copyright (c) 2006-2010, Salvatore Sanfilippo <antirez at gmail dot com>\n *"
},
{
"path": "deps/hiredis/test.c",
"chars": 23151,
"preview": "#include \"fmacros.h\"\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <strings.h>\n#include <sys/time."
},
{
"path": "deps/hiredis/zmalloc.h",
"chars": 267,
"preview": "/* Drop in replacement for zmalloc.h in order to just use libc malloc without\n * any wrappering. */\n\n#ifndef ZMALLOC_H\n#"
},
{
"path": "deps/jemalloc/.gitignore",
"chars": 373,
"preview": "/autom4te.cache/\n/config.stamp\n/config.log\n/config.status\n/doc/html.xsl\n/doc/manpages.xsl\n/doc/jemalloc.xml\n/lib/\n/Makef"
},
{
"path": "deps/jemalloc/COPYING",
"chars": 1703,
"preview": "Unless otherwise specified, files in the jemalloc source distribution are\nsubject to the following license:\n------------"
},
{
"path": "deps/jemalloc/ChangeLog",
"chars": 16365,
"preview": "Following are change highlights associated with official releases. Important\nbug fixes are all mentioned, but internal "
},
{
"path": "deps/jemalloc/INSTALL",
"chars": 9973,
"preview": "Building and installing jemalloc can be as simple as typing the following while\nin the root directory of the source tree"
},
{
"path": "deps/jemalloc/Makefile.in",
"chars": 9296,
"preview": "# Clear out all vpaths, then set just one (default vpath) for the main build\n# directory.\nvpath\nvpath % .\n\n# Clear the d"
},
{
"path": "deps/jemalloc/README",
"chars": 750,
"preview": "jemalloc is a general-purpose scalable concurrent malloc(3) implementation.\nThis distribution is a \"portable\" implementa"
},
{
"path": "deps/jemalloc/VERSION",
"chars": 50,
"preview": "3.2.0-0-g87499f6748ebe4817571e817e9f680ccb5bf54a9\n"
},
{
"path": "deps/jemalloc/autogen.sh",
"chars": 266,
"preview": "#!/bin/sh\n\nfor i in autoconf; do\n echo \"$i\"\n $i\n if [ $? -ne 0 ]; then\n\techo \"Error $? in $i\"\n\texit 1\n fi\ndo"
},
{
"path": "deps/jemalloc/bin/jemalloc.sh.in",
"chars": 151,
"preview": "#!/bin/sh\n\nprefix=@prefix@\nexec_prefix=@exec_prefix@\nlibdir=@libdir@\n\n@LD_PRELOAD_VAR@=${libdir}/libjemalloc.@SOREV@\nexp"
},
{
"path": "deps/jemalloc/bin/pprof",
"chars": 170502,
"preview": "#! /usr/bin/env perl\n\n# Copyright (c) 1998-2007, Google Inc.\n# All rights reserved.\n# \n# Redistribution and use in sourc"
},
{
"path": "deps/jemalloc/config.guess",
"chars": 44826,
"preview": "#! /bin/sh\n# Attempt to guess a canonical system name.\n# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,"
},
{
"path": "deps/jemalloc/config.stamp.in",
"chars": 0,
"preview": ""
},
{
"path": "deps/jemalloc/config.sub",
"chars": 35454,
"preview": "#! /bin/sh\n# Configuration validation subroutine script.\n# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 199"
},
{
"path": "deps/jemalloc/configure",
"chars": 227873,
"preview": "#! /bin/sh\n# Guess values for system-dependent variables and create Makefiles.\n# Generated by GNU Autoconf 2.68.\n#\n#\n# C"
},
{
"path": "deps/jemalloc/configure.ac",
"chars": 39187,
"preview": "dnl Process this file with autoconf to produce a configure script.\nAC_INIT([Makefile.in])\n\ndnl ========================="
},
{
"path": "deps/jemalloc/doc/html.xsl.in",
"chars": 203,
"preview": "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">\n <xsl:import href=\"@XSLROOT@/html/docbo"
},
{
"path": "deps/jemalloc/doc/jemalloc.3",
"chars": 49680,
"preview": "'\\\" t\n.\\\" Title: JEMALLOC\n.\\\" Author: Jason Evans\n.\\\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook."
},
{
"path": "deps/jemalloc/doc/jemalloc.html",
"chars": 96188,
"preview": "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\"><title>JEMALLOC</title><meta name=\"g"
},
{
"path": "deps/jemalloc/doc/jemalloc.xml.in",
"chars": 91599,
"preview": "<?xml version='1.0' encoding='UTF-8'?>\n<?xml-stylesheet type=\"text/xsl\"\n href=\"http://docbook.sourceforge.net/rel"
},
{
"path": "deps/jemalloc/doc/manpages.xsl.in",
"chars": 207,
"preview": "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">\n <xsl:import href=\"@XSLROOT@/manpages/d"
},
{
"path": "deps/jemalloc/doc/stylesheet.xsl",
"chars": 303,
"preview": "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">\n <xsl:param name=\"funcsynopsis.style\">a"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/arena.h",
"chars": 30728,
"preview": "/******************************************************************************/\n#ifdef JEMALLOC_H_TYPES\n\n/*\n * RUN_MAX_"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/atomic.h",
"chars": 7206,
"preview": "/******************************************************************************/\n#ifdef JEMALLOC_H_TYPES\n\n#endif /* JEMA"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/base.h",
"chars": 911,
"preview": "/******************************************************************************/\n#ifdef JEMALLOC_H_TYPES\n\n#endif /* JEMA"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/bitmap.h",
"chars": 5200,
"preview": "/******************************************************************************/\n#ifdef JEMALLOC_H_TYPES\n\n/* Maximum bit"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/chunk.h",
"chars": 2062,
"preview": "/******************************************************************************/\n#ifdef JEMALLOC_H_TYPES\n\n/*\n * Size and"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/chunk_dss.h",
"chars": 1197,
"preview": "/******************************************************************************/\n#ifdef JEMALLOC_H_TYPES\n\ntypedef enum {"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/chunk_mmap.h",
"chars": 802,
"preview": "/******************************************************************************/\n#ifdef JEMALLOC_H_TYPES\n\n#endif /* JEMA"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/ckh.h",
"chars": 2733,
"preview": "/******************************************************************************/\n#ifdef JEMALLOC_H_TYPES\n\ntypedef struct"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/ctl.h",
"chars": 3368,
"preview": "/******************************************************************************/\n#ifdef JEMALLOC_H_TYPES\n\ntypedef struct"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/extent.h",
"chars": 1339,
"preview": "/******************************************************************************/\n#ifdef JEMALLOC_H_TYPES\n\ntypedef struct"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/hash.h",
"chars": 1849,
"preview": "/******************************************************************************/\n#ifdef JEMALLOC_H_TYPES\n\n#endif /* JEMA"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/huge.h",
"chars": 1460,
"preview": "/******************************************************************************/\n#ifdef JEMALLOC_H_TYPES\n\n#endif /* JEMA"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/jemalloc_internal.h.in",
"chars": 25926,
"preview": "#ifndef JEMALLOC_INTERNAL_H\n#define JEMALLOC_INTERNAL_H\n#include <math.h>\n#ifdef _WIN32\n# include <windows.h>\n# define"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/mb.h",
"chars": 2687,
"preview": "/******************************************************************************/\n#ifdef JEMALLOC_H_TYPES\n\n#endif /* JEMA"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/mutex.h",
"chars": 2670,
"preview": "/******************************************************************************/\n#ifdef JEMALLOC_H_TYPES\n\ntypedef struct"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/private_namespace.h",
"chars": 19812,
"preview": "#define\ta0calloc JEMALLOC_N(a0calloc)\n#define\ta0free JEMALLOC_N(a0free)\n#define\ta0malloc JEMALLOC_N(a0malloc)\n#define\tar"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/prng.h",
"chars": 2017,
"preview": "/******************************************************************************/\n#ifdef JEMALLOC_H_TYPES\n\n/*\n * Simple l"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/prof.h",
"chars": 16809,
"preview": "/******************************************************************************/\n#ifdef JEMALLOC_H_TYPES\n\ntypedef struct"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/ql.h",
"chars": 2373,
"preview": "/*\n * List definitions.\n */\n#define ql_head(a_type)\t\t\t\t\t\t\t\\\nstruct {\t\t\t\t\t\t\t\t\\\n\ta_type *qlh_first;\t\t\t\t\t\t\\\n}\n\n#define ql_h"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/qr.h",
"chars": 2255,
"preview": "/* Ring definitions. */\n#define qr(a_type)\t\t\t\t\t\t\t\\\nstruct {\t\t\t\t\t\t\t\t\\\n\ta_type\t*qre_next;\t\t\t\t\t\t\\\n\ta_type\t*qre_prev;\t\t\t\t\t\t\\"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/quarantine.h",
"chars": 820,
"preview": "/******************************************************************************/\n#ifdef JEMALLOC_H_TYPES\n\n/* Default per"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/rb.h",
"chars": 37051,
"preview": "/*-\n *******************************************************************************\n *\n * cpp macro implementation of l"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/rtree.h",
"chars": 4862,
"preview": "/*\n * This radix tree implementation is tailored to the singular purpose of\n * tracking which chunks are currently owned"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/size_classes.sh",
"chars": 3302,
"preview": "#!/bin/sh\n\n# The following limits are chosen such that they cover all supported platforms.\n\n# Range of quanta.\nlg_qmin=3"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/stats.h",
"chars": 4424,
"preview": "/******************************************************************************/\n#ifdef JEMALLOC_H_TYPES\n\ntypedef struct"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/tcache.h",
"chars": 12014,
"preview": "/******************************************************************************/\n#ifdef JEMALLOC_H_TYPES\n\ntypedef struct"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/tsd.h",
"chars": 12228,
"preview": "/******************************************************************************/\n#ifdef JEMALLOC_H_TYPES\n\n/* Maximum num"
},
{
"path": "deps/jemalloc/include/jemalloc/internal/util.h",
"chars": 3983,
"preview": "/******************************************************************************/\n#ifdef JEMALLOC_H_TYPES\n\n/* Size of sta"
},
{
"path": "deps/jemalloc/include/jemalloc/jemalloc.h.in",
"chars": 5176,
"preview": "#ifndef JEMALLOC_H_\n#define\tJEMALLOC_H_\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include <limits.h>\n#include <strings.h>"
},
{
"path": "deps/jemalloc/include/jemalloc/jemalloc_defs.h.in",
"chars": 7803,
"preview": "/*\n * If JEMALLOC_PREFIX is defined via --with-jemalloc-prefix, it will cause all\n * public APIs to be prefixed. This m"
},
{
"path": "deps/jemalloc/include/msvc_compat/inttypes.h",
"chars": 8491,
"preview": "// ISO C9x compliant inttypes.h for Microsoft Visual Studio\n// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) "
},
{
"path": "deps/jemalloc/include/msvc_compat/stdbool.h",
"chars": 331,
"preview": "#ifndef stdbool_h\n#define stdbool_h\n\n#include <wtypes.h>\n\n/* MSVC doesn't define _Bool or bool in C, but does have BOOL "
},
{
"path": "deps/jemalloc/include/msvc_compat/stdint.h",
"chars": 7728,
"preview": "// ISO C9x compliant stdint.h for Microsoft Visual Studio\n// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG"
},
{
"path": "deps/jemalloc/include/msvc_compat/strings.h",
"chars": 370,
"preview": "#ifndef strings_h\n#define strings_h\n\n/* MSVC doesn't define ffs/ffsl. This dummy strings.h header is provided\n * for bot"
},
{
"path": "deps/jemalloc/install-sh",
"chars": 5585,
"preview": "#! /bin/sh\n#\n# install - install a program, script, or datafile\n# This comes from X11R5 (mit/util/scripts/install.sh).\n#"
},
{
"path": "deps/jemalloc/src/arena.c",
"chars": 70246,
"preview": "#define\tJEMALLOC_ARENA_C_\n#include \"jemalloc/internal/jemalloc_internal.h\"\n\n/*******************************************"
},
{
"path": "deps/jemalloc/src/atomic.c",
"chars": 76,
"preview": "#define\tJEMALLOC_ATOMIC_C_\n#include \"jemalloc/internal/jemalloc_internal.h\"\n"
},
{
"path": "deps/jemalloc/src/base.c",
"chars": 2785,
"preview": "#define\tJEMALLOC_BASE_C_\n#include \"jemalloc/internal/jemalloc_internal.h\"\n\n/********************************************"
},
{
"path": "deps/jemalloc/src/bitmap.c",
"chars": 2516,
"preview": "#define JEMALLOC_BITMAP_C_\n#include \"jemalloc/internal/jemalloc_internal.h\"\n\n/******************************************"
},
{
"path": "deps/jemalloc/src/chunk.c",
"chars": 10713,
"preview": "#define\tJEMALLOC_CHUNK_C_\n#include \"jemalloc/internal/jemalloc_internal.h\"\n\n/*******************************************"
},
{
"path": "deps/jemalloc/src/chunk_dss.c",
"chars": 4167,
"preview": "#define\tJEMALLOC_CHUNK_DSS_C_\n#include \"jemalloc/internal/jemalloc_internal.h\"\n/****************************************"
},
{
"path": "deps/jemalloc/src/chunk_mmap.c",
"chars": 4930,
"preview": "#define\tJEMALLOC_CHUNK_MMAP_C_\n#include \"jemalloc/internal/jemalloc_internal.h\"\n\n/**************************************"
},
{
"path": "deps/jemalloc/src/ckh.c",
"chars": 14994,
"preview": "/*\n *******************************************************************************\n * Implementation of (2^1+,2) cuckoo"
},
{
"path": "deps/jemalloc/src/ctl.c",
"chars": 46429,
"preview": "#define\tJEMALLOC_CTL_C_\n#include \"jemalloc/internal/jemalloc_internal.h\"\n\n/*********************************************"
},
{
"path": "deps/jemalloc/src/extent.c",
"chars": 973,
"preview": "#define\tJEMALLOC_EXTENT_C_\n#include \"jemalloc/internal/jemalloc_internal.h\"\n\n/******************************************"
},
{
"path": "deps/jemalloc/src/hash.c",
"chars": 74,
"preview": "#define\tJEMALLOC_HASH_C_\n#include \"jemalloc/internal/jemalloc_internal.h\"\n"
},
{
"path": "deps/jemalloc/src/huge.c",
"chars": 6764,
"preview": "#define\tJEMALLOC_HUGE_C_\n#include \"jemalloc/internal/jemalloc_internal.h\"\n\n/********************************************"
},
{
"path": "deps/jemalloc/src/jemalloc.c",
"chars": 44022,
"preview": "#define\tJEMALLOC_C_\n#include \"jemalloc/internal/jemalloc_internal.h\"\n\n/*************************************************"
},
{
"path": "deps/jemalloc/src/mb.c",
"chars": 72,
"preview": "#define\tJEMALLOC_MB_C_\n#include \"jemalloc/internal/jemalloc_internal.h\"\n"
},
{
"path": "deps/jemalloc/src/mutex.c",
"chars": 3339,
"preview": "#define\tJEMALLOC_MUTEX_C_\n#include \"jemalloc/internal/jemalloc_internal.h\"\n\n#if defined(JEMALLOC_LAZY_LOCK) && !defined("
},
{
"path": "deps/jemalloc/src/prof.c",
"chars": 30101,
"preview": "#define\tJEMALLOC_PROF_C_\n#include \"jemalloc/internal/jemalloc_internal.h\"\n/*********************************************"
},
{
"path": "deps/jemalloc/src/quarantine.c",
"chars": 6017,
"preview": "#include \"jemalloc/internal/jemalloc_internal.h\"\n\n/*\n * quarantine pointers close to NULL are used to encode state infor"
},
{
"path": "deps/jemalloc/src/rtree.c",
"chars": 1435,
"preview": "#define\tJEMALLOC_RTREE_C_\n#include \"jemalloc/internal/jemalloc_internal.h\"\n\nrtree_t *\nrtree_new(unsigned bits)\n{\n\trtree_"
},
{
"path": "deps/jemalloc/src/stats.c",
"chars": 16926,
"preview": "#define\tJEMALLOC_STATS_C_\n#include \"jemalloc/internal/jemalloc_internal.h\"\n\n#define\tCTL_GET(n, v, t) do {\t\t\t\t\t\t\\\n\tsize_t"
},
{
"path": "deps/jemalloc/src/tcache.c",
"chars": 12951,
"preview": "#define\tJEMALLOC_TCACHE_C_\n#include \"jemalloc/internal/jemalloc_internal.h\"\n\n/******************************************"
},
{
"path": "deps/jemalloc/src/tsd.c",
"chars": 1956,
"preview": "#define\tJEMALLOC_TSD_C_\n#include \"jemalloc/internal/jemalloc_internal.h\"\n\n/*********************************************"
},
{
"path": "deps/jemalloc/src/util.c",
"chars": 13718,
"preview": "#define\tassert(e) do {\t\t\t\t\t\t\t\\\n\tif (config_debug && !(e)) {\t\t\t\t\t\\\n\t\tmalloc_write(\"<jemalloc>: Failed assertion\\n\");\t\t\\\n\t"
},
{
"path": "deps/jemalloc/src/zone.c",
"chars": 6930,
"preview": "#include \"jemalloc/internal/jemalloc_internal.h\"\n#ifndef JEMALLOC_ZONE\n# error \"This source file is for zones on Darwin"
},
{
"path": "deps/jemalloc/test/ALLOCM_ARENA.c",
"chars": 1367,
"preview": "#define\tJEMALLOC_MANGLE\n#include \"jemalloc_test.h\"\n\n#define\tNTHREADS 10\n\nvoid *\nje_thread_start(void *arg)\n{\n\tunsigned t"
},
{
"path": "deps/jemalloc/test/ALLOCM_ARENA.exp",
"chars": 20,
"preview": "Test begin\nTest end\n"
},
{
"path": "deps/jemalloc/test/aligned_alloc.c",
"chars": 2691,
"preview": "#define\tJEMALLOC_MANGLE\n#include \"jemalloc_test.h\"\n\n#define CHUNK 0x400000\n/* #define MAXALIGN ((size_t)UINT64_C(0x80000"
},
{
"path": "deps/jemalloc/test/aligned_alloc.exp",
"chars": 405,
"preview": "Test begin\nAlignment: 8\nAlignment: 16\nAlignment: 32\nAlignment: 64\nAlignment: 128\nAlignment: 256\nAlignment: 512\nAlignment"
},
{
"path": "deps/jemalloc/test/allocated.c",
"chars": 2325,
"preview": "#define\tJEMALLOC_MANGLE\n#include \"jemalloc_test.h\"\n\nvoid *\nje_thread_start(void *arg)\n{\n\tint err;\n\tvoid *p;\n\tuint64_t a0"
},
{
"path": "deps/jemalloc/test/allocated.exp",
"chars": 20,
"preview": "Test begin\nTest end\n"
},
{
"path": "deps/jemalloc/test/allocm.c",
"chars": 4654,
"preview": "#define\tJEMALLOC_MANGLE\n#include \"jemalloc_test.h\"\n\n#define CHUNK 0x400000\n/* #define MAXALIGN ((size_t)UINT64_C(0x80000"
},
{
"path": "deps/jemalloc/test/allocm.exp",
"chars": 405,
"preview": "Test begin\nAlignment: 8\nAlignment: 16\nAlignment: 32\nAlignment: 64\nAlignment: 128\nAlignment: 256\nAlignment: 512\nAlignment"
},
{
"path": "deps/jemalloc/test/bitmap.c",
"chars": 3057,
"preview": "#define\tJEMALLOC_MANGLE\n#include \"jemalloc_test.h\"\n\n#if (LG_BITMAP_MAXBITS > 12)\n# define MAXBITS\t4500\n#else\n# define "
},
{
"path": "deps/jemalloc/test/bitmap.exp",
"chars": 20,
"preview": "Test begin\nTest end\n"
},
{
"path": "deps/jemalloc/test/jemalloc_test.h.in",
"chars": 1129,
"preview": "/*\n * This header should be included by tests, rather than directly including\n * jemalloc/jemalloc.h, because --with-ins"
},
{
"path": "deps/jemalloc/test/mremap.c",
"chars": 1141,
"preview": "#define\tJEMALLOC_MANGLE\n#include \"jemalloc_test.h\"\n\nint\nmain(void)\n{\n\tint ret, err;\n\tsize_t sz, lg_chunk, chunksize, i;\n"
},
{
"path": "deps/jemalloc/test/mremap.exp",
"chars": 20,
"preview": "Test begin\nTest end\n"
},
{
"path": "deps/jemalloc/test/posix_memalign.c",
"chars": 2561,
"preview": "#define\tJEMALLOC_MANGLE\n#include \"jemalloc_test.h\"\n\n#define CHUNK 0x400000\n/* #define MAXALIGN ((size_t)UINT64_C(0x80000"
},
{
"path": "deps/jemalloc/test/posix_memalign.exp",
"chars": 405,
"preview": "Test begin\nAlignment: 8\nAlignment: 16\nAlignment: 32\nAlignment: 64\nAlignment: 128\nAlignment: 256\nAlignment: 512\nAlignment"
},
{
"path": "deps/jemalloc/test/rallocm.c",
"chars": 2813,
"preview": "#define\tJEMALLOC_MANGLE\n#include \"jemalloc_test.h\"\n\nint\nmain(void)\n{\n\tsize_t pagesize;\n\tvoid *p, *q;\n\tsize_t sz, tsz;\n\ti"
},
{
"path": "deps/jemalloc/test/rallocm.exp",
"chars": 20,
"preview": "Test begin\nTest end\n"
},
{
"path": "deps/jemalloc/test/thread_arena.c",
"chars": 1581,
"preview": "#define\tJEMALLOC_MANGLE\n#include \"jemalloc_test.h\"\n\n#define\tNTHREADS 10\n\nvoid *\nje_thread_start(void *arg)\n{\n\tunsigned m"
},
{
"path": "deps/jemalloc/test/thread_arena.exp",
"chars": 20,
"preview": "Test begin\nTest end\n"
},
{
"path": "deps/jemalloc/test/thread_tcache_enabled.c",
"chars": 1727,
"preview": "#define\tJEMALLOC_MANGLE\n#include \"jemalloc_test.h\"\n\nvoid *\nje_thread_start(void *arg)\n{\n\tint err;\n\tsize_t sz;\n\tbool e0, "
},
{
"path": "deps/jemalloc/test/thread_tcache_enabled.exp",
"chars": 20,
"preview": "Test begin\nTest end\n"
},
{
"path": "deps/linenoise/.gitignore",
"chars": 19,
"preview": "linenoise_example*\n"
},
{
"path": "deps/linenoise/Makefile",
"chars": 315,
"preview": "STD=\nWARN= -Wall\nOPT= -Os\n\nR_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS)\nR_LDFLAGS= $(LDFLAGS)\nDEBUG= -g\n\nR_CC=$(CC"
},
{
"path": "deps/linenoise/README.markdown",
"chars": 3256,
"preview": "# Linenoise\n\nA minimal, zero-config, BSD licensed, readline replacement.\n\nNews: linenoise is now part of [Android](http:"
},
{
"path": "deps/linenoise/example.c",
"chars": 701,
"preview": "#include <stdio.h>\n#include <stdlib.h>\n#include \"linenoise.h\"\n\n\nvoid completion(const char *buf, linenoiseCompletions *l"
},
{
"path": "deps/linenoise/linenoise.c",
"chars": 35402,
"preview": "/* linenoise.c -- guerrilla line editing library against the idea that a\n * line editing lib needs to be 20,000 lines of"
},
{
"path": "deps/linenoise/linenoise.h",
"chars": 2519,
"preview": "/* linenoise.h -- guerrilla line editing library against the idea that a\n * line editing lib needs to be 20,000 lines of"
},
{
"path": "deps/lua/COPYRIGHT",
"chars": 1528,
"preview": "Lua License\n-----------\n\nLua is licensed under the terms of the MIT license reproduced below.\nThis means that Lua is fre"
},
{
"path": "deps/lua/HISTORY",
"chars": 7907,
"preview": "HISTORY for Lua 5.1\n\n* Changes from version 5.0 to 5.1\n -------------------------------\n Language:\n + new module syst"
},
{
"path": "deps/lua/INSTALL",
"chars": 3868,
"preview": "INSTALL for Lua 5.1\n\n* Building Lua\n ------------\n Lua is built in the src directory, but the build process can be\n c"
},
{
"path": "deps/lua/Makefile",
"chars": 3695,
"preview": "# makefile for installing Lua\n# see INSTALL for installation instructions\n# see src/Makefile and src/luaconf.h for furth"
},
{
"path": "deps/lua/README",
"chars": 1378,
"preview": "README for Lua 5.1\n\nSee INSTALL for installation instructions.\nSee HISTORY for a summary of changes since the last relea"
},
{
"path": "deps/lua/doc/contents.html",
"chars": 22482,
"preview": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<HTML>\n<HEAD>\n<TITLE>Lua 5.1 Reference Manual - contents"
},
{
"path": "deps/lua/doc/lua.1",
"chars": 3619,
"preview": ".\\\" $Id: lua.man,v 1.11 2006/01/06 16:03:34 lhf Exp $\n.TH LUA 1 \"$Date: 2006/01/06 16:03:34 $\"\n.SH NAME\nlua \\- Lua inter"
},
{
"path": "deps/lua/doc/lua.css",
"chars": 1306,
"preview": "body {\n\tcolor: #000000 ;\n\tbackground-color: #FFFFFF ;\n\tfont-family: Helvetica, Arial, sans-serif ;\n\ttext-align: justify "
},
{
"path": "deps/lua/doc/lua.html",
"chars": 3951,
"preview": "<!-- $Id: lua.man,v 1.11 2006/01/06 16:03:34 lhf Exp $ -->\n<HTML>\n<HEAD>\n<TITLE>LUA man page</TITLE>\n<LINK REL=\"styleshe"
},
{
"path": "deps/lua/doc/luac.1",
"chars": 3617,
"preview": ".\\\" $Id: luac.man,v 1.28 2006/01/06 16:03:34 lhf Exp $\n.TH LUAC 1 \"$Date: 2006/01/06 16:03:34 $\"\n.SH NAME\nluac \\- Lua co"
},
{
"path": "deps/lua/doc/luac.html",
"chars": 3896,
"preview": "<!-- $Id: luac.man,v 1.28 2006/01/06 16:03:34 lhf Exp $ -->\n<HTML>\n<HEAD>\n<TITLE>LUAC man page</TITLE>\n<LINK REL=\"styles"
},
{
"path": "deps/lua/doc/manual.css",
"chars": 341,
"preview": "h3 code {\n\tfont-family: inherit ;\n\tfont-size: inherit ;\n}\n\npre, code {\n\tfont-size: 12pt ;\n}\n\nspan.apii {\n\tfloat: right ;"
},
{
"path": "deps/lua/doc/manual.html",
"chars": 254745,
"preview": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<html>\n\n<head>\n<title>Lua 5.1 Reference Manual</title>\n<"
},
{
"path": "deps/lua/doc/readme.html",
"chars": 834,
"preview": "<HTML>\n<HEAD>\n<TITLE>Lua documentation</TITLE>\n<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"lua.css\">\n</HEAD>\n\n<BODY>\n\n<"
},
{
"path": "deps/lua/etc/Makefile",
"chars": 912,
"preview": "# makefile for Lua etc\n\nTOP= ..\nLIB= $(TOP)/src\nINC= $(TOP)/src\nBIN= $(TOP)/src\nSRC= $(TOP)/src\nTST= $(TOP)/test\n\nCC= gc"
},
{
"path": "deps/lua/etc/README",
"chars": 972,
"preview": "This directory contains some useful files and code.\nUnlike the code in ../src, everything here is in the public domain.\n"
},
{
"path": "deps/lua/etc/all.c",
"chars": 678,
"preview": "/*\n* all.c -- Lua core, libraries and interpreter in a single file\n*/\n\n#define luaall_c\n\n#include \"lapi.c\"\n#include \"lco"
},
{
"path": "deps/lua/etc/lua.hpp",
"chars": 191,
"preview": "// lua.hpp\n// Lua header files for C++\n// <<extern \"C\">> not supplied automatically because Lua also compiles as C++\n\nex"
},
{
"path": "deps/lua/etc/lua.pc",
"chars": 658,
"preview": "# lua.pc -- pkg-config data for Lua\n\n# vars from install Makefile\n\n# grep '^V=' ../Makefile\nV= 5.1\n# grep '^R=' ../Makef"
},
{
"path": "deps/lua/etc/luavs.bat",
"chars": 1070,
"preview": "@rem Script to build Lua under \"Visual Studio .NET Command Prompt\".\r\n@rem Do not run from this directory; run it from th"
},
{
"path": "deps/lua/etc/min.c",
"chars": 800,
"preview": "/*\n* min.c -- a minimal Lua interpreter\n* loads stdin only with minimal error handling.\n* no interaction, and no standar"
},
{
"path": "deps/lua/etc/noparser.c",
"chars": 1253,
"preview": "/*\n* The code below can be used to make a Lua core that does not contain the\n* parsing modules (lcode, llex, lparser), w"
},
{
"path": "deps/lua/etc/strict.lua",
"chars": 928,
"preview": "--\n-- strict.lua\n-- checks uses of undeclared global variables\n-- All global variables must be 'declared' through a regu"
},
{
"path": "deps/lua/src/Makefile",
"chars": 6183,
"preview": "# makefile for building Lua\n# see ../INSTALL for installation instructions\n# see ../Makefile and luaconf.h for further c"
},
{
"path": "deps/lua/src/lapi.c",
"chars": 22708,
"preview": "/*\n** $Id: lapi.c,v 2.55.1.5 2008/07/04 18:41:18 roberto Exp $\n** Lua API\n** See Copyright Notice in lua.h\n*/\n\n\n#include"
},
{
"path": "deps/lua/src/lapi.h",
"chars": 262,
"preview": "/*\n** $Id: lapi.h,v 2.2.1.1 2007/12/27 13:02:25 roberto Exp $\n** Auxiliary functions from Lua API\n** See Copyright Notic"
},
{
"path": "deps/lua/src/lauxlib.c",
"chars": 17417,
"preview": "/*\n** $Id: lauxlib.c,v 1.159.1.3 2008/01/21 13:20:51 roberto Exp $\n** Auxiliary functions for building Lua libraries\n** "
},
{
"path": "deps/lua/src/lauxlib.h",
"chars": 5777,
"preview": "/*\n** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $\n** Auxiliary functions for building Lua libraries\n** S"
},
{
"path": "deps/lua/src/lbaselib.c",
"chars": 17045,
"preview": "/*\n** $Id: lbaselib.c,v 1.191.1.6 2008/02/14 16:46:22 roberto Exp $\n** Basic library\n** See Copyright Notice in lua.h\n*/"
},
{
"path": "deps/lua/src/lcode.c",
"chars": 21170,
"preview": "/*\n** $Id: lcode.c,v 2.25.1.5 2011/01/31 14:53:16 roberto Exp $\n** Code generator for Lua\n** See Copyright Notice in lua"
},
{
"path": "deps/lua/src/lcode.h",
"chars": 2750,
"preview": "/*\n** $Id: lcode.h,v 1.48.1.1 2007/12/27 13:02:25 roberto Exp $\n** Code generator for Lua\n** See Copyright Notice in lua"
},
{
"path": "deps/lua/src/ldblib.c",
"chars": 10092,
"preview": "/*\n** $Id: ldblib.c,v 1.104.1.4 2009/08/04 18:50:18 roberto Exp $\n** Interface from Lua to its debug API\n** See Copyrigh"
},
{
"path": "deps/lua/src/ldebug.c",
"chars": 16840,
"preview": "/*\n** $Id: ldebug.c,v 2.29.1.6 2008/05/08 16:56:26 roberto Exp $\n** Debug Interface\n** See Copyright Notice in lua.h\n*/\n"
},
{
"path": "deps/lua/src/ldebug.h",
"chars": 1061,
"preview": "/*\n** $Id: ldebug.h,v 2.3.1.1 2007/12/27 13:02:25 roberto Exp $\n** Auxiliary functions from Debug Interface module\n** Se"
},
{
"path": "deps/lua/src/ldo.c",
"chars": 14892,
"preview": "/*\n** $Id: ldo.c,v 2.38.1.4 2012/01/18 02:27:10 roberto Exp $\n** Stack and Call structure of Lua\n** See Copyright Notice"
},
{
"path": "deps/lua/src/ldo.h",
"chars": 1897,
"preview": "/*\n** $Id: ldo.h,v 2.7.1.1 2007/12/27 13:02:25 roberto Exp $\n** Stack and Call structure of Lua\n** See Copyright Notice "
},
{
"path": "deps/lua/src/ldump.c",
"chars": 3114,
"preview": "/*\n** $Id: ldump.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $\n** save precompiled Lua chunks\n** See Copyright Notice in"
},
{
"path": "deps/lua/src/lfunc.c",
"chars": 4618,
"preview": "/*\n** $Id: lfunc.c,v 2.12.1.2 2007/12/28 14:58:43 roberto Exp $\n** Auxiliary functions to manipulate prototypes and clos"
},
{
"path": "deps/lua/src/lfunc.h",
"chars": 1125,
"preview": "/*\n** $Id: lfunc.h,v 2.4.1.1 2007/12/27 13:02:25 roberto Exp $\n** Auxiliary functions to manipulate prototypes and closu"
},
{
"path": "deps/lua/src/lgc.c",
"chars": 20053,
"preview": "/*\n** $Id: lgc.c,v 2.38.1.2 2011/03/18 18:05:38 roberto Exp $\n** Garbage Collector\n** See Copyright Notice in lua.h\n*/\n\n"
},
{
"path": "deps/lua/src/lgc.h",
"chars": 3159,
"preview": "/*\n** $Id: lgc.h,v 2.15.1.1 2007/12/27 13:02:25 roberto Exp $\n** Garbage Collector\n** See Copyright Notice in lua.h\n*/\n\n"
},
{
"path": "deps/lua/src/linit.c",
"chars": 765,
"preview": "/*\n** $Id: linit.c,v 1.14.1.1 2007/12/27 13:02:25 roberto Exp $\n** Initialization of libraries for lua.c\n** See Copyrigh"
},
{
"path": "deps/lua/src/liolib.c",
"chars": 13466,
"preview": "/*\n** $Id: liolib.c,v 2.73.1.4 2010/05/14 15:33:51 roberto Exp $\n** Standard I/O (and system) library\n** See Copyright N"
},
{
"path": "deps/lua/src/llex.c",
"chars": 12501,
"preview": "/*\n** $Id: llex.c,v 2.20.1.2 2009/11/23 14:58:22 roberto Exp $\n** Lexical Analyzer\n** See Copyright Notice in lua.h\n*/\n\n"
},
{
"path": "deps/lua/src/llex.h",
"chars": 2177,
"preview": "/*\n** $Id: llex.h,v 1.58.1.1 2007/12/27 13:02:25 roberto Exp $\n** Lexical Analyzer\n** See Copyright Notice in lua.h\n*/\n\n"
},
{
"path": "deps/lua/src/llimits.h",
"chars": 2349,
"preview": "/*\n** $Id: llimits.h,v 1.69.1.1 2007/12/27 13:02:25 roberto Exp $\n** Limits, basic types, and some other `installation-d"
},
{
"path": "deps/lua/src/lmathlib.c",
"chars": 5831,
"preview": "/*\n** $Id: lmathlib.c,v 1.67.1.1 2007/12/27 13:02:25 roberto Exp $\n** Standard mathematical library\n** See Copyright Not"
},
{
"path": "deps/lua/src/lmem.c",
"chars": 2172,
"preview": "/*\n** $Id: lmem.c,v 1.70.1.1 2007/12/27 13:02:25 roberto Exp $\n** Interface to Memory Manager\n** See Copyright Notice in"
},
{
"path": "deps/lua/src/lmem.h",
"chars": 1494,
"preview": "/*\n** $Id: lmem.h,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $\n** Interface to Memory Manager\n** See Copyright Notice in"
},
{
"path": "deps/lua/src/loadlib.c",
"chars": 19216,
"preview": "/*\n** $Id: loadlib.c,v 1.52.1.4 2009/09/09 13:17:16 roberto Exp $\n** Dynamic library loader for Lua\n** See Copyright Not"
},
{
"path": "deps/lua/src/lobject.c",
"chars": 5498,
"preview": "/*\n** $Id: lobject.c,v 2.22.1.1 2007/12/27 13:02:25 roberto Exp $\n** Some generic functions over Lua objects\n** See Copy"
},
{
"path": "deps/lua/src/lobject.h",
"chars": 8502,
"preview": "/*\n** $Id: lobject.h,v 2.20.1.2 2008/08/06 13:29:48 roberto Exp $\n** Type definitions for Lua objects\n** See Copyright N"
},
{
"path": "deps/lua/src/lopcodes.c",
"chars": 2884,
"preview": "/*\n** $Id: lopcodes.c,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $\n** See Copyright Notice in lua.h\n*/\n\n\n#define lopcode"
},
{
"path": "deps/lua/src/lopcodes.h",
"chars": 8086,
"preview": "/*\n** $Id: lopcodes.h,v 1.125.1.1 2007/12/27 13:02:25 roberto Exp $\n** Opcodes for Lua virtual machine\n** See Copyright "
},
{
"path": "deps/lua/src/loslib.c",
"chars": 5992,
"preview": "/*\n** $Id: loslib.c,v 1.19.1.3 2008/01/18 16:38:18 roberto Exp $\n** Standard Operating System library\n** See Copyright N"
},
{
"path": "deps/lua/src/lparser.c",
"chars": 36696,
"preview": "/*\n** $Id: lparser.c,v 2.42.1.4 2011/10/21 19:31:42 roberto Exp $\n** Lua Parser\n** See Copyright Notice in lua.h\n*/\n\n\n#i"
},
{
"path": "deps/lua/src/lparser.h",
"chars": 2261,
"preview": "/*\n** $Id: lparser.h,v 1.57.1.1 2007/12/27 13:02:25 roberto Exp $\n** Lua Parser\n** See Copyright Notice in lua.h\n*/\n\n#if"
},
{
"path": "deps/lua/src/lstate.c",
"chars": 5674,
"preview": "/*\n** $Id: lstate.c,v 2.36.1.2 2008/01/03 15:20:39 roberto Exp $\n** Global State\n** See Copyright Notice in lua.h\n*/\n\n\n#"
}
]
// ... and 224 more files (download for full content)
About this extraction
This page contains the full source code of the huangzworks/redis-3.0-annotated GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 424 files (4.9 MB), approximately 1.3M tokens, and a symbol index with 3098 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.