summaryrefslogtreecommitdiff
path: root/utils/nsurl
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2017-01-15 13:48:11 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2017-02-08 17:27:13 +0000
commit4c47f9c04626811e455bee76fd15622bd8dc6ca0 (patch)
tree2bd40142ca17545c467441b9db77f7fbf70d6061 /utils/nsurl
parent299a85fa7a4ee259e757b8ffd6e482410e6726f1 (diff)
downloadnetsurf-4c47f9c04626811e455bee76fd15622bd8dc6ca0.tar.gz
netsurf-4c47f9c04626811e455bee76fd15622bd8dc6ca0.tar.bz2
nsurl: Split internal structure out into private header.
Diffstat (limited to 'utils/nsurl')
-rw-r--r--utils/nsurl/nsurl.c53
-rw-r--r--utils/nsurl/private.h75
2 files changed, 77 insertions, 51 deletions
diff --git a/utils/nsurl/nsurl.c b/utils/nsurl/nsurl.c
index c5c614c55..bc77c58ea 100644
--- a/utils/nsurl/nsurl.c
+++ b/utils/nsurl/nsurl.c
@@ -42,62 +42,13 @@
#include "utils/errors.h"
#include "utils/idna.h"
#include "utils/log.h"
+#include "utils/nsurl/private.h"
#include "utils/nsurl.h"
#include "utils/utils.h"
/* Define to enable NSURL debugging */
#undef NSURL_DEBUG
-/**
- * nsurl scheme type
- */
-enum scheme_type {
- NSURL_SCHEME_OTHER,
- NSURL_SCHEME_HTTP,
- NSURL_SCHEME_HTTPS,
- NSURL_SCHEME_FTP,
- NSURL_SCHEME_MAILTO
-};
-
-/**
- * nsurl components
- *
- * [scheme]://[username]:[password]@[host]:[port][path][?query]#[fragment]
- *
- * Note:
- * "path" string includes preceding '/', if needed for the scheme
- * "query" string always includes preceding '?'
- *
- * The other spanned punctuation is to be inserted when building URLs from
- * components.
- */
-struct nsurl_components {
- lwc_string *scheme;
- lwc_string *username;
- lwc_string *password;
- lwc_string *host;
- lwc_string *port;
- lwc_string *path;
- lwc_string *query;
- lwc_string *fragment;
-
- enum scheme_type scheme_type;
-};
-
-
-/**
- * NetSurf URL object
- */
-struct nsurl {
- struct nsurl_components components;
-
- int count; /* Number of references to NetSurf URL object */
- uint32_t hash; /* Hash value for nsurl identification */
-
- size_t length; /* Length of string */
- char string[FLEX_ARRAY_LEN_DECL]; /* Full URL as a string */
-};
-
/** Marker set, indicating positions of sections within a URL string */
struct url_markers {
@@ -115,7 +66,7 @@ struct url_markers {
size_t end; /** end of URL */
- enum scheme_type scheme_type;
+ enum nsurl_scheme_type scheme_type;
};
diff --git a/utils/nsurl/private.h b/utils/nsurl/private.h
new file mode 100644
index 000000000..b8132c535
--- /dev/null
+++ b/utils/nsurl/private.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2011-2017 Michael Drake <tlsa@netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NETSURF_UTILS_NSURL_PRIVATE_H_
+#define NETSURF_UTILS_NSURL_PRIVATE_H_
+
+#include <libwapcaplet/libwapcaplet.h>
+
+#include "utils/utils.h"
+
+/** A type for URL schemes */
+enum nsurl_scheme_type {
+ NSURL_SCHEME_OTHER,
+ NSURL_SCHEME_HTTP,
+ NSURL_SCHEME_HTTPS,
+ NSURL_SCHEME_FTP,
+ NSURL_SCHEME_MAILTO
+};
+
+
+/**
+ * nsurl components
+ *
+ * [scheme]://[username]:[password]@[host]:[port][path][?query]#[fragment]
+ *
+ * Note:
+ * "path" string includes preceding '/', if needed for the scheme
+ * "query" string always includes preceding '?'
+ *
+ * The other spanned punctuation is to be inserted when building URLs from
+ * components.
+ */
+struct nsurl_components {
+ lwc_string *scheme;
+ lwc_string *username;
+ lwc_string *password;
+ lwc_string *host;
+ lwc_string *port;
+ lwc_string *path;
+ lwc_string *query;
+ lwc_string *fragment;
+
+ enum nsurl_scheme_type scheme_type;
+};
+
+
+/**
+ * NetSurf URL object
+ */
+struct nsurl {
+ struct nsurl_components components;
+
+ int count; /* Number of references to NetSurf URL object */
+ uint32_t hash; /* Hash value for nsurl identification */
+
+ size_t length; /* Length of string */
+ char string[FLEX_ARRAY_LEN_DECL]; /* Full URL as a string */
+};
+
+#endif