httpmessage  0.4.0
HTTP message parsing library
Macros
preprocessor.h File Reference

Preprocessor macro definitions. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define HMAPI
 C API exposition macro.
 
#define HTTPMESSAGE_C_BEGIN
 Begin extern C block.
 
#define HTTPMESSAGE_C_END
 End exter C block.
 
#define HTTPMESSAGE_TEXT_WRITE_FILE(_written, _file, _text, _length)
 Write content to file. More...
 
#define HTTPMESSAGE_PRINTF_FILE(_written, _file, ...)
 Write content to a file using *printf functions. More...
 
#define HTTPMESSAGE_STRING_WRITE_FILE(_written, _file, _string)   HTTPMESSAGE_TEXT_WRITE_FILE(_written, _file, (_string).text, (_string).length)
 Write string view content to file.
 
#define HTTPMESSAGE_TEXT_WRITE_BUFFER(_output, _output_size, _text, _length)
 Write arbitrary text to a buffer. update I/O buffer pointer and length. More...
 
#define HTTPMESSAGE_PRINTF_BUFFER(_output, _output_size, ...)
 Format a text and write it to a buffer. update I/O buffer pointer and length. More...
 
#define HTTPMESSAGE_STRING_WRITE_BUFFER(_output, _output_size, _string)   HTTPMESSAGE_TEXT_WRITE_BUFFER(_output, _output_size, (_string).text, (_string).length)
 

Detailed Description

Preprocessor macro definitions.

Macro Definition Documentation

◆ HTTPMESSAGE_PRINTF_BUFFER

#define HTTPMESSAGE_PRINTF_BUFFER (   _output,
  _output_size,
  ... 
)
Value:
{ \
int _result = snprintf (_output, _output_size, __VA_ARGS__); \
if (_result < 0) return _result; \
_output += (size_t)_result; _output_size -= (size_t)_result; \
}

Format a text and write it to a buffer. update I/O buffer pointer and length.

◆ HTTPMESSAGE_PRINTF_FILE

#define HTTPMESSAGE_PRINTF_FILE (   _written,
  _file,
  ... 
)
Value:
{ \
int _result = fprintf (_file, __VA_ARGS__); \
if (_result < 0) return _result; \
_written += (size_t)_result; \
}

Write content to a file using *printf functions.

◆ HTTPMESSAGE_STRING_WRITE_BUFFER

#define HTTPMESSAGE_STRING_WRITE_BUFFER (   _output,
  _output_size,
  _string 
)    HTTPMESSAGE_TEXT_WRITE_BUFFER(_output, _output_size, (_string).text, (_string).length)

Copy a string view to a buffer.

◆ HTTPMESSAGE_TEXT_WRITE_BUFFER

#define HTTPMESSAGE_TEXT_WRITE_BUFFER (   _output,
  _output_size,
  _text,
  _length 
)
Value:
{ \
if ((size_t)(_output_size) < (size_t)(_length)) return HTTPMESSAGE_ERROR_OVERFLOW; \
memcpy (_output, _text, _length); \
_output += (size_t)(_length); _output_size -= (size_t)(_length); \
}
Definition: httpmessage.h:34

Write arbitrary text to a buffer. update I/O buffer pointer and length.