summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2012-01-02 15:24:32 -0800
committerPieter Noordhuis <pcnoordhuis@gmail.com>2012-01-02 15:24:50 -0800
commit9ea54feef0f2e62f7618da9b0ce3acce9f474db6 (patch)
treed28f3ef01a8e7926470ee36eb1e0945c82393b9a
parent2ebd2720b37dcca3b6e0c18377bd69e9eaf541fc (diff)
downloadredis-9ea54feef0f2e62f7618da9b0ce3acce9f474db6.tar.gz
string2* functions take a const pointer
-rw-r--r--src/util.c6
-rw-r--r--src/util.h4
2 files changed, 5 insertions, 5 deletions
diff --git a/src/util.c b/src/util.c
index f5a23af2a..f7437e1c2 100644
--- a/src/util.c
+++ b/src/util.c
@@ -209,8 +209,8 @@ int ll2string(char *s, size_t len, long long value) {
/* Convert a string into a long long. Returns 1 if the string could be parsed
* into a (non-overflowing) long long, 0 otherwise. The value will be set to
* the parsed value when appropriate. */
-int string2ll(char *s, size_t slen, long long *value) {
- char *p = s;
+int string2ll(const char *s, size_t slen, long long *value) {
+ const char *p = s;
size_t plen = 0;
int negative = 0;
unsigned long long v;
@@ -275,7 +275,7 @@ int string2ll(char *s, size_t slen, long long *value) {
/* Convert a string into a long. Returns 1 if the string could be parsed into a
* (non-overflowing) long, 0 otherwise. The value will be set to the parsed
* value when appropriate. */
-int string2l(char *s, size_t slen, long *lval) {
+int string2l(const char *s, size_t slen, long *lval) {
long long llval;
if (!string2ll(s,slen,&llval))
diff --git a/src/util.h b/src/util.h
index b897a89e7..59dd10ac7 100644
--- a/src/util.h
+++ b/src/util.h
@@ -5,8 +5,8 @@ int stringmatchlen(const char *p, int plen, const char *s, int slen, int nocase)
int stringmatch(const char *p, const char *s, int nocase);
long long memtoll(const char *p, int *err);
int ll2string(char *s, size_t len, long long value);
-int string2ll(char *s, size_t slen, long long *value);
-int string2l(char *s, size_t slen, long *value);
+int string2ll(const char *s, size_t slen, long long *value);
+int string2l(const char *s, size_t slen, long *value);
int d2string(char *buf, size_t len, double value);
#endif