Skip to content

Commit

Permalink
Forgot to return something xD
Browse files Browse the repository at this point in the history
  • Loading branch information
Preetam Jinka committed Dec 27, 2013
1 parent e44c99a commit 49ed1e9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions test.c
Expand Up @@ -29,21 +29,21 @@ int main() {

printf("Incrementing version\n");

// version is now at 1.
// version is now at 2.
vlmap_version_increment(m);

// Remove "foo" at version 1.
// Remove "foo" at version 2.
vlmap_remove(m, vlmap_version(m), key, strlen(key));

// version is now at 2.
// version is now at 3.
vlmap_version_increment(m);

uint8_t* value;
int valuelength;

//vlmap_print(m);

// Get "foo" at version 2 -- this should be an error.
// Get "foo" at version 3 -- this should be an error.
int err = vlmap_get(m, vlmap_version(m), key, keylength, &value, &valuelength);

if(!err) {
Expand All @@ -53,22 +53,22 @@ int main() {
printf("`foo' is not present at version %d.\n", (int)vlmap_version(m));
}

err = vlmap_get(m, 0, key, keylength, &value, &valuelength);
err = vlmap_get(m, 1, key, keylength, &value, &valuelength);

if(!err) {
printf("foo => %.*s at version %d.\n", valuelength, value, 0);
printf("foo => %.*s at version %d.\n", valuelength, value, 1);
free(value);
} else {
printf("`foo' is not present at version %d.\n", 0);
}

err = vlmap_get(m, 1, key, keylength, &value, &valuelength);
err = vlmap_get(m, 2, key, keylength, &value, &valuelength);

if(!err) {
printf("foo => %.*s at version %d.\n", valuelength, value, 1);
printf("foo => %.*s at version %d.\n", valuelength, value, 2);
free(value);
} else {
printf("`foo' is not present at version %d.\n", 1);
printf("`foo' is not present at version %d.\n", 2);
}

vlmap_iterator* i = vlmap_create_iterator(m, 1, "\x00", 1, "\xff", 1);
Expand Down
1 change: 1 addition & 0 deletions vlmap.c
Expand Up @@ -31,6 +31,7 @@ vlmap_create() {
m->levels = 32;
m->root = (vlnode_t**)calloc(m->levels, sizeof(vlnode_t*));
m->version = 1;
return m;

This comment has been minimized.

Copy link
@Preetam

Preetam Dec 27, 2013

Owner

Oops :trollface:

}

void
Expand Down
1 change: 0 additions & 1 deletion vlmap.h
Expand Up @@ -38,7 +38,6 @@ typedef struct {
int endkeylen;
} vlmap_iterator;


// vlmap_create returns a pointer to a new vlmap.
vlmap*
vlmap_create();
Expand Down

0 comments on commit 49ed1e9

Please sign in to comment.