Skip to content

Commit

Permalink
Rename hashTypeEntryAllocSize to hashTypeEntryMemUsage
Browse files Browse the repository at this point in the history
Signed-off-by: Viktor Söderqvist <[email protected]>
  • Loading branch information
zuiderkwast committed Jan 21, 2025
1 parent df15b5b commit b79d924
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,7 @@ size_t objectComputeSize(robj *key, robj *o, size_t sample_size, int dbid) {

asize = sizeof(*o) + hashtableMemUsage(ht);
while (hashtableNext(&iter, &next) && samples < sample_size) {
elesize += hashTypeEntryAllocSize(next);
elesize += hashTypeEntryMemUsage(next);
samples++;
}
hashtableResetIterator(&iter);
Expand Down
2 changes: 1 addition & 1 deletion src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -3237,7 +3237,7 @@ typedef void hashTypeEntry;
hashTypeEntry *hashTypeCreateEntry(sds field, sds value);
sds hashTypeEntryGetField(const hashTypeEntry *entry);
sds hashTypeEntryGetValue(const hashTypeEntry *entry);
size_t hashTypeEntryAllocSize(hashTypeEntry *entry);
size_t hashTypeEntryMemUsage(hashTypeEntry *entry);
hashTypeEntry *hashTypeEntryDefrag(hashTypeEntry *entry, void *(*defragfn)(void *), sds (*sdsdefragfn)(sds));
void dismissHashTypeEntry(hashTypeEntry *entry);
void freeHashTypeEntry(hashTypeEntry *entry);
Expand Down
6 changes: 3 additions & 3 deletions src/t_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ static hashTypeEntry *hashTypeEntryReplaceValue(hashTypeEntry *entry, sds value)
}
}

/* Returns allocation size of hashTypeEntry and data owned by hashTypeEntry,
* even if not embedded in the same allocation. */
size_t hashTypeEntryAllocSize(hashTypeEntry *entry) {
/* Returns memory usage of a hashTypeEntry, including all allocations owned by
* the hashTypeEntry. */
size_t hashTypeEntryMemUsage(hashTypeEntry *entry) {
switch (entryGetEncoding(entry)) {
case ENTRY_ENC_EMB_VALUE:
return zmalloc_usable_size(sdsAllocPtr(entry));
Expand Down

0 comments on commit b79d924

Please sign in to comment.