Commit Graph

27 Commits

Author SHA1 Message Date
Tim Gates
f989670e59
docs: Fix simple typo, termined -> terminated
There is a small typo in sds.c.

Should read `terminated` rather than `termined`.
2020-09-26 20:58:09 +10:00
Michael Grunder
6448f735d5
sdsrange overflow fix (#830)
Fix overflow bug in `sdsrange`
2020-06-07 14:38:16 -07:00
Michael Grunder
8e0264cfd6
Allow users to replace allocator and handle OOM everywhere. (#800)
* Adds an indirection to every allocation/deallocation to allow users to 
  plug in ones of their choosing (use custom functions, jemalloc, etc).

* Gracefully handle OOM everywhere in hiredis.  This should make it possible
  for users of the library to have more flexibility in how they handle such situations.

* Changes `redisReaderTask->elements` from an `int` to a `long long` to prevent
  a possible overflow when transferring the task elements into a `redisReply`.

* Adds a configurable `max elements` member to `redisReader` that defaults to
  2^32 - 1.  This can be set to "unlimited" by setting the value to zero.
2020-05-22 09:27:49 -07:00
Muhammad Zahalqa
c8999c6602
Use standrad isxdigit instead of custom helper function. (#814)
Standard function available and on most platforms uses a lookup table and not
a check with 3 ranges.
2020-05-20 09:35:15 -07:00
Odin Hultgren Van Der Horst
a1d4da63b8 Removed whitespace before newline
- Removed whitespace before newline
 - Removed win style newline
2019-07-22 11:06:10 +02:00
charsyam
471557c349 fix common realloc mistake and add null check more 2018-03-17 17:41:43 +09:00
Jan-Erik Rediger
8636d90821 Avoid unchecked malloc
Closes #471
2016-12-09 10:51:26 +01:00
charsyam
f51fdfb7af remove unnessory code 2016-04-20 23:49:42 +09:00
charsyam
921e1aa84b remove unused code 2016-04-20 23:15:41 +09:00
Jan-Erik Rediger
63e1cf0c63 feat: Include latests changes from sds upstream 2016-04-20 15:27:38 +02:00
clark.kang
d76e13b6d5 apply sds from redis 2016-04-20 15:27:11 +02:00
charsyam
e2f6ee239c fixing typos 2015-10-28 02:19:24 +09:00
tzickel
ec229678c2 Added support for compiling the parser code with Microsoft Visual C compiler.
For hiredis-py and others support on windows.
2015-03-13 15:58:23 +02:00
Matt Stancliff
f28872ca70 Cleanup tabs and end of line whitespace 2015-01-05 16:53:23 -05:00
michael-grunder
40f7035ba4 Improve redisAppendCommandArgv performance
OK, perhaps the second time is a charm.  I forgot that I had
hiredis forked from a long time ago, so the initial pull
request was hosed.  :)

* Pulled in sdscatfmt() from Redis, and modified it to accept a
  size_t (%T) style format specifier.

* Pulled in sdsll2str() and sdsull2str() from Redis (needed by
  sdscatfmt).

* Added a new method, redisFormatSdsCommandArgv() which takes
  and sds* as the target, rather than char* (and uses sdscatfmt
  instead of sprintf for the construction).

I get roughly the following improvement:

Old: 1.044806
New: 0.481620

The benchmark code itself can be found here:
https://gist.github.com/michael-grunder/c92ef31bb632b3d0ad81

Closes #260
2015-01-05 11:21:38 -05:00
Gary Grossman
2d814b8da3 Fix minor comment problems
"sdscatpritf" -> "sdscatprintf"
Example used sdsempty("text") but should say sdsnew("text")

Closes #282
2015-01-05 11:21:38 -05:00
antirez
334525359a Upgrade sds to latest version
SDS is now broken out of Redis into its own project, so include
the latest version from the SDS repo.

This is a backport of the Redis commit doing the same to the bundled hiredis:
320fa02b9b
2014-04-09 17:02:42 -04:00
Charlie Somerville
81c95a5fd3 sds.c: avoid leaking tokens when seplen < 1 || len < 0 2014-01-15 11:38:02 +11:00
Richard Fuchs
b15650e13a va_copy must be followed by va_end 2013-07-02 12:41:13 -04:00
Pieter Noordhuis
ebb690ea99 Fix sdscatrepr 2011-04-21 21:02:04 +02:00
Pieter Noordhuis
ac9fb4993b Don't abort on OOM in sds.c 2011-04-21 18:37:43 +02:00
Pieter Noordhuis
cd7063e85b Inline sdslen and sdsavail (thanks to @bitbckt) 2011-04-19 22:59:26 +02:00
Pieter Noordhuis
5962a2de17 Add testhelp.h inline in sds.c 2011-01-19 13:41:31 +01:00
Pieter Noordhuis
7aa5fa102e Update string library 2011-01-19 13:41:25 +01:00
Pieter Noordhuis
3253105d49 Update sds code 2010-09-20 13:19:13 +02:00
Pierre Riteau
4693a51707 Constify the API and enable -Wwrite-strings
The API is more similar to printf now.
2010-05-25 14:02:14 +02:00
antirez
4f6fc6dfb1 hiredis was extracted from redis-tools, reverted to standard malloc/free, ported to the new protocol, and started as a stand alone project in order to support the need of a C client in the Redis community 2010-05-18 17:11:09 +02:00