Bladeren bron

Merge branch 'master' into websocket

Peter Dunkley 13 jaren geleden
bovenliggende
commit
7a3ce731e7
3 gewijzigde bestanden met toevoegingen van 10 en 24 verwijderingen
  1. 4 5
      modules/ndb_redis/README
  2. 3 4
      modules/ndb_redis/doc/ndb_redis_admin.xml
  3. 3 15
      modules/ndb_redis/redis_client.c

+ 4 - 5
modules/ndb_redis/README

@@ -167,19 +167,18 @@ if(redis_cmd("srvN", "HMGET foo_key field1 field3", "r")) {
 
 4.2.  redis_free(replyid)
 
-   Free a previous reply from memory. After this function call, accessing
-   to a freed replyid returns null value.
+   Frees data in a previous reply from memory. After this function call,
+   accessing to a freed replyid returns null value.
 
    It is not necessary to free a reply to use it again in a new redis_cmd
    function. When ndb_redis module closes, all pending replies are freed
-   automatically, so you only need to use this function if you perform a
-   lot of redis command requests with different replyid.
+   automatically.
 
    Example 1.3. redis_free usage
 ...
 After a redis command call:
         redis_cmd("srvN", "INCR cnt", "r");
 
-when reply not used anymore:
+free reply data:
         redis_free("r");
 ...

+ 3 - 4
modules/ndb_redis/doc/ndb_redis_admin.xml

@@ -168,14 +168,13 @@ if(redis_cmd("srvN", "HMGET foo_key field1 field3", "r")) {
 		<function moreinfo="none">redis_free(replyid)</function>
 	</title>
 	<para>
-		Free a previous reply from memory.
+		Frees data in a previous reply from memory.
 		After this function call, accessing to a freed replyid returns null value.
 	</para>
 	<para>
 		It is not necessary to free a reply to use it again in a new redis_cmd
 		function. When ndb_redis module closes, all pending replies are freed
-		automatically, so you only need to use this function if you perform a
-		lot of redis command requests with different replyid.
+		automatically.
 	</para>
 	<example>
 		<title><function>redis_free</function> usage</title>
@@ -184,7 +183,7 @@ if(redis_cmd("srvN", "HMGET foo_key field1 field3", "r")) {
 After a redis command call:
 	redis_cmd("srvN", "INCR cnt", "r");
 
-when reply not used anymore:
+free reply data:
 	redis_free("r");
 ...
 		</programlisting>

+ 3 - 15
modules/ndb_redis/redis_client.c

@@ -407,37 +407,25 @@ redisc_reply_t *redisc_get_reply(str *name)
  */
 int redisc_free_reply(str *name)
 {
-	redisc_reply_t *rpl, *prev_rpl, *next_rpl;
+	redisc_reply_t *rpl, *next_rpl;
 	unsigned int hid;
 
 	hid = get_hash1_raw(name->s, name->len);
 
-	prev_rpl = NULL;
 	rpl = _redisc_rpl_list;
 	while(rpl) {
 
 		if(rpl->hname==hid && rpl->rname.len==name->len
 		   && strncmp(rpl->rname.s, name->s, name->len)==0) {
 			next_rpl = rpl->next;
-			if(rpl->rplRedis)
+			if(rpl->rplRedis) {
 				freeReplyObject(rpl->rplRedis);
-
-			if(rpl->rname.s != NULL)
-				pkg_free(rpl->rname.s);
-
-			pkg_free(rpl);
-
-			if(prev_rpl==NULL) {
-				/* We delete first element in the list. */
-				_redisc_rpl_list = next_rpl;
-			} else {
-				prev_rpl->next = next_rpl;
+				rpl->rplRedis = NULL;
 			}
 
 			return 0;
 		}
 
-		prev_rpl = rpl;
 		rpl = rpl->next;
 	}