AllJoyn/Samples/BACnetAdapter/bacnet-stack-0.8.2/src/bacapp.c
bool bacapp_print_value(
    FILE * stream,
    BACNET_OBJECT_PROPERTY_VALUE * object_value)
{
    char *str;
    bool retval = false;
    size_t str_len = 32;
    int status;

    while (true) {
        /* Try to allocate memory for the output string. Give up if unable. */
        str = (char *) calloc(sizeof(char), str_len);
        if (!str)
            break;

        /* Try to extract the value into allocated memory. If unable, try again */
        /* another time with a string that is twice as large. */
        status = bacapp_snprintf_value(str, str_len, object_value);
        if ((status < 0) || ((size_t)status >= str_len)) {
            free(str);
            str_len *= 2;
        } else if (status == 0) {
            free(str);
            break;
        } else {
            if (stream)
                fprintf(stream, "%s", str);
            free(str);
            retval = true;
            break;
        }
    }
    return retval;
}
/* Print the extracted value from the requested BACnet object property to the
 * specified stream. If stream is NULL, do not print anything. If extraction
 * failed, do not print anything. Return the status of the extraction.
 */
Print the extracted value from the requested BACnet object property to the
specified stream. If stream is NULL, do not print anything. If extraction
failed, do not print anything. Return the status of the extraction.
Print the extracted value from the requested BACnet object property to the specified stream . If stream is NULL do not print anything . If extraction failed do not print anything . Return the status of the extraction .
bool bacapp_print_value(
    FILE * stream,
    BACNET_OBJECT_PROPERTY_VALUE * object_value)
{
    char *str;
    bool retval = false;
    size_t str_len = 32;
    int status;
    while (true) {
        str = (char *) calloc(sizeof(char), str_len);
        if (!str)
            break;
        status = bacapp_snprintf_value(str, str_len, object_value);
        if ((status < 0) || ((size_t)status >= str_len)) {
            free(str);
            str_len *= 2;
        } else if (status == 0) {
            free(str);
            break;
        } else {
            if (stream)
                fprintf(stream, "%s", str);
            free(str);
            retval = true;
            break;
        }
    }
    return retval;
}
bool bacapp_print_value ( FILE * stream , BACNET_OBJECT_PROPERTY_VALUE * object_value ) { char * str ; bool retval = false ; size_t str_len = 32 ; int status ; while ( true ) { str = ( char * ) calloc ( sizeof ( char ) , str_len ) ; if ( ! str ) break ; status = bacapp_snprintf_value ( str , str_len , object_value ) ; if ( ( status < 0 ) || ( ( size_t ) status >= str_len ) ) { free ( str ) ; str_len *= 2 ; } else if ( status == 0 ) { free ( str ) ; break ; } else { if ( stream ) fprintf ( stream , " " , str ) ; free ( str ) ; retval = true ; break ; } } return retval ; }
Print the extracted value from the requested BACnet object property to the
 specified stream.
Print the extracted value from the requested BACnet object property to the specified stream .
/* Try to allocate memory for the output string. Give up if unable. */ /* Try to extract the value into allocated memory. If unable, try again */ /* another time with a string that is twice as large. */