Use const char pointer in redismodule.h as far as possible (#10064)
When I used C++ to develop a redis module. i used `string.data()` as the second parameter `ele` of `RedisModule_DigestAddStringBuffer`, but there is a warning, since we never change the `ele`, i think we should use `const char` for it. This PR adds const to just a handful of module APIs that required it, all not very widely used. The implication is a breaking change in terms of compilation error that's easy to resolve, and no ABI impact. The affected APIs are around Digest, Info injection, and Cluster bus messages.
This commit is contained in:
@@ -627,7 +627,7 @@ void MemAllocDigest(RedisModuleDigest *md, void *value) {
|
||||
|
||||
struct MemBlock *block = mem;
|
||||
while (block) {
|
||||
RedisModule_DigestAddStringBuffer(md, (unsigned char *)block->block, BLOCK_SIZE);
|
||||
RedisModule_DigestAddStringBuffer(md, (const char *)block->block, BLOCK_SIZE);
|
||||
block = block->next;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user