Skip to content

Commit

Permalink
[core.counter] Make the value parameter to add default to 1.
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneia committed Jul 9, 2015
1 parent a3ffff3 commit 9977f24
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/counter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ local counter_t = ffi.typeof("struct counter")

function open (name, readonly) return shm.map(name, counter_t, readonly) end
function set (counter, value) counter.c = value end
function add (counter, value) counter.c = counter.c + value end
function add (counter, value) counter.c = counter.c + (value or 1) end
function read (counter) return counter.c end

function selftest ()
Expand Down

0 comments on commit 9977f24

Please sign in to comment.