Commit 3c6f9ac3 authored by Salvatore Sanfilippo's avatar Salvatore Sanfilippo
Browse files

Merge pull request #1902 from mattsta/comment-fixes

ALL comment fixes
parents 389ec305 be006163
...@@ -717,7 +717,7 @@ void scriptingInit(void) { ...@@ -717,7 +717,7 @@ void scriptingInit(void) {
server.lua_client->flags |= REDIS_LUA_CLIENT; server.lua_client->flags |= REDIS_LUA_CLIENT;
} }
/* Lua beginners ofter don't use "local", this is likely to introduce /* Lua beginners often don't use "local", this is likely to introduce
* subtle bugs in their code. To prevent problems we protect accesses * subtle bugs in their code. To prevent problems we protect accesses
* to global variables. */ * to global variables. */
scriptingEnableGlobalsProtection(lua); scriptingEnableGlobalsProtection(lua);
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
* The string is always null-termined (all the sds strings are, always) so * The string is always null-termined (all the sds strings are, always) so
* even if you create an sds string with: * even if you create an sds string with:
* *
* mystring = sdsnewlen("abc",3"); * mystring = sdsnewlen("abc",3);
* *
* You can print the string with printf() as there is an implicit \0 at the * You can print the string with printf() as there is an implicit \0 at the
* end of the string. However the string is binary safe and can contain * end of the string. However the string is binary safe and can contain
...@@ -109,7 +109,7 @@ void sdsupdatelen(sds s) { ...@@ -109,7 +109,7 @@ void sdsupdatelen(sds s) {
sh->len = reallen; sh->len = reallen;
} }
/* Modify an sds string on-place to make it empty (zero length). /* Modify an sds string in-place to make it empty (zero length).
* However all the existing buffer is not discarded but set as free space * However all the existing buffer is not discarded but set as free space
* so that next append operations will not require allocations up to the * so that next append operations will not require allocations up to the
* number of bytes previously available. */ * number of bytes previously available. */
......
...@@ -2106,7 +2106,7 @@ void sentinelPublishReplyCallback(redisAsyncContext *c, void *reply, void *privd ...@@ -2106,7 +2106,7 @@ void sentinelPublishReplyCallback(redisAsyncContext *c, void *reply, void *privd
* or sent directly to this sentinel via the (fake) PUBLISH command of Sentinel. * or sent directly to this sentinel via the (fake) PUBLISH command of Sentinel.
* *
* If the master name specified in the message is not known, the message is * If the master name specified in the message is not known, the message is
* discareded. */ * discarded. */
void sentinelProcessHelloMessage(char *hello, int hello_len) { void sentinelProcessHelloMessage(char *hello, int hello_len) {
/* Format is composed of 8 tokens: /* Format is composed of 8 tokens:
* 0=ip,1=port,2=runid,3=current_epoch,4=master_name, * 0=ip,1=port,2=runid,3=current_epoch,4=master_name,
......
...@@ -385,7 +385,7 @@ int string2l(const char *s, size_t slen, long *lval) { ...@@ -385,7 +385,7 @@ int string2l(const char *s, size_t slen, long *lval) {
} }
/* Convert a double to a string representation. Returns the number of bytes /* Convert a double to a string representation. Returns the number of bytes
* required. The representation should always be parsable by stdtod(3). */ * required. The representation should always be parsable by strtod(3). */
int d2string(char *buf, size_t len, double value) { int d2string(char *buf, size_t len, double value) {
if (isnan(value)) { if (isnan(value)) {
len = snprintf(buf,len,"nan"); len = snprintf(buf,len,"nan");
......
...@@ -183,7 +183,7 @@ static unsigned int zipIntSize(unsigned char encoding) { ...@@ -183,7 +183,7 @@ static unsigned int zipIntSize(unsigned char encoding) {
return 0; return 0;
} }
/* Encode the length 'l' writing it in 'p'. If p is NULL it just returns /* Encode the length 'rawlen' writing it in 'p'. If p is NULL it just returns
* the amount of bytes required to encode such a length. */ * the amount of bytes required to encode such a length. */
static unsigned int zipEncodeLength(unsigned char *p, unsigned char encoding, unsigned int rawlen) { static unsigned int zipEncodeLength(unsigned char *p, unsigned char encoding, unsigned int rawlen) {
unsigned char len = 1, buf[5]; unsigned char len = 1, buf[5];
...@@ -739,8 +739,8 @@ unsigned char *ziplistPrev(unsigned char *zl, unsigned char *p) { ...@@ -739,8 +739,8 @@ unsigned char *ziplistPrev(unsigned char *zl, unsigned char *p) {
} }
} }
/* Get entry pointed to by 'p' and store in either 'e' or 'v' depending /* Get entry pointed to by 'p' and store in either '*sstr' or 'sval' depending
* on the encoding of the entry. 'e' is always set to NULL to be able * on the encoding of the entry. '*sstr' is always set to NULL to be able
* to find out whether the string pointer or the integer value was set. * to find out whether the string pointer or the integer value was set.
* Return 0 if 'p' points to the end of the ziplist, 1 otherwise. */ * Return 0 if 'p' points to the end of the ziplist, 1 otherwise. */
unsigned int ziplistGet(unsigned char *p, unsigned char **sstr, unsigned int *slen, long long *sval) { unsigned int ziplistGet(unsigned char *p, unsigned char **sstr, unsigned int *slen, long long *sval) {
...@@ -788,7 +788,8 @@ unsigned char *ziplistDeleteRange(unsigned char *zl, unsigned int index, unsigne ...@@ -788,7 +788,8 @@ unsigned char *ziplistDeleteRange(unsigned char *zl, unsigned int index, unsigne
return (p == NULL) ? zl : __ziplistDelete(zl,p,num); return (p == NULL) ? zl : __ziplistDelete(zl,p,num);
} }
/* Compare entry pointer to by 'p' with 'entry'. Return 1 if equal. */ /* Compare entry pointer to by 'p' with 'sstr' of length 'slen'. */
/* Return 1 if equal. */
unsigned int ziplistCompare(unsigned char *p, unsigned char *sstr, unsigned int slen) { unsigned int ziplistCompare(unsigned char *p, unsigned char *sstr, unsigned int slen) {
zlentry entry; zlentry entry;
unsigned char sencoding; unsigned char sencoding;
......
# Cluster-specific test functions. # Cluster-specific test functions.
# #
# Copyright (C) 2014 Salvatore Sanfilippo antirez@gmail.com # Copyright (C) 2014 Salvatore Sanfilippo antirez@gmail.com
# This softare is released under the BSD License. See the COPYING file for # This software is released under the BSD License. See the COPYING file for
# more information. # more information.
# Returns a parsed CLUSTER NODES output as a list of dictionaries. # Returns a parsed CLUSTER NODES output as a list of dictionaries.
......
# Cluster test suite. Copyright (C) 2014 Salvatore Sanfilippo antirez@gmail.com # Cluster test suite. Copyright (C) 2014 Salvatore Sanfilippo antirez@gmail.com
# This softare is released under the BSD License. See the COPYING file for # This software is released under the BSD License. See the COPYING file for
# more information. # more information.
cd tests/cluster cd tests/cluster
......
...@@ -89,7 +89,7 @@ while {[incr iterations -1]} { ...@@ -89,7 +89,7 @@ while {[incr iterations -1]} {
test "Restarting node #$tokill" { test "Restarting node #$tokill" {
restart_instance redis $tokill restart_instance redis $tokill
} }
test "Instance #$tokill is now a slave" { test "Instance #$tokill is now a slave" {
wait_for_condition 1000 50 { wait_for_condition 1000 50 {
[RI $tokill role] eq {slave} [RI $tokill role] eq {slave}
......
...@@ -83,7 +83,7 @@ test "Cluster should eventually be up again" { ...@@ -83,7 +83,7 @@ test "Cluster should eventually be up again" {
assert_cluster_state ok assert_cluster_state ok
} }
test "Node #10 should eventaully replicate node #5" { test "Node #10 should eventually replicate node #5" {
set port5 [get_instance_attrib redis 5 port] set port5 [get_instance_attrib redis 5 port]
wait_for_condition 1000 50 { wait_for_condition 1000 50 {
([lindex [R 10 role] 2] == $port5) && ([lindex [R 10 role] 2] == $port5) &&
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# instances. # instances.
# #
# Copyright (C) 2014 Salvatore Sanfilippo antirez@gmail.com # Copyright (C) 2014 Salvatore Sanfilippo antirez@gmail.com
# This softare is released under the BSD License. See the COPYING file for # This software is released under the BSD License. See the COPYING file for
# more information. # more information.
package require Tcl 8.5 package require Tcl 8.5
......
...@@ -169,7 +169,7 @@ tags {"aof"} { ...@@ -169,7 +169,7 @@ tags {"aof"} {
assert_equal 1 [is_alive $srv] assert_equal 1 [is_alive $srv]
} }
test "Fixed AOF: Keyspace should contain values that were parsable" { test "Fixed AOF: Keyspace should contain values that were parseable" {
set client [redis [dict get $srv host] [dict get $srv port]] set client [redis [dict get $srv host] [dict get $srv port]]
wait_for_condition 50 100 { wait_for_condition 50 100 {
[catch {$client ping} e] == 0 [catch {$client ping} e] == 0
......
...@@ -35,17 +35,17 @@ start_server {tags {"repl"}} { ...@@ -35,17 +35,17 @@ start_server {tags {"repl"}} {
start_server {tags {"repl"}} { start_server {tags {"repl"}} {
r set mykey foo r set mykey foo
start_server {} { start_server {} {
test {Second server should have role master at first} { test {Second server should have role master at first} {
s role s role
} {master} } {master}
test {SLAVEOF should start with link status "down"} { test {SLAVEOF should start with link status "down"} {
r slaveof [srv -1 host] [srv -1 port] r slaveof [srv -1 host] [srv -1 port]
s master_link_status s master_link_status
} {down} } {down}
test {The role should immediately be changed to "slave"} { test {The role should immediately be changed to "slave"} {
s role s role
} {slave} } {slave}
...@@ -54,11 +54,11 @@ start_server {tags {"repl"}} { ...@@ -54,11 +54,11 @@ start_server {tags {"repl"}} {
test {Sync should have transferred keys from master} { test {Sync should have transferred keys from master} {
r get mykey r get mykey
} {foo} } {foo}
test {The link status should be up} { test {The link status should be up} {
s master_link_status s master_link_status
} {up} } {up}
test {SET on the master should immediately propagate} { test {SET on the master should immediately propagate} {
r -1 set mykey bar r -1 set mykey bar
......
# Sentinel test suite. Copyright (C) 2014 Salvatore Sanfilippo antirez@gmail.com # Sentinel test suite. Copyright (C) 2014 Salvatore Sanfilippo antirez@gmail.com
# This softare is released under the BSD License. See the COPYING file for # This software is released under the BSD License. See the COPYING file for
# more information. # more information.
cd tests/sentinel cd tests/sentinel
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# $r ping [list handlePong] # $r ping [list handlePong]
# } # }
# } # }
# #
# set r [redis] # set r [redis]
# $r blocking 0 # $r blocking 0
# $r get fo [list handlePong] # $r get fo [list handlePong]
......
...@@ -178,10 +178,10 @@ proc start_server {options {code undefined}} { ...@@ -178,10 +178,10 @@ proc start_server {options {code undefined}} {
dict set config $directive $arguments dict set config $directive $arguments
} }
} }
# use a different directory every time a server is started # use a different directory every time a server is started
dict set config dir [tmpdir server] dict set config dir [tmpdir server]
# start every server on a different port # start every server on a different port
set ::port [find_available_port [expr {$::port+1}]] set ::port [find_available_port [expr {$::port+1}]]
dict set config port $::port dict set config port $::port
...@@ -190,7 +190,7 @@ proc start_server {options {code undefined}} { ...@@ -190,7 +190,7 @@ proc start_server {options {code undefined}} {
foreach {directive arguments} [concat $::global_overrides $overrides] { foreach {directive arguments} [concat $::global_overrides $overrides] {
dict set config $directive $arguments dict set config $directive $arguments
} }
# write new configuration to temporary file # write new configuration to temporary file
set config_file [tmpfile redis.conf] set config_file [tmpfile redis.conf]
set fp [open $config_file w+] set fp [open $config_file w+]
...@@ -208,7 +208,7 @@ proc start_server {options {code undefined}} { ...@@ -208,7 +208,7 @@ proc start_server {options {code undefined}} {
} else { } else {
exec src/redis-server $config_file > $stdout 2> $stderr & exec src/redis-server $config_file > $stdout 2> $stderr &
} }
# check that the server actually started # check that the server actually started
# ugly but tries to be as fast as possible... # ugly but tries to be as fast as possible...
if {$::valgrind} {set retrynum 1000} else {set retrynum 100} if {$::valgrind} {set retrynum 1000} else {set retrynum 100}
...@@ -233,7 +233,7 @@ proc start_server {options {code undefined}} { ...@@ -233,7 +233,7 @@ proc start_server {options {code undefined}} {
start_server_error $config_file $err start_server_error $config_file $err
return return
} }
# find out the pid # find out the pid
while {![info exists pid]} { while {![info exists pid]} {
regexp {PID:\s(\d+)} [exec cat $stdout] _ pid regexp {PID:\s(\d+)} [exec cat $stdout] _ pid
......
...@@ -29,7 +29,7 @@ proc assert_error {pattern code} { ...@@ -29,7 +29,7 @@ proc assert_error {pattern code} {
if {[catch {uplevel 1 $code} error]} { if {[catch {uplevel 1 $code} error]} {
assert_match $pattern $error assert_match $pattern $error
} else { } else {
error "assertion:Expected an error but nothing was catched" error "assertion:Expected an error but nothing was caught"
} }
} }
......
# Redis test suite. Copyright (C) 2009 Salvatore Sanfilippo antirez@gmail.com # Redis test suite. Copyright (C) 2009 Salvatore Sanfilippo antirez@gmail.com
# This softare is released under the BSD License. See the COPYING file for # This software is released under the BSD License. See the COPYING file for
# more information. # more information.
package require Tcl 8.5 package require Tcl 8.5
...@@ -306,7 +306,7 @@ proc signal_idle_client fd { ...@@ -306,7 +306,7 @@ proc signal_idle_client fd {
} }
} }
# The the_end funciton gets called when all the test units were already # The the_end function gets called when all the test units were already
# executed, so the test finished. # executed, so the test finished.
proc the_end {} { proc the_end {} {
# TODO: print the status, exit with the rigth exit code. # TODO: print the status, exit with the rigth exit code.
......
...@@ -10,7 +10,7 @@ start_server {tags {"auth"} overrides {requirepass foobar}} { ...@@ -10,7 +10,7 @@ start_server {tags {"auth"} overrides {requirepass foobar}} {
catch {r auth wrong!} err catch {r auth wrong!} err
set _ $err set _ $err
} {ERR*invalid password} } {ERR*invalid password}
test {Arbitrary command gives an error when AUTH is required} { test {Arbitrary command gives an error when AUTH is required} {
catch {r set foo bar} err catch {r set foo bar} err
set _ $err set _ $err
......
...@@ -83,7 +83,7 @@ start_server {tags {"basic"}} { ...@@ -83,7 +83,7 @@ start_server {tags {"basic"}} {
for {set x 9999} {$x >= 0} {incr x -1} { for {set x 9999} {$x >= 0} {incr x -1} {
set val [r get $x] set val [r get $x]
if {$val ne $x} { if {$val ne $x} {
set err "Eleemnt at position $x is $val instead of $x" set err "Element at position $x is $val instead of $x"
break break
} }
} }
...@@ -323,7 +323,7 @@ start_server {tags {"basic"}} { ...@@ -323,7 +323,7 @@ start_server {tags {"basic"}} {
catch {r foobaredcommand} err catch {r foobaredcommand} err
string match ERR* $err string match ERR* $err
} {1} } {1}
test {RENAME basic usage} { test {RENAME basic usage} {
r set mykey hello r set mykey hello
r rename mykey mykey1 r rename mykey mykey1
...@@ -449,7 +449,7 @@ start_server {tags {"basic"}} { ...@@ -449,7 +449,7 @@ start_server {tags {"basic"}} {
r select 9 r select 9
format $res format $res
} {hello world foo bared} } {hello world foo bared}
test {MGET} { test {MGET} {
r flushdb r flushdb
r set foo BAR r set foo BAR
...@@ -505,7 +505,7 @@ start_server {tags {"basic"}} { ...@@ -505,7 +505,7 @@ start_server {tags {"basic"}} {
r set foo bar r set foo bar
list [r getset foo xyz] [r get foo] list [r getset foo xyz] [r get foo]
} {bar xyz} } {bar xyz}
test {MSET base case} { test {MSET base case} {
r mset x 10 y "foo bar" z "x x x x x x x\n\n\r\n" r mset x 10 y "foo bar" z "x x x x x x x\n\n\r\n"
r mget x y z r mget x y z
......
...@@ -125,7 +125,7 @@ start_server {tags {"bitops"}} { ...@@ -125,7 +125,7 @@ start_server {tags {"bitops"}} {
test {BITOP where dest and target are the same key} { test {BITOP where dest and target are the same key} {
r set s "\xaa\x00\xff\x55" r set s "\xaa\x00\xff\x55"
r bitop not s s r bitop not s s
r get s r get s
} "\x55\xff\x00\xaa" } "\x55\xff\x00\xaa"
test {BITOP AND|OR|XOR don't change the string with single input key} { test {BITOP AND|OR|XOR don't change the string with single input key} {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment