resolve-host: make arg_type an int

We are using it also to store _DNS_TYPE_INVALID, so it should be signed.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2014-08-03 22:02:32 -04:00
parent 7263f72499
commit de292aa1dd
4 changed files with 11 additions and 13 deletions
+3 -5
View File
@@ -32,16 +32,14 @@ lookup_dns_type (register const char *str, register unsigned int len);
#include "dns_type-from-name.h"
#include "dns_type-to-name.h"
int dns_type_from_string(const char *s, uint16_t *type) {
int dns_type_from_string(const char *s) {
const struct dns_type_name *sc;
assert(s);
assert(type);
sc = lookup_dns_type(s, strlen(s));
if (!sc)
return -EINVAL;
return _DNS_TYPE_INVALID;
*type = sc->id;
return 0;
return sc->id;
}
+2 -4
View File
@@ -21,12 +21,10 @@
#pragma once
#include <inttypes.h>
#include "macro.h"
const char *dns_type_to_string(uint16_t type);
int dns_type_from_string(const char *s, uint16_t *type);
const char *dns_type_to_string(int type);
int dns_type_from_string(const char *s);
/* DNS record types, taken from
* http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml.