From db3b62ab53d9358a50c598059f1321a9ae660377 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Wed, 13 Nov 2013 15:05:27 +0100 Subject: [PATCH] Fix _sync functions From _sync functions remove resposne_length parameter (it has no meaning) and pa ss response by reference (because it is actually a return value). svn revision 169 getdns-api version 355 --- spec/example-all-functions.c | 12 ++++-------- spec/example-synchronous.c | 3 +-- spec/getdns_core_only.c | 20 ++++++++------------ spec/getdns_core_only.h | 14 +++++--------- spec/index.html | 17 ++++++----------- 5 files changed, 24 insertions(+), 42 deletions(-) diff --git a/spec/example-all-functions.c b/spec/example-all-functions.c index c4ad41c5..36ca24fa 100644 --- a/spec/example-all-functions.c +++ b/spec/example-all-functions.c @@ -103,32 +103,28 @@ retregular = getdns_general_sync( charstararg, uint16arg, dictarg, - uint32ptrarg, - dictarg + &dictarg ); retregular = getdns_address_sync( contextarg, charstararg, dictarg, - uint32ptrarg, - dictarg + &dictarg ); retregular = getdns_hostname_sync( contextarg, dictarg, dictarg, - uint32ptrarg, - dictarg + &dictarg ); retregular = getdns_service_sync( contextarg, charstararg, dictarg, - uint32ptrarg, - dictarg + &dictarg ); getdns_free_sync_request_memory( diff --git a/spec/example-synchronous.c b/spec/example-synchronous.c index 513a3112..f83dcbf2 100644 --- a/spec/example-synchronous.c +++ b/spec/example-synchronous.c @@ -27,12 +27,11 @@ int main() fprintf(stderr, "Trying to set an extension do both IPv4 and IPv6 failed: %d", this_ret); return(GETDNS_RETURN_GENERIC_ERROR); } - uint32_t this_response_length; struct getdns_dict * this_response = NULL; /* Make the call */ getdns_return_t dns_request_return = getdns_general_sync(this_context, this_name, this_request_type, - this_extensions, &this_response_length, this_response); + this_extensions, &this_response); if (dns_request_return == GETDNS_RETURN_BAD_DOMAIN_NAME) { fprintf(stderr, "A bad domain name was used: %s. Exiting.", this_name); diff --git a/spec/getdns_core_only.c b/spec/getdns_core_only.c index 60064440..5a584fc9 100644 --- a/spec/getdns_core_only.c +++ b/spec/getdns_core_only.c @@ -82,44 +82,40 @@ getdns_general_sync( const char *name, uint16_t request_type, struct getdns_dict *extensions, - uint32_t *response_length, - struct getdns_dict *response + struct getdns_dict **response ) { UNUSED_PARAM(context); UNUSED_PARAM(name); UNUSED_PARAM(request_type); UNUSED_PARAM(extensions); -UNUSED_PARAM(response_length); UNUSED_PARAM(response); return GETDNS_RETURN_GOOD; } +UNUSED_PARAM(response); return GETDNS_RETURN_GOOD; } getdns_return_t getdns_address_sync( getdns_context_t context, const char *name, struct getdns_dict *extensions, - uint32_t *response_length, - struct getdns_dict *response + struct getdns_dict **response ) { UNUSED_PARAM(context); UNUSED_PARAM(name); UNUSED_PARAM(extensions); -UNUSED_PARAM(response_length); UNUSED_PARAM(response); return GETDNS_RETURN_GOOD; } +UNUSED_PARAM(response); return GETDNS_RETURN_GOOD; } getdns_return_t getdns_hostname_sync( getdns_context_t context, struct getdns_dict *address, struct getdns_dict *extensions, - uint32_t *response_length, - struct getdns_dict *response + struct getdns_dict **response ) { UNUSED_PARAM(context); UNUSED_PARAM(address); UNUSED_PARAM(extensions); -UNUSED_PARAM(response_length); UNUSED_PARAM(response); return GETDNS_RETURN_GOOD; } +UNUSED_PARAM(response); return GETDNS_RETURN_GOOD; } getdns_return_t getdns_service_sync( getdns_context_t context, const char *name, struct getdns_dict *extensions, - uint32_t *response_length, - struct getdns_dict *response + struct getdns_dict **response ) { UNUSED_PARAM(context); UNUSED_PARAM(name); UNUSED_PARAM(extensions); -UNUSED_PARAM(response_length); UNUSED_PARAM(response); return GETDNS_RETURN_GOOD; } +UNUSED_PARAM(response); return GETDNS_RETURN_GOOD; } void getdns_free_sync_request_memory( diff --git a/spec/getdns_core_only.h b/spec/getdns_core_only.h index 7c971e18..0e4bf551 100644 --- a/spec/getdns_core_only.h +++ b/spec/getdns_core_only.h @@ -1,4 +1,4 @@ -/* Created at 2013-11-13-15-03-09*/ +/* Created at 2013-11-13-15-04-07*/ #ifndef GETDNS_H #define GETDNS_H @@ -361,8 +361,7 @@ getdns_general_sync( const char *name, uint16_t request_type, struct getdns_dict *extensions, - uint32_t *response_length, - struct getdns_dict *response + struct getdns_dict **response ); getdns_return_t @@ -370,8 +369,7 @@ getdns_address_sync( getdns_context_t context, const char *name, struct getdns_dict *extensions, - uint32_t *response_length, - struct getdns_dict *response + struct getdns_dict **response ); getdns_return_t @@ -379,8 +377,7 @@ getdns_hostname_sync( getdns_context_t context, struct getdns_dict *address, struct getdns_dict *extensions, - uint32_t *response_length, - struct getdns_dict *response + struct getdns_dict **response ); getdns_return_t @@ -388,8 +385,7 @@ getdns_service_sync( getdns_context_t context, const char *name, struct getdns_dict *extensions, - uint32_t *response_length, - struct getdns_dict *response + struct getdns_dict **response ); void diff --git a/spec/index.html b/spec/index.html index c19690fa..72c2a041 100644 --- a/spec/index.html +++ b/spec/index.html @@ -439,8 +439,7 @@ getdns_general_sync( const char *name, uint16_t request_type, struct getdns_dict *extensions, - uint32_t *response_length, - struct getdns_dict *response + struct getdns_dict **response ); @@ -449,8 +448,7 @@ getdns_address_sync( getdns_context_t context, const char *name, struct getdns_dict *extensions, - uint32_t *response_length, - struct getdns_dict *response + struct getdns_dict **response ); @@ -459,8 +457,7 @@ getdns_hostname_sync( getdns_context_t context, struct getdns_dict *address, struct getdns_dict *extensions, - uint32_t *response_length, - struct getdns_dict *response + struct getdns_dict **response ); @@ -469,8 +466,7 @@ getdns_service_sync( getdns_context_t context, const char *name, struct getdns_dict *extensions, - uint32_t *response_length, - struct getdns_dict *response + struct getdns_dict **response ); @@ -1647,12 +1643,11 @@ as it is for the synchronous example, it is just done in main().

fprintf(stderr, "Trying to set an extension do both IPv4 and IPv6 failed: %d", this_ret); return(GETDNS_RETURN_GENERIC_ERROR); } - uint32_t this_response_length; struct getdns_dict * this_response = NULL; /* Make the call */ getdns_return_t dns_request_return = getdns_general_sync(this_context, this_name, this_request_type, - this_extensions, &this_response_length, this_response); + this_extensions, &this_response); if (dns_request_return == GETDNS_RETURN_BAD_DOMAIN_NAME) { fprintf(stderr, "A bad domain name was used: %s. Exiting.", this_name); @@ -2117,7 +2112,7 @@ default is the realloc function.

9. The Generated Files

-

There is a tarball that includes the .h files, +

There is a tarball that includes the .h files, the examples, and so on. The examples all make, even though there is no API implementation, based on a pseudo-implementation in the tarball; see make-examples-PLATFORM.sh. Note that this currently builds fine on the Macintosh and Ubuntu; help is definitely appreciated on making the build process