src/pomp_prot.c
static int pomp_prot_alloc_msg(struct pomp_prot *prot, uint32_t msgid,
		size_t size)
{
	int res = 0;

	/* Allocate new message if needed */
	if (prot->msg == NULL)
		prot->msg = pomp_msg_new();
	if (prot->msg == NULL)
		return -ENOMEM;

	/* Initialize message, setup buffer inside message */
	res = pomp_msg_init(prot->msg, msgid);
	if (res < 0)
		return res;
	return pomp_buffer_ensure_capacity(prot->msg->buf, size);
}
/**
 * Make sure the internal message object is properly allocated.
 * @param prot : protocol decoder.
 * @param msgid : message id to set.
 * @param size : total size of message to allocate.
 * @return 0 in case of success, negative errno value in case of error.
 */
Make sure the internal message object is properly allocated.
@param prot : protocol decoder.
@param msgid : message id to set.
@param size : total size of message to allocate.
@return 0 in case of success, negative errno value in case of error.
Make sure the internal message object is properly allocated . @param prot : protocol decoder . @param msgid : message id to set . @param size : total size of message to allocate . @return 0 in case of success negative errno value in case of error .
static int pomp_prot_alloc_msg(struct pomp_prot *prot, uint32_t msgid,
		size_t size)
{
	int res = 0;
	if (prot->msg == NULL)
		prot->msg = pomp_msg_new();
	if (prot->msg == NULL)
		return -ENOMEM;
	res = pomp_msg_init(prot->msg, msgid);
	if (res < 0)
		return res;
	return pomp_buffer_ensure_capacity(prot->msg->buf, size);
}
static int pomp_prot_alloc_msg ( struct pomp_prot * prot , uint32_t msgid , size_t size ) { int res = 0 ; if ( prot -> msg == NULL ) prot -> msg = pomp_msg_new ( ) ; if ( prot -> msg == NULL ) return - ENOMEM ; res = pomp_msg_init ( prot -> msg , msgid ) ; if ( res < 0 ) return res ; return pomp_buffer_ensure_capacity ( prot -> msg -> buf , size ) ; }
Make sure the internal message object is properly allocated.
Make sure the internal message object is properly allocated .
/* Allocate new message if needed */ /* Initialize message, setup buffer inside message */