summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-10-28 23:36:14 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-10-28 23:36:14 (EDT)
commit99a0a6a1994381a551b5908f3772054e38560ae0 (patch)
treee68bf3ba9b6f7f27cae88f2dd6153d5fdfc2f2e7 /src
parent43d623a086877ff5331cc0e4ed56080bd4480da5 (diff)
downloadmarquee-99a0a6a1994381a551b5908f3772054e38560ae0.zip
marquee-99a0a6a1994381a551b5908f3772054e38560ae0.tar.gz
marquee-99a0a6a1994381a551b5908f3772054e38560ae0.tar.bz2
MqWebView: Rewrite extension checking functions
Are these conditional blocks easier to read than the long return statements?
Diffstat (limited to 'src')
-rw-r--r--src/web-view.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/web-view.c b/src/web-view.c
index 31540b3..f7e410f 100644
--- a/src/web-view.c
+++ b/src/web-view.c
@@ -914,27 +914,31 @@ get_clean_title(MqWebView *web_view)
static gboolean
extension_is_html(const gchar *extension)
{
- return
- extension[0] == 'h' &&
- extension[1] == 't' &&
- extension[2] == 'm' &&
- (extension[3] == '\0' ||
- (extension[3] == 'l' &&
- extension[4] == '\0'));
+ if (extension[0] == 'h' && extension[1] == 't' && extension[2] == 'm') {
+ if (extension[3] == '\0') {
+ return TRUE;
+ } else if (extension[3] == 'l' && extension[4] == '\0') {
+ return TRUE;
+ }
+ }
+ return FALSE;
}
static gboolean
extension_is_mhtml(const gchar *extension)
{
- return
- extension[0] == 'm' &&
- extension[1] == 'h' &&
- extension[2] == 't' &&
- (extension[3] == '\0' ||
- (extension[3] == 'm' &&
- (extension[4] == '\0' ||
- (extension[4] == 'l' &&
- extension[5] == '\0'))));
+ if (extension[0] == 'm' && extension[1] == 'h' && extension[2] == 't') {
+ if (extension[3] == '\0') {
+ return TRUE;
+ } else if (extension[3] == 'm') {
+ if (extension[3] == '\0') {
+ return TRUE;
+ } else if (extension[4] == 'l' && extension[5] == '\0'){
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
}
static void