server/modules/selva/module/selva_object.c
static int init_object_array(struct SelvaObjectKey *key, enum SelvaObjectType subtype, size_t size) {
    /*
     * Type must be set before initializing the vector to avoid a situation
     * where we'd have a key with an unknown value type.
     */
    key->type = SELVA_OBJECT_ARRAY;
    key->subtype = subtype;

    key->array = RedisModule_Calloc(1, sizeof(SVector));
    if (!key->array) {
        return SELVA_ENOMEM;
    }

    if (!SVector_Init(key->array, size, NULL)) {
        RedisModule_Free(key->array);
        key->type = SELVA_OBJECT_NULL;
        key->subtype = SELVA_OBJECT_NULL;
        key->array = NULL;
        return SELVA_ENOMEM;
    }

    return 0;
}
/**
 * Init an array on key.
 * The key must be cleared before calling this function.
 */
Init an array on key.
The key must be cleared before calling this function.
Init an array on key . The key must be cleared before calling this function .
static int init_object_array(struct SelvaObjectKey *key, enum SelvaObjectType subtype, size_t size) {
    key->type = SELVA_OBJECT_ARRAY;
    key->subtype = subtype;
    key->array = RedisModule_Calloc(1, sizeof(SVector));
    if (!key->array) {
        return SELVA_ENOMEM;
    }
    if (!SVector_Init(key->array, size, NULL)) {
        RedisModule_Free(key->array);
        key->type = SELVA_OBJECT_NULL;
        key->subtype = SELVA_OBJECT_NULL;
        key->array = NULL;
        return SELVA_ENOMEM;
    }
    return 0;
}
static int init_object_array ( struct SelvaObjectKey * key , enum SelvaObjectType subtype , size_t size ) { key -> type = SELVA_OBJECT_ARRAY ; key -> subtype = subtype ; key -> array = RedisModule_Calloc ( 1 , sizeof ( SVector ) ) ; if ( ! key -> array ) { return SELVA_ENOMEM ; } if ( ! SVector_Init ( key -> array , size , NULL ) ) { RedisModule_Free ( key -> array ) ; key -> type = SELVA_OBJECT_NULL ; key -> subtype = SELVA_OBJECT_NULL ; key -> array = NULL ; return SELVA_ENOMEM ; } return 0 ; }
Init an array on key.
Init an array on key .
/*
     * Type must be set before initializing the vector to avoid a situation
     * where we'd have a key with an unknown value type.
     */