Skip to content

Commit

Permalink
Move canUseSharedObject to server.h.
Browse files Browse the repository at this point in the history
Signed-off-by: Chen Tianjie <[email protected]>
  • Loading branch information
CharlesChen888 committed May 6, 2024
1 parent 73395f3 commit 7f4c421
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 0 additions & 4 deletions src/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,10 +631,6 @@ void trimStringObjectIfNeeded(robj *o, int trim_small_values) {
}
}

int canUseSharedObject(void) {
return server.maxmemory == 0 || !(server.maxmemory_policy & MAXMEMORY_FLAG_NO_SHARED_INTEGERS);
}

/* Try to encode a string object in order to save space */
robj *tryObjectEncodingEx(robj *o, int try_trim) {
long value;
Expand Down
4 changes: 3 additions & 1 deletion src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -2808,7 +2808,9 @@ int collateStringObjects(const robj *a, const robj *b);
int equalStringObjects(robj *a, robj *b);
unsigned long long estimateObjectIdleTime(robj *o);
void trimStringObjectIfNeeded(robj *o, int trim_small_values);
int canUseSharedObject(void);
static inline int canUseSharedObject(void) {
return server.maxmemory == 0 || !(server.maxmemory_policy & MAXMEMORY_FLAG_NO_SHARED_INTEGERS);
}
#define sdsEncodedObject(objptr) (objptr->encoding == OBJ_ENCODING_RAW || objptr->encoding == OBJ_ENCODING_EMBSTR)

/* Synchronous I/O with timeout */
Expand Down

0 comments on commit 7f4c421

Please sign in to comment.