diff --git a/doc/shared/sunmemory/SUNMemory_Description.rst b/doc/shared/sunmemory/SUNMemory_Description.rst index 0dd9da86d0..4fe5e79561 100644 --- a/doc/shared/sunmemory/SUNMemory_Description.rst +++ b/doc/shared/sunmemory/SUNMemory_Description.rst @@ -20,7 +20,7 @@ This API consists of three new SUNDIALS types: :c:type:`SUNMemoryType`, :c:type:`SUNMemory`, and :c:type:`SUNMemoryHelper`: -.. c:type:: struct _SUNMemory *SUNMemory +.. c:type:: struct SUNMemory_ *SUNMemory The ``SUNMemory`` type is a pointer a structure containing a pointer to actual data (``ptr``), the data memory type, and a flag indicating ownership @@ -28,7 +28,7 @@ This API consists of three new SUNDIALS types: :c:type:`SUNMemoryType`, .. code-block:: c - struct _SUNMemory + struct SUNMemory_ { void* ptr; SUNMemoryType type; @@ -53,7 +53,7 @@ This API consists of three new SUNDIALS types: :c:type:`SUNMemoryType`, } SUNMemoryType; -.. c:type:: struct _SUNMemoryHelper *SUNMemoryHelper +.. c:type:: struct SUNMemoryHelper_ *SUNMemoryHelper The ``SUNMemoryHelper`` type is a pointer to a structure containing a pointer to the implementation-specific member data (``content``) and a virtual method @@ -61,7 +61,7 @@ This API consists of three new SUNDIALS types: :c:type:`SUNMemoryType`, .. code-block:: c - struct _SUNMemoryHelper + struct SUNMemoryHelper_ { void* content; SUNMemoryHelper_Ops ops; @@ -69,7 +69,7 @@ This API consists of three new SUNDIALS types: :c:type:`SUNMemoryType`, }; -.. c:type:: struct _SUNMemoryHelper_Ops *SUNMemoryHelper_Ops +.. c:type:: struct SUNMemoryHelper_Ops_ *SUNMemoryHelper_Ops The ``SUNMemoryHelper_Ops`` type is defined as a pointer to the structure containing the function pointers to the member function implementations. This @@ -77,7 +77,7 @@ This API consists of three new SUNDIALS types: :c:type:`SUNMemoryType`, .. code-block:: c - struct _SUNMemoryHelper_Ops + struct SUNMemoryHelper_Ops_ { /* operations that implementations are required to provide */ int (*alloc)(SUNMemoryHelper, SUNMemory* memptr size_t mem_size, diff --git a/include/sundials/sundials_memory.h b/include/sundials/sundials_memory.h index fe48e3a8a8..d1f1c643b5 100644 --- a/include/sundials/sundials_memory.h +++ b/include/sundials/sundials_memory.h @@ -39,9 +39,9 @@ typedef enum * and its ownership. */ -typedef struct _SUNMemory* SUNMemory; +typedef struct SUNMemory_* SUNMemory; -struct _SUNMemory +struct SUNMemory_ { void* ptr; SUNMemoryType type; @@ -57,17 +57,17 @@ SUNDIALS_EXPORT SUNMemory SUNMemoryNewEmpty(); * and copy SUNMemory. */ -typedef struct _SUNMemoryHelper_Ops* SUNMemoryHelper_Ops; -typedef struct _SUNMemoryHelper* SUNMemoryHelper; +typedef struct SUNMemoryHelper_Ops_* SUNMemoryHelper_Ops; +typedef struct SUNMemoryHelper_* SUNMemoryHelper; -struct _SUNMemoryHelper +struct SUNMemoryHelper_ { void* content; SUNMemoryHelper_Ops ops; SUNContext sunctx; }; -struct _SUNMemoryHelper_Ops +struct SUNMemoryHelper_Ops_ { /* operations that implementations are required to provide */ SUNErrCode (*alloc)(SUNMemoryHelper, SUNMemory* memptr, size_t mem_size, diff --git a/include/sundials/sundials_memory.hpp b/include/sundials/sundials_memory.hpp index b410a913ac..d0f3ee84e4 100644 --- a/include/sundials/sundials_memory.hpp +++ b/include/sundials/sundials_memory.hpp @@ -23,7 +23,7 @@ namespace sundials { namespace impl { -using BaseMemoryHelper = BaseObject<_SUNMemoryHelper, _SUNMemoryHelper_Ops>; +using BaseMemoryHelper = BaseObject; } // namespace impl namespace experimental { diff --git a/src/sundials/sundials_memory.c b/src/sundials/sundials_memory.c index 158169ce33..d488dea4e1 100644 --- a/src/sundials/sundials_memory.c +++ b/src/sundials/sundials_memory.c @@ -33,7 +33,7 @@ SUNMemory SUNMemoryNewEmpty() { SUNMemory mem = NULL; - mem = (SUNMemory)malloc(sizeof(struct _SUNMemory)); + mem = (SUNMemory)malloc(sizeof(struct SUNMemory_)); mem->bytes = 0; @@ -47,14 +47,14 @@ SUNMemoryHelper SUNMemoryHelper_NewEmpty(SUNContext sunctx) SUNFunctionBegin(sunctx); SUNMemoryHelper helper = NULL; - helper = (SUNMemoryHelper)malloc(sizeof(struct _SUNMemoryHelper)); + helper = (SUNMemoryHelper)malloc(sizeof(struct SUNMemoryHelper_)); SUNAssert(helper, SUN_ERR_MALLOC_FAIL); - helper->ops = (SUNMemoryHelper_Ops)malloc(sizeof(struct _SUNMemoryHelper_Ops)); + helper->ops = (SUNMemoryHelper_Ops)malloc(sizeof(struct SUNMemoryHelper_Ops_)); SUNAssert(helper->ops, SUN_ERR_MALLOC_FAIL); /* Set all ops to NULL */ - memset(helper->ops, 0, sizeof(struct _SUNMemoryHelper_Ops)); + memset(helper->ops, 0, sizeof(struct SUNMemoryHelper_Ops_)); helper->content = NULL; helper->sunctx = sunctx; @@ -63,7 +63,7 @@ SUNMemoryHelper SUNMemoryHelper_NewEmpty(SUNContext sunctx) SUNErrCode SUNMemoryHelper_CopyOps(SUNMemoryHelper src, SUNMemoryHelper dst) { - memcpy(dst->ops, src->ops, sizeof(struct _SUNMemoryHelper_Ops)); + memcpy(dst->ops, src->ops, sizeof(struct SUNMemoryHelper_Ops_)); return SUN_SUCCESS; }