diff options
author | rsiddharth <s@ricketyspace.net> | 2019-10-05 01:05:04 -0400 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2020-04-17 20:56:34 -0400 |
commit | d13a86674889793f5a6f44e609def3086430494d (patch) | |
tree | 046ed27cf4391db21ff5273484f8b656dcefe2ec /nserver/src/protocol.c | |
parent | 63a4b5015fcbfcc54958a755993db19337132ed1 (diff) |
nserver/src/protocol.c: Update sscreate.
* nserver/src/protocol.c (sscreate): Flesh it out. Initial version.
* nserver/src/protocol.h: Include bstrlib, stats.
Diffstat (limited to 'nserver/src/protocol.c')
-rw-r--r-- | nserver/src/protocol.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/nserver/src/protocol.c b/nserver/src/protocol.c index 0d254cd..6963116 100644 --- a/nserver/src/protocol.c +++ b/nserver/src/protocol.c @@ -16,8 +16,22 @@ int ssinit() int sscreate(char *key) { + int rc = 0; + check(ssinit() == 0, "ssinit failed"); + // 1. create bstring from 'key'. + bstring k = bfromcstr(key); + check(k != NULL, "key creation failed"); + + // 2. allocate fresh Stats. + Stats *st = Stats_create(); + check(st != NULL, "stats creation failed"); + + // 3. add to hashmap. + rc = Hashmap_set(hash, k, st); + check(rc == 0, "hashmap set failed"); + return 0; error: return -1; |