Libparserutils
Functions
errors.c File Reference
#include <string.h>
#include <parserutils/errors.h>

Go to the source code of this file.

Functions

const char * parserutils_error_to_string (parserutils_error error)
 Convert a parserutils error code to a string. More...
 
parserutils_error parserutils_error_from_string (const char *str, size_t len)
 Convert a string representation of an error name to a parserutils error code. More...
 

Function Documentation

◆ parserutils_error_from_string()

parserutils_error parserutils_error_from_string ( const char *  str,
size_t  len 
)

Convert a string representation of an error name to a parserutils error code.

Parameters
strString containing error name
lenLength of string (bytes)
Returns
Error code, or PARSERUTILS_OK if unknown

Definition at line 59 of file errors.c.

References PARSERUTILS_BADENCODING, PARSERUTILS_BADPARM, PARSERUTILS_EOF, PARSERUTILS_FILENOTFOUND, PARSERUTILS_INVALID, PARSERUTILS_NEEDDATA, PARSERUTILS_NOMEM, and PARSERUTILS_OK.

◆ parserutils_error_to_string()

const char* parserutils_error_to_string ( parserutils_error  error)

Convert a parserutils error code to a string.

Parameters
errorThe error code to convert
Returns
Pointer to string representation of error, or NULL if unknown.

Definition at line 18 of file errors.c.

References PARSERUTILS_BADENCODING, PARSERUTILS_BADPARM, PARSERUTILS_EOF, PARSERUTILS_FILENOTFOUND, PARSERUTILS_INVALID, PARSERUTILS_NEEDDATA, PARSERUTILS_NOMEM, and PARSERUTILS_OK.