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
This commit is contained in:
Willem Toorop 2013-11-13 15:05:27 +01:00
parent 5f67ffeb1f
commit db3b62ab53
5 changed files with 24 additions and 42 deletions

View File

@ -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(

View File

@ -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);

View File

@ -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(

View File

@ -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

View File

@ -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
);
</div>
@ -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
);
</div>
@ -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
);
</div>
@ -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
);
</div>
@ -1647,12 +1643,11 @@ as it is for the synchronous example, it is just done in <code>main()</code>.</p
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Trying to set an extension do both IPv4 and IPv6 failed: %d&quot;</span><span class="p">,</span> <span class="n">this_ret</span><span class="p">);</span>
<span class="k">return</span><span class="p">(</span><span class="n">GETDNS_RETURN_GENERIC_ERROR</span><span class="p">);</span>
<span class="p">}</span>
<span class="kt">uint32_t</span> <span class="n">this_response_length</span><span class="p">;</span>
<span class="k">struct</span> <span class="n">getdns_dict</span> <span class="o">*</span> <span class="n">this_response</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span>
<span class="cm">/* Make the call */</span>
<span class="kt">getdns_return_t</span> <span class="n">dns_request_return</span> <span class="o">=</span> <span class="n">getdns_general_sync</span><span class="p">(</span><span class="n">this_context</span><span class="p">,</span> <span class="n">this_name</span><span class="p">,</span> <span class="n">this_request_type</span><span class="p">,</span>
<span class="n">this_extensions</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">this_response_length</span><span class="p">,</span> <span class="n">this_response</span><span class="p">);</span>
<span class="n">this_extensions</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">this_response</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">dns_request_return</span> <span class="o">==</span> <span class="n">GETDNS_RETURN_BAD_DOMAIN_NAME</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;A bad domain name was used: %s. Exiting.&quot;</span><span class="p">,</span> <span class="n">this_name</span><span class="p">);</span>
@ -2117,7 +2112,7 @@ default is the <span class=default>realloc</span> function.</p>
<h1>9. The Generated Files</h1>
<p>There is <a href="getdns-0.354.tgz">a tarball</a> that includes the .h files,
<p>There is <a href="getdns-0.355.tgz">a tarball</a> 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