Skip to content

functions umf<pool/provider name>ops() should return const ptr. #1080

Closed
@lplewa

Description

@lplewa

Functions like umf_memory_provider_ops_t *umfOsMemoryProviderOps(void); should return const ptr.
They return static struct which should not by modified. Otherwise user can do something like this

 umf_memory_provider_ops_t *a = umfOsMemoryProviderOps(void);
 a.free = myFree();
umfProviderCreate(a, /*...*/);
/*...*/
*b = umfOsMemoryProviderOps(void);
umfProviderCreate(b, /*...*/); // still free is modified. 

This change require the change in users code. Unless they use auto, or they create provider in this way umfProviderCreate(umfOsMemoryProviderOps(), /*...*/);

Metadata

Metadata

Assignees

No one assigned

    Labels

    1.0 API readinessThings to be improved in API before 1.0 stable releasebugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions