mirror of
https://github.com/wassname/ray.git
synced 2026-08-13 12:30:18 +08:00
Fix some nonstandard code (#9172)
Co-authored-by: Mehrdad <noreply@github.com>
This commit is contained in:
@@ -71,22 +71,22 @@ constexpr ObjectIDFlagsType kObjectTypeFlagBitMask = 0x1 << kObjectTypeBitsOffse
|
||||
inline void SetCreatedByTaskFlag(bool created_by_task, ObjectIDFlagsType *flags) {
|
||||
const ObjectIDFlagsType object_type_bits =
|
||||
static_cast<ObjectIDFlagsType>(created_by_task) << kCreatedByTaskBitsOffset;
|
||||
*flags = (*flags bitor object_type_bits);
|
||||
*flags = (*flags | object_type_bits);
|
||||
}
|
||||
|
||||
inline void SetObjectTypeFlag(ObjectType object_type, ObjectIDFlagsType *flags) {
|
||||
const ObjectIDFlagsType object_type_bits = static_cast<ObjectIDFlagsType>(object_type)
|
||||
<< kObjectTypeBitsOffset;
|
||||
*flags = (*flags bitor object_type_bits);
|
||||
*flags = (*flags | object_type_bits);
|
||||
}
|
||||
|
||||
inline bool CreatedByTask(ObjectIDFlagsType flags) {
|
||||
return ((flags bitand kCreatedByTaskFlagBitMask) >> kCreatedByTaskBitsOffset) != 0x0;
|
||||
return ((flags & kCreatedByTaskFlagBitMask) >> kCreatedByTaskBitsOffset) != 0x0;
|
||||
}
|
||||
|
||||
inline ObjectType GetObjectType(ObjectIDFlagsType flags) {
|
||||
const ObjectIDFlagsType object_type =
|
||||
(flags bitand kObjectTypeFlagBitMask) >> kObjectTypeBitsOffset;
|
||||
(flags & kObjectTypeFlagBitMask) >> kObjectTypeBitsOffset;
|
||||
return static_cast<ObjectType>(object_type);
|
||||
}
|
||||
|
||||
|
||||
@@ -295,9 +295,8 @@ int REDISMODULE_API_FUNC(RedisModule_AbortBlock)(RedisModuleBlockedClient *bc);
|
||||
long long REDISMODULE_API_FUNC(RedisModule_Milliseconds)(void);
|
||||
|
||||
/* This is included inline inside each Redis module. */
|
||||
static int RedisModule_Init(RedisModuleCtx *ctx, const char *name, int ver, int apiver)
|
||||
__attribute__((unused));
|
||||
static int RedisModule_Init(RedisModuleCtx *ctx, const char *name, int ver, int apiver) {
|
||||
static inline int RedisModule_Init(RedisModuleCtx *ctx, const char *name, int ver,
|
||||
int apiver) {
|
||||
void *getapifuncptr = ((void **)ctx)[0];
|
||||
RedisModule_GetApi = (int (*)(const char *, void *))getapifuncptr;
|
||||
REDISMODULE_GET_API(Alloc);
|
||||
|
||||
@@ -28,10 +28,8 @@ namespace rpc {
|
||||
// This macro wraps the logic to call a specific RPC method of a service,
|
||||
// to make it easier to implement a new RPC client.
|
||||
#define INVOKE_RPC_CALL(SERVICE, METHOD, request, callback, rpc_client) \
|
||||
({ \
|
||||
rpc_client->CallMethod<METHOD##Request, METHOD##Reply>( \
|
||||
&SERVICE::Stub::PrepareAsync##METHOD, request, callback); \
|
||||
})
|
||||
(rpc_client->CallMethod<METHOD##Request, METHOD##Reply>( \
|
||||
&SERVICE::Stub::PrepareAsync##METHOD, request, callback))
|
||||
|
||||
// Define a void RPC client method.
|
||||
#define VOID_RPC_CLIENT_METHOD(SERVICE, METHOD, rpc_client, SPECS) \
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user