"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/util.c" between
redis-6.2-rc3.tar.gz and redis-6.2.0.tar.gz

About: redis is an advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.

util.c  (redis-6.2-rc3):util.c  (redis-6.2.0)
skipping to change at line 247 skipping to change at line 247
char *endptr; char *endptr;
errno = 0; errno = 0;
val = strtoll(buf,&endptr,10); val = strtoll(buf,&endptr,10);
if ((val == 0 && errno == EINVAL) || *endptr != '\0') { if ((val == 0 && errno == EINVAL) || *endptr != '\0') {
if (err) *err = 1; if (err) *err = 1;
return 0; return 0;
} }
return val*mul; return val*mul;
} }
/* Search a memory buffer for any set of bytes, like strpbrk().
* Returns pointer to first found char or NULL.
*/
const char *mempbrk(const char *s, size_t len, const char *chars, size_t charsle
n) {
for (size_t j = 0; j < len; j++) {
for (size_t n = 0; n < charslen; n++)
if (s[j] == chars[n]) return &s[j];
}
return NULL;
}
/* Modify the buffer replacing all occurrences of chars from the 'from'
* set with the corresponding char in the 'to' set. Always returns s.
*/
char *memmapchars(char *s, size_t len, const char *from, const char *to, size_t
setlen) {
for (size_t j = 0; j < len; j++) {
for (size_t i = 0; i < setlen; i++) {
if (s[j] == from[i]) {
s[j] = to[i];
break;
}
}
}
return s;
}
/* Return the number of digits of 'v' when converted to string in radix 10. /* Return the number of digits of 'v' when converted to string in radix 10.
* See ll2string() for more information. */ * See ll2string() for more information. */
uint32_t digits10(uint64_t v) { uint32_t digits10(uint64_t v) {
if (v < 10) return 1; if (v < 10) return 1;
if (v < 100) return 2; if (v < 100) return 2;
if (v < 1000) return 3; if (v < 1000) return 3;
if (v < 1000000000000UL) { if (v < 1000000000000UL) {
if (v < 100000000UL) { if (v < 100000000UL) {
if (v < 1000000) { if (v < 1000000) {
if (v < 10000) return 4; if (v < 10000) return 4;
 End of changes. 1 change blocks. 
0 lines changed or deleted 29 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)