From ba74711e0609b92721fc2d5a13c90aa88f623254 Mon Sep 17 00:00:00 2001
From: Chris Lamb <chris@chris-lamb.co.uk>
Date: Wed, 4 Feb 2015 18:36:38 +0000
Subject: [PATCH] Support "1G" etc. units in CONFIG SET maxmemory

Signed-off-by: Chris Lamb <chris@chris-lamb.co.uk>
---
 src/config.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/config.c b/src/config.c
index 8255a56b..927d7e24 100644
--- a/src/config.c
+++ b/src/config.c
@@ -643,8 +643,9 @@ void configSetCommand(redisClient *c) {
         zfree(server.masterauth);
         server.masterauth = ((char*)o->ptr)[0] ? zstrdup(o->ptr) : NULL;
     } else if (!strcasecmp(c->argv[2]->ptr,"maxmemory")) {
-        if (getLongLongFromObject(o,&ll) == REDIS_ERR ||
-            ll < 0) goto badfmt;
+        int err;
+        ll = memtoll(o->ptr,&err);
+        if (err || ll < 0) goto badfmt;
         server.maxmemory = ll;
         if (server.maxmemory) {
             if (server.maxmemory < zmalloc_used_memory()) {