Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid creating empty bitmaps on R.BITOP command #12

Open
aviggiano opened this issue May 12, 2017 · 0 comments
Open

Avoid creating empty bitmaps on R.BITOP command #12

aviggiano opened this issue May 12, 2017 · 0 comments

Comments

@aviggiano
Copy link
Owner

The current implementation creates empty bitmaps for nonexistent source keys srckeys, which are then freed if necessary, since the API must be consistent with redis' native BITOP command.

    Bitmap* bitmap;
    if (srctype == REDISMODULE_KEYTYPE_EMPTY) {
      // "non-existent keys [...] are considered as a stream of zero bytes up to the length of the longest string"
      bitmap = bitmap_alloc();
      should_free[i] = true;
    }
    else {
      bitmap = RedisModule_ModuleTypeGetValue(srckey);
      should_free[i] = false;
    }
    bitmaps[i] = bitmap;

The presence of a should_free variable is specially disturbing, so I think we need to come up with something better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant