summaryrefslogtreecommitdiff
path: root/src/url.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/url.c')
-rw-r--r--src/url.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/url.c b/src/url.c
index 09bf84a..5b5c2a0 100644
--- a/src/url.c
+++ b/src/url.c
@@ -262,7 +262,7 @@ spif_url_parse(spif_url_t self)
/* Check for "proto:" at the beginning. */
pend = SPIF_CHARPTR(strchr((char *) s, ':'));
- if (pend != NULL) {
+ if (pend) {
for (; pstr < pend; pstr++) {
if (!isalnum(*pstr)) {
break;
@@ -284,16 +284,16 @@ spif_url_parse(spif_url_t self)
/* Knock out the path and query if they're there. */
pend = SPIF_CHARPTR(strchr((char *) pstr, '/'));
- if (pend != NULL) {
+ if (pend) {
spif_charptr_t tmp = SPIF_CHARPTR(strchr((char *) pend, '?'));
- if (tmp != NULL) {
+ if (tmp) {
self->query = spif_str_new_from_ptr(tmp + 1);
self->path = spif_str_new_from_buff(pend, tmp - pend);
} else {
self->path = spif_str_new_from_ptr(pend);
}
- } else if ((pend = SPIF_CHARPTR(strchr((char *) pstr, '?'))) != NULL) {
+ } else if ((pend = SPIF_CHARPTR(strchr((char *)pstr, '?')))) {
self->query = spif_str_new_from_ptr(pend + 1);
} else {
for (pend = pstr; *pend; pend++);
@@ -302,10 +302,10 @@ spif_url_parse(spif_url_t self)
/* Check for an @ sign, which would mean we have auth info. */
ptmp = SPIF_CHARPTR(strchr((char *) pstr, '@'));
- if ((ptmp != NULL) && (ptmp < pend)) {
+ if ((ptmp) && (ptmp < pend)) {
spif_charptr_t tmp = SPIF_CHARPTR(strchr((char *) pstr, ':'));
- if ((tmp != NULL) && (tmp < ptmp)) {
+ if ((tmp) && (tmp < ptmp)) {
/* Both username and password. */
self->user = spif_str_new_from_buff(pstr, tmp - pstr);
self->passwd = spif_str_new_from_buff((tmp + 1), ptmp - tmp - 1);
@@ -317,7 +317,7 @@ spif_url_parse(spif_url_t self)
/* All that remains now between pstr and pend is host and maybe port. */
ptmp = SPIF_CHARPTR(strchr((char *) pstr, ':'));
- if ((ptmp != NULL) && (ptmp < pend)) {
+ if ((ptmp) && (ptmp < pend)) {
self->host = spif_str_new_from_buff(pstr, ptmp - pstr);
self->port = spif_str_new_from_buff((ptmp + 1), pend - ptmp - 1);
} else if (pstr != pend) {
@@ -330,18 +330,18 @@ spif_url_parse(spif_url_t self)
spif_servinfo_t serv;
proto = getprotobyname((char *) SPIF_STR_STR(self->proto));
- if (proto == NULL) {
+ if (!proto) {
/* If it's not a protocol, it's probably a service. */
serv = getservbyname((char *) SPIF_STR_STR(self->proto), "tcp");
- if (serv == NULL) {
+ if (!serv) {
serv = getservbyname((char *) SPIF_STR_STR(self->proto), "udp");
}
- if (serv != NULL) {
+ if (serv) {
proto = getprotobyname(serv->s_proto);
REQUIRE_RVAL(proto != NULL, FALSE);
}
}
- if (proto != NULL) {
+ if (proto) {
spif_char_t buff[32];
snprintf((char *) buff, sizeof(buff), "%d", ntohs(serv->s_port));