-
Notifications
You must be signed in to change notification settings - Fork 106
Binary safe strings #538
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
Merged
Merged
Binary safe strings #538
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ce8b753
Mark locations that need change for binary strings
lantiga c73d017
Sweeping change to binary safe strings
lantiga 4446ecb
Format code
lantiga ba5ec99
Fixes
lantiga 1392873
Remove repeated reply
lantiga 9abc25d
Formatting
lantiga 02e6c01
Fix stray NULL
lantiga 42e49be
Rely on HoldString where possible
lantiga e551a30
Update readies
lantiga e03fb39
Address PR comments
lantiga fb5a017
Free memory bug fix.
alonre24 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,21 +15,26 @@ | |
| #include "tensor.h" | ||
| #include "util/arr_rm_alloc.h" | ||
| #include "util/dict.h" | ||
| #include <pthread.h> | ||
|
|
||
| static uint64_t RAI_TensorDictKeyHashFunction(const void *key) { | ||
| return AI_dictGenHashFunction(key, strlen((char *)key)); | ||
| size_t len; | ||
| const char *buffer = RedisModule_StringPtrLen((RedisModuleString *)key, &len); | ||
| return AI_dictGenHashFunction(buffer, len); | ||
| } | ||
|
|
||
| static int RAI_TensorDictKeyStrcmp(void *privdata, const void *key1, const void *key2) { | ||
| const char *strKey1 = key1; | ||
| const char *strKey2 = key2; | ||
| return strcmp(strKey1, strKey2) == 0; | ||
| RedisModuleString *strKey1 = (RedisModuleString *)key1; | ||
| RedisModuleString *strKey2 = (RedisModuleString *)key2; | ||
| return RedisModule_StringCompare(strKey1, strKey2) == 0; | ||
| } | ||
|
|
||
| static void RAI_TensorDictKeyFree(void *privdata, void *key) { RedisModule_Free(key); } | ||
| static void RAI_TensorDictKeyFree(void *privdata, void *key) { | ||
| RedisModule_FreeString(NULL, (RedisModuleString *)key); | ||
| } | ||
|
|
||
| static void *RAI_TensorDictKeyDup(void *privdata, const void *key) { | ||
| return RedisModule_Strdup((char *)key); | ||
| return RedisModule_CreateStringFromString(NULL, (RedisModuleString *)key); | ||
|
||
| } | ||
|
|
||
| static void RAI_TensorDictValFree(void *privdata, void *obj) { | ||
|
|
@@ -105,11 +110,11 @@ int RAI_InitRunInfo(RedisAI_RunInfo **result) { | |
| if (!(rinfo->dagTensorsContext)) { | ||
| return REDISMODULE_ERR; | ||
| } | ||
| rinfo->dagTensorsLoadedContext = AI_dictCreate(&AI_dictTypeHeapStrings, NULL); | ||
| rinfo->dagTensorsLoadedContext = AI_dictCreate(&AI_dictTypeHeapRStrings, NULL); | ||
| if (!(rinfo->dagTensorsLoadedContext)) { | ||
| return REDISMODULE_ERR; | ||
| } | ||
| rinfo->dagTensorsPersistedContext = AI_dictCreate(&AI_dictTypeHeapStrings, NULL); | ||
| rinfo->dagTensorsPersistedContext = AI_dictCreate(&AI_dictTypeHeapRStrings, NULL); | ||
| if (!(rinfo->dagTensorsPersistedContext)) { | ||
| return REDISMODULE_ERR; | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RAI_HoldString ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's now the same code as above, so same consideration.