src/util/user.c
/**
 * user_registry_init() - initialize user registry
 * @registry:           user registry to operate on
 * @log:                destination of any log messages
 * @n_slots:            number of accounting slots
 * @maxima:             maxima for each slot
 *
 * Initialize a user registry. @n_slots defines the number of distinct
 * accounting slots that will be available on all users on that registry.
 *
 * Return: 0 on success, negative error code on failure.
 */
initialize user registry
@registry:           user registry to operate on
@log:                destination of any log messages
@n_slots:            number of accounting slots
@maxima:             maxima for each slot

Initialize a user registry. @n_slots defines the number of distinct
accounting slots that will be available on all users on that registry.

0 on success, negative error code on failure.
initialize user registry @registry : user registry to operate on @log : destination of any log messages @n_slots : number of accounting slots @maxima : maxima for each slot Initialize a user registry . @n_slots defines the number of distinct accounting slots that will be available on all users on that registry . 0 on success negative error code on failure .
int user_registry_init(UserRegistry *registry,
                       Log *log,
                       size_t n_slots,
                       const unsigned int *maxima) {
        static_assert(sizeof(*maxima) == sizeof(*registry->maxima),
                      "Type mismatch for maxima");
        *registry = (UserRegistry)USER_REGISTRY_NULL;
        registry->maxima = calloc(n_slots, sizeof(*registry->maxima));
        if (!registry->maxima)
                return error_origin(-ENOMEM);
        registry->log = log;
        registry->n_slots = n_slots;
        memcpy(registry->maxima, maxima, n_slots * sizeof(*registry->maxima));
        return 0;
}
int user_registry_init ( UserRegistry * registry , Log * log , size_t n_slots , const unsigned int * maxima ) { static_assert ( sizeof ( * maxima ) == sizeof ( * registry -> maxima ) , " " ) ; * registry = ( UserRegistry ) USER_REGISTRY_NULL ; registry -> maxima = calloc ( n_slots , sizeof ( * registry -> maxima ) ) ; if ( ! registry -> maxima ) return error_origin ( - ENOMEM ) ; registry -> log = log ; registry -> n_slots = n_slots ; memcpy ( registry -> maxima , maxima , n_slots * sizeof ( * registry -> maxima ) ) ; return 0 ; }
user_registry_init() - initialize user registry
 @registry:           user registry to operate on
 @log:                destination of any log messages
 @n_slots:            number of accounting slots
 @maxima:             maxima for each slot
user_registry_init () - initialize user registry @registry : user registry to operate on @log : destination of any log messages @n_slots : number of accounting slots @maxima : maxima for each slot