예제 #1
0
static inline as_boolean * as_boolean_cons(as_boolean * boolean, bool free, bool value)
{
    if ( !boolean ) return boolean;

    as_val_cons((as_val *) boolean, AS_BOOLEAN, free);
    boolean->value = value;
    return boolean;
}
예제 #2
0
static as_integer * as_integer_cons(as_integer * integer, bool free, int64_t value)
{
	if ( !integer ) return integer;

	as_val_cons((as_val *) integer, AS_INTEGER, free);
	integer->value = value;
	return integer;
}
예제 #3
0
static inline as_geojson * as_geojson_cons(as_geojson * string, bool free, char * value, size_t len, bool value_free)
{
	if ( !string ) return string;

	as_val_cons((as_val *) string, AS_GEOJSON, free);
	string->free = value_free;
	string->value = value;
	string->len = len;
	return string;
}
예제 #4
0
static inline as_string * as_string_cons(as_string * string, bool free, char * value, size_t len, bool value_free)
{
	if ( !string ) return string;

	as_val_cons((as_val *) string, AS_STRING, free);
	string->free = value_free;
	string->value = value;
	string->len = len;
	return string;
}
예제 #5
0
static inline as_bytes * as_bytes_cons(
	as_bytes * bytes, bool free, 
	uint32_t capacity, uint32_t size, uint8_t * value, 
	bool value_free, as_bytes_type type)
{
	if ( !bytes ) return bytes;

    as_val_cons((as_val *) bytes, AS_BYTES, free);
    bytes->capacity = capacity;
    bytes->size = size;
    bytes->value = value;
    bytes->free = value_free;
    bytes->type = AS_BYTES_BLOB;

    if ( value == NULL && size == 0 && capacity > 0 ) {
	    bytes->value = cf_calloc(capacity, sizeof(uint8_t));
    }
    
	return bytes;
}