mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
libs/libc/obstack: implement ptr and int growing functions
The new API is defined by GNU and implemented in other LibCs, such as Musl. This also modifies API of obstack_blank_fast and obstack_1grow_fast. These are defined as returning void and thus return value here is incompatibility with other implementations.
This commit is contained in:
@@ -91,3 +91,37 @@ void obstack_1grow(FAR struct obstack *h, char data)
|
||||
obstack_make_room(h, 1);
|
||||
obstack_1grow_fast(h, data);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: obstack_ptr_grow
|
||||
*
|
||||
* Description:
|
||||
* Grow object by one pointer.
|
||||
*
|
||||
* Input Parameters:
|
||||
* h: pointer to the handle to allocated object to
|
||||
* ptr: pointer to be added to the growing object
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void obstack_ptr_grow(FAR struct obstack *h, const void *ptr)
|
||||
{
|
||||
obstack_grow(h, &ptr, sizeof(void *));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: obstack_int_grow
|
||||
*
|
||||
* Description:
|
||||
* Grow object by one integer.
|
||||
*
|
||||
* Input Parameters:
|
||||
* h: pointer to the handle to allocated object to
|
||||
* data: integer to be added to the growing object
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void obstack_int_grow(FAR struct obstack *h, int data)
|
||||
{
|
||||
obstack_grow(h, &data, sizeof(int));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user