Fix minor code style issues
This commit is contained in:
parent
bdb3b1e7e6
commit
43a296656d
@ -44,26 +44,32 @@ struct gmio_memblock
|
||||
GMIO_C_LINKAGE_BEGIN
|
||||
|
||||
/*! Returns true if \p mblock is NULL or points to null/void memory */
|
||||
GMIO_LIB_EXPORT bool gmio_memblock_isnull(const struct gmio_memblock* mblock);
|
||||
GMIO_LIB_EXPORT
|
||||
bool gmio_memblock_isnull(const struct gmio_memblock* mblock);
|
||||
|
||||
/*! Returns an initialized gmio_memblock object
|
||||
*
|
||||
* If \p ptr is NULL then gmio_memblock::size is forced to \c 0
|
||||
*/
|
||||
GMIO_LIB_EXPORT struct gmio_memblock gmio_memblock(
|
||||
GMIO_LIB_EXPORT
|
||||
struct gmio_memblock gmio_memblock(
|
||||
void* ptr, size_t size, void (*func_deallocate)(void*));
|
||||
|
||||
/*! Returns a gmio_memblock object allocated with standard \c malloc() */
|
||||
GMIO_LIB_EXPORT struct gmio_memblock gmio_memblock_malloc(size_t size);
|
||||
GMIO_LIB_EXPORT
|
||||
struct gmio_memblock gmio_memblock_malloc(size_t size);
|
||||
|
||||
/*! Returns a gmio_memblock object allocated with standard \c calloc() */
|
||||
GMIO_LIB_EXPORT struct gmio_memblock gmio_memblock_calloc(size_t num, size_t size);
|
||||
GMIO_LIB_EXPORT
|
||||
struct gmio_memblock gmio_memblock_calloc(size_t num, size_t size);
|
||||
|
||||
/*! Returns a gmio_memblock object allocated with standard \c realloc() */
|
||||
GMIO_LIB_EXPORT struct gmio_memblock gmio_memblock_realloc(void* ptr, size_t size);
|
||||
GMIO_LIB_EXPORT
|
||||
struct gmio_memblock gmio_memblock_realloc(void* ptr, size_t size);
|
||||
|
||||
/*! Safe and convenient call to gmio_memblock::func_deallocate() */
|
||||
GMIO_LIB_EXPORT void gmio_memblock_deallocate(struct gmio_memblock* mblock);
|
||||
GMIO_LIB_EXPORT
|
||||
void gmio_memblock_deallocate(struct gmio_memblock* mblock);
|
||||
|
||||
/*! Typedef for a pointer to a function that creates an allocated mblock
|
||||
*
|
||||
@ -79,18 +85,21 @@ typedef struct gmio_memblock (*gmio_memblock_constructor_func_t)();
|
||||
*
|
||||
* This function is not thread-safe.
|
||||
*/
|
||||
GMIO_LIB_EXPORT void gmio_memblock_set_default_constructor(
|
||||
GMIO_LIB_EXPORT
|
||||
void gmio_memblock_set_default_constructor(
|
||||
gmio_memblock_constructor_func_t ctor);
|
||||
|
||||
/*! Returns the currently installed function to construct gmio_memblock objects
|
||||
*
|
||||
* It is initialized to <tt>gmio_memblock_malloc(128KB)</tt>
|
||||
*/
|
||||
GMIO_LIB_EXPORT gmio_memblock_constructor_func_t gmio_memblock_default_constructor();
|
||||
GMIO_LIB_EXPORT
|
||||
gmio_memblock_constructor_func_t gmio_memblock_default_constructor();
|
||||
|
||||
/*! Returns a gmio_memblock object created using the function
|
||||
* gmio_memblock_default_constructor() */
|
||||
GMIO_LIB_EXPORT struct gmio_memblock gmio_memblock_default();
|
||||
GMIO_LIB_EXPORT
|
||||
struct gmio_memblock gmio_memblock_default();
|
||||
|
||||
GMIO_C_LINKAGE_END
|
||||
|
||||
|
@ -133,20 +133,20 @@ static int gmio_stream_stdio_get_pos(void* cookie, struct gmio_streampos* pos)
|
||||
{
|
||||
fpos_t fpos;
|
||||
int res = fgetpos((FILE*)cookie, &fpos);
|
||||
memcpy(&pos->cookie[0], &fpos, sizeof(fpos_t));
|
||||
memcpy(pos->cookie, &fpos, sizeof(fpos_t));
|
||||
return res;
|
||||
}
|
||||
|
||||
static int gmio_stream_stdio_set_pos(void* cookie, const struct gmio_streampos* pos)
|
||||
{
|
||||
fpos_t fpos;
|
||||
memcpy(&fpos, &pos->cookie[0], sizeof(fpos_t));
|
||||
memcpy(&fpos, pos->cookie, sizeof(fpos_t));
|
||||
return fsetpos((FILE*)cookie, &fpos);
|
||||
}
|
||||
|
||||
struct gmio_stream gmio_stream_stdio(FILE* file)
|
||||
{
|
||||
struct gmio_stream stream = gmio_stream_null();
|
||||
struct gmio_stream stream = {0};
|
||||
stream.cookie = file;
|
||||
stream.func_at_end = gmio_stream_stdio_at_end;
|
||||
stream.func_error = gmio_stream_stdio_error;
|
||||
|
@ -38,7 +38,8 @@ GMIO_C_LINKAGE_BEGIN
|
||||
*
|
||||
* \return Error code (see gmio_core/error.h and stl_error.h)
|
||||
*/
|
||||
GMIO_LIBSTL_EXPORT int gmio_stl_read(
|
||||
GMIO_LIBSTL_EXPORT
|
||||
int gmio_stl_read(
|
||||
struct gmio_stream* stream,
|
||||
struct gmio_stl_mesh_creator* mesh_creator,
|
||||
const struct gmio_stl_read_options* options);
|
||||
@ -51,7 +52,8 @@ GMIO_LIBSTL_EXPORT int gmio_stl_read(
|
||||
* The file is opened with fopen() so \p filepath shall follow the file name
|
||||
* specifications of the running environment
|
||||
*/
|
||||
GMIO_LIBSTL_EXPORT int gmio_stl_read_file(
|
||||
GMIO_LIBSTL_EXPORT
|
||||
int gmio_stl_read_file(
|
||||
const char* filepath,
|
||||
struct gmio_stl_mesh_creator* mesh_creator,
|
||||
const struct gmio_stl_read_options* options);
|
||||
|
Loading…
Reference in New Issue
Block a user