diff options
author | Vincent Sanders <vince@kyllikki.org> | 2017-03-13 16:38:24 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2017-03-13 16:38:24 +0000 |
commit | 5078bffad799d41f8098e59b50d29dc018549663 (patch) | |
tree | b947c1f22f2020b609c41bce11fcd6d81187ec5f /content/urldb.c | |
parent | 363c32c07aad6cdaf9b430781137bfca726f7761 (diff) | |
download | netsurf-5078bffad799d41f8098e59b50d29dc018549663.tar.gz netsurf-5078bffad799d41f8098e59b50d29dc018549663.tar.bz2 |
change urldb_set_title API to return an error status
Diffstat (limited to 'content/urldb.c')
-rw-r--r-- | content/urldb.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/content/urldb.c b/content/urldb.c index b190da5eb..2c2ba151c 100644 --- a/content/urldb.c +++ b/content/urldb.c @@ -218,9 +218,9 @@ struct path_data { struct path_data *next; /**< Next sibling */ struct path_data *prev; /**< Previous sibling */ - struct path_data *parent; /**< Parent path segment */ - struct path_data *children; /**< Child path segments */ - struct path_data *last; /**< Last child */ + struct path_data *parent; /**< Parent path segment */ + struct path_data *children; /**< Child path segments */ + struct path_data *last; /**< Last child */ }; struct host_part { @@ -241,15 +241,15 @@ struct host_part { char *part; /** - * Linked list of all known proctection spaces known for his + * Linked list of all known proctection spaces known for this * host and all its schems and ports. */ struct prot_space_data *prot_space; struct host_part *next; /**< Next sibling */ struct host_part *prev; /**< Previous sibling */ - struct host_part *parent; /**< Parent host part */ - struct host_part *children; /**< Child host parts */ + struct host_part *parent; /**< Parent host part */ + struct host_part *children; /**< Child host parts */ }; @@ -3171,23 +3171,32 @@ bool urldb_add_url(nsurl *url) /* exported interface documented in content/urldb.h */ -void urldb_set_url_title(nsurl *url, const char *title) +nserror urldb_set_url_title(nsurl *url, const char *title) { struct path_data *p; char *temp; - assert(url && title); + assert(url); p = urldb_find_url(url); - if (!p) - return; + if (p == NULL) { + return NSERROR_NOT_FOUND; + } - temp = strdup(title); - if (!temp) - return; + /* copy the parameter if necessary */ + if (title != NULL) { + temp = strdup(title); + if (temp == NULL) { + return NSERROR_NOMEM; + } + } else { + temp = NULL; + } free(p->urld.title); p->urld.title = temp; + + return NSERROR_OK; } |