zabbix-agent2/src/libs/zbxjson/json.c
/******************************************************************************
 *                                                                            *
 * Function: zbx_json_open                                                    *
 *                                                                            *
 * Purpose: open json buffer and check for brackets                           *
 *                                                                            *
 * Return value: SUCCESS - processed successfully                             *
 *               FAIL - an error occurred                                     *
 *                                                                            *
 ******************************************************************************/
zbx_json_open

Purpose: open json buffer and check for brackets

Return value: SUCCESS - processed successfully
FAIL - an error occurred
zbx_json_open Purpose : open json buffer and check for brackets Return value : SUCCESS - processed successfully FAIL - an error occurred
int	zbx_json_open(const char *buffer, struct zbx_json_parse *jp)
{
	char		*error = NULL;
	zbx_int64_t	len;
	SKIP_WHITESPACE(buffer);
	if ('\0' == *buffer)
		return FAIL;
	jp->start = buffer;
	jp->end = NULL;
	if (0 == (len = zbx_json_validate(jp->start, &error)))
	{
		if (NULL != error)
		{
			zbx_set_json_strerror("cannot parse as a valid JSON object: %s", error);
			zbx_free(error);
		}
		else
		{
			zbx_set_json_strerror("cannot parse as a valid JSON object \"%.64s\"", buffer);
		}
		return FAIL;
	}
	jp->end = jp->start + len - 1;
	return SUCCEED;
}
int zbx_json_open ( const char * buffer , struct zbx_json_parse * jp ) { char * error = NULL ; zbx_int64_t len ; SKIP_WHITESPACE ( buffer ) ; if ( ' \0 ' == * buffer ) return FAIL ; jp -> start = buffer ; jp -> end = NULL ; if ( 0 == ( len = zbx_json_validate ( jp -> start , & error ) ) ) { if ( NULL != error ) { zbx_set_json_strerror ( " " , error ) ; zbx_free ( error ) ; } else { zbx_set_json_strerror ( " \" \" " , buffer ) ; } return FAIL ; } jp -> end = jp -> start + len - 1 ; return SUCCEED ; }
Function: zbx_json_open                                                    
                                                                            
 Purpose: open json buffer and check for brackets                           
                                                                            
 Return value: SUCCESS - processed successfully                             
               FAIL - an error occurred
Function : zbx_json_open Purpose : open json buffer and check for brackets Return value : SUCCESS - processed successfully FAIL - an error occurred
/* return immediate failure without logging when opening empty string */