|
|
@ -97,10 +97,9 @@ static inline bencode_item_t *bencode_dictionary_add_string(bencode_item_t *dict |
|
|
/* Ditto, but for a "str" object */ |
|
|
/* Ditto, but for a "str" object */ |
|
|
static inline bencode_item_t *bencode_dictionary_add_str(bencode_item_t *dict, const char *key, const str *val); |
|
|
static inline bencode_item_t *bencode_dictionary_add_str(bencode_item_t *dict, const char *key, const str *val); |
|
|
|
|
|
|
|
|
/* Ditto again, but adds the buffer which contains the string (val->s) to the bencode_buffer_t's |
|
|
|
|
|
* internal free list. When the bencode_item_t object is destroyed, BENCODE_FREE will be called |
|
|
|
|
|
* on this buffer. */ |
|
|
|
|
|
static inline bencode_item_t *bencode_dictionary_add_str_free(bencode_item_t *dict, const char *key, const str *val); |
|
|
|
|
|
|
|
|
/* Ditto again, but adds the str object (val) to the bencode_buffer_t's internal free list. When |
|
|
|
|
|
* the bencode_item_t object is destroyed, BENCODE_FREE will be called on this pointer. */ |
|
|
|
|
|
static inline bencode_item_t *bencode_dictionary_add_str_free(bencode_item_t *dict, const char *key, str *val); |
|
|
|
|
|
|
|
|
/* Convenience function to add an integer value to a dictionary */ |
|
|
/* Convenience function to add an integer value to a dictionary */ |
|
|
static inline bencode_item_t *bencode_dictionary_add_integer(bencode_item_t *dict, const char *key, long long int val); |
|
|
static inline bencode_item_t *bencode_dictionary_add_integer(bencode_item_t *dict, const char *key, long long int val); |
|
|
@ -275,10 +274,10 @@ static inline bencode_item_t *bencode_dictionary_add_str(bencode_item_t *dict, c |
|
|
return bencode_dictionary_add(dict, key, bencode_str(dict->buffer, val)); |
|
|
return bencode_dictionary_add(dict, key, bencode_str(dict->buffer, val)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static inline bencode_item_t *bencode_dictionary_add_str_free(bencode_item_t *dict, const char *key, const str *val) { |
|
|
|
|
|
|
|
|
static inline bencode_item_t *bencode_dictionary_add_str_free(bencode_item_t *dict, const char *key, str *val) { |
|
|
if (!val) |
|
|
if (!val) |
|
|
return NULL; |
|
|
return NULL; |
|
|
bencode_buffer_freelist_add(dict->buffer, val->s); |
|
|
|
|
|
|
|
|
bencode_buffer_freelist_add(dict->buffer, val); |
|
|
return bencode_dictionary_add(dict, key, bencode_str(dict->buffer, val)); |
|
|
return bencode_dictionary_add(dict, key, bencode_str(dict->buffer, val)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|