Get rid of response_length in synchroneous funcs

This commit is contained in:
Willem Toorop 2013-11-08 18:39:06 -08:00
parent 3827db1ad4
commit 0b6d610ea5
3 changed files with 12 additions and 17 deletions

View File

@ -46,7 +46,6 @@ main()
const char *this_name = "www.example.com"; const char *this_name = "www.example.com";
uint8_t this_request_type = GETDNS_RRTYPE_A; uint8_t this_request_type = GETDNS_RRTYPE_A;
struct getdns_dict *this_response = NULL; struct getdns_dict *this_response = NULL;
uint32_t this_response_length;
getdns_return_t this_ret; getdns_return_t this_ret;
/* Create the DNS context for this call */ /* Create the DNS context for this call */
@ -73,7 +72,7 @@ main()
/* Make the call */ /* Make the call */
getdns_return_t dns_request_return = getdns_return_t dns_request_return =
getdns_general_sync(this_context, this_name, this_request_type, getdns_general_sync(this_context, this_name, this_request_type,
this_extensions, &this_response_length, &this_response); this_extensions, &this_response);
/* free the extensions */ /* free the extensions */
getdns_dict_destroy(this_extensions); getdns_dict_destroy(this_extensions);
if (dns_request_return == GETDNS_RETURN_BAD_DOMAIN_NAME) { if (dns_request_return == GETDNS_RETURN_BAD_DOMAIN_NAME) {

View File

@ -726,7 +726,6 @@ getdns_cancel_callback(getdns_context_t context,
* @param name the ASCII based domain name to lookup * @param name the ASCII based domain name to lookup
* @param request_type RR type for the query, e.g. GETDNS_RR_TYPE_NS * @param request_type RR type for the query, e.g. GETDNS_RR_TYPE_NS
* @param extensions dict data structures, NULL to use no extensions * @param extensions dict data structures, NULL to use no extensions
* @param response_length response length
* @param response response * @param response response
* @return GETDNS_RETURN_GOOD on success * @return GETDNS_RETURN_GOOD on success
*/ */
@ -735,14 +734,13 @@ getdns_general_sync(getdns_context_t context,
const char *name, const char *name,
uint16_t request_type, uint16_t request_type,
struct getdns_dict *extensions, struct getdns_dict *extensions,
uint32_t * response_length, struct getdns_dict **response); struct getdns_dict **response);
/** /**
* retrieve address assigned to a DNS name * retrieve address assigned to a DNS name
* @param context pointer to a previously created context to be used for this call * @param context pointer to a previously created context to be used for this call
* @param name the ASCII based domain name to lookup * @param name the ASCII based domain name to lookup
* @param extensions dict data structures, NULL to use no extensions * @param extensions dict data structures, NULL to use no extensions
* @param response_length response length
* @param response response * @param response response
* @return GETDNS_RETURN_GOOD on success * @return GETDNS_RETURN_GOOD on success
@ -751,14 +749,13 @@ getdns_return_t
getdns_address_sync(getdns_context_t context, getdns_address_sync(getdns_context_t context,
const char *name, const char *name,
struct getdns_dict *extensions, struct getdns_dict *extensions,
uint32_t * response_length, struct getdns_dict **response); struct getdns_dict **response);
/** /**
* retrieve hostname assigned to an IP address * retrieve hostname assigned to an IP address
* @param context pointer to a previously created context to be used for this call * @param context pointer to a previously created context to be used for this call
* @param address the address to look up * @param address the address to look up
* @param extensions dict data structures, NULL to use no extensions * @param extensions dict data structures, NULL to use no extensions
* @param response_length response length
* @param response response * @param response response
* @return GETDNS_RETURN_GOOD on success * @return GETDNS_RETURN_GOOD on success
*/ */
@ -766,14 +763,13 @@ getdns_return_t
getdns_hostname_sync(getdns_context_t context, getdns_hostname_sync(getdns_context_t context,
struct getdns_dict *address, struct getdns_dict *address,
struct getdns_dict *extensions, struct getdns_dict *extensions,
uint32_t * response_length, struct getdns_dict **response); struct getdns_dict **response);
/** /**
* retrieve a service assigned to a DNS name * retrieve a service assigned to a DNS name
* @param context pointer to a previously created context to be used for this call * @param context pointer to a previously created context to be used for this call
* @param name the ASCII based domain name to lookup * @param name the ASCII based domain name to lookup
* @param extensions dict data structures, NULL to use no extensions * @param extensions dict data structures, NULL to use no extensions
* @param response_length response length
* @param response response * @param response response
* @return GETDNS_RETURN_GOOD on success * @return GETDNS_RETURN_GOOD on success
*/ */
@ -781,7 +777,7 @@ getdns_return_t
getdns_service_sync(getdns_context_t context, getdns_service_sync(getdns_context_t context,
const char *name, const char *name,
struct getdns_dict *extensions, struct getdns_dict *extensions,
uint32_t * response_length, struct getdns_dict **response); struct getdns_dict **response);
void getdns_free_sync_request_memory(struct getdns_dict *response); void getdns_free_sync_request_memory(struct getdns_dict *response);

View File

@ -59,7 +59,7 @@ getdns_general_sync(getdns_context_t context,
const char *name, const char *name,
uint16_t request_type, uint16_t request_type,
struct getdns_dict *extensions, struct getdns_dict *extensions,
uint32_t * response_length, struct getdns_dict **response) struct getdns_dict **response)
{ {
getdns_return_t response_status; getdns_return_t response_status;
@ -79,7 +79,7 @@ getdns_return_t
getdns_address_sync(getdns_context_t context, getdns_address_sync(getdns_context_t context,
const char *name, const char *name,
struct getdns_dict * extensions, struct getdns_dict * extensions,
uint32_t * response_length, struct getdns_dict ** response) struct getdns_dict ** response)
{ {
int cleanup_extensions = 0; int cleanup_extensions = 0;
if (!extensions) { if (!extensions) {
@ -91,7 +91,7 @@ getdns_address_sync(getdns_context_t context,
getdns_return_t result = getdns_return_t result =
getdns_general_sync(context, name, GETDNS_RRTYPE_A, getdns_general_sync(context, name, GETDNS_RRTYPE_A,
extensions, response_length, response); extensions, response);
if (cleanup_extensions) { if (cleanup_extensions) {
getdns_dict_destroy(extensions); getdns_dict_destroy(extensions);
} }
@ -102,7 +102,7 @@ getdns_return_t
getdns_hostname_sync(getdns_context_t context, getdns_hostname_sync(getdns_context_t context,
struct getdns_dict * address, struct getdns_dict * address,
struct getdns_dict * extensions, struct getdns_dict * extensions,
uint32_t * response_length, struct getdns_dict ** response) struct getdns_dict ** response)
{ {
struct getdns_bindata *address_data; struct getdns_bindata *address_data;
struct getdns_bindata *address_type; struct getdns_bindata *address_type;
@ -128,18 +128,18 @@ getdns_hostname_sync(getdns_context_t context,
if ((name = reverse_address((char *) address_data)) == 0) if ((name = reverse_address((char *) address_data)) == 0)
return GETDNS_RETURN_GENERIC_ERROR; return GETDNS_RETURN_GENERIC_ERROR;
return getdns_general_sync(context, name, req_type, extensions, return getdns_general_sync(context, name, req_type, extensions,
response_length, response); response);
} }
getdns_return_t getdns_return_t
getdns_service_sync(getdns_context_t context, getdns_service_sync(getdns_context_t context,
const char *name, const char *name,
struct getdns_dict * extensions, struct getdns_dict * extensions,
uint32_t * response_length, struct getdns_dict ** response) struct getdns_dict ** response)
{ {
return getdns_general_sync(context, name, GETDNS_RRTYPE_SRV, return getdns_general_sync(context, name, GETDNS_RRTYPE_SRV,
extensions, response_length, response); extensions, response);
} }