code-style - sub - subscene.com subtitle search
 (HTM) git clone git://git.codemadness.org/sub
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 4ba7e1e7db7d179e06925b2cc9e1d6e926aadc0b
 (DIR) parent c4b11c7b6f7f3122dc88d6be5d1b8bb52a05076e
 (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Mon, 12 Mar 2018 00:49:45 +0100
       
       code-style
       
       Diffstat:
         M sub.c                               |      17 ++++++-----------
       
       1 file changed, 6 insertions(+), 11 deletions(-)
       ---
 (DIR) diff --git a/sub.c b/sub.c
       @@ -75,11 +75,10 @@ xml_handler_data(XMLParser *p, const char *data, size_t datalen)
                        return;
                if (strcmp(curclass, "a1") == 0) {
                        /* link */
       -                if (strcmp(spanclass, "") == 0) {
       +                if (strcmp(spanclass, "") == 0)
                                strlcpy(sub.title, s, sizeof(sub.title));
       -                } else {
       +                else
                                strlcpy(sub.lang, s, sizeof(sub.lang));
       -                }
                } else if (strcmp(curclass, "a3") == 0) {
                        /* files */
                        sub.files = atoi(s);
       @@ -136,25 +135,21 @@ xml_handler_attr(XMLParser *p, const char *tag, size_t taglen,
                        if (isattr(name, "class")) {
                                strlcpy(curclass, value, sizeof(curclass));
                                /* link */
       -                        if (strcmp(value, "a1") == 0) {
       +                        if (strcmp(value, "a1") == 0)
                                        sub.issub = 1;
       -                        }
                        }
                } else if (istag(tag, "span")) {
                        if (strcmp(curclass, "a1") == 0) {
       -                        if (isattr(name, "class")) {
       +                        if (isattr(name, "class"))
                                        strlcpy(spanclass, value, sizeof(spanclass));
       -                        }
                        }
                } else if (istag(tag, "a")) {
                        /* subtitle / author profile url */
                        if (strcmp(name, "href") == 0) {
       -                        if ((strcmp(curclass, "a1") == 0)) {
       +                        if ((strcmp(curclass, "a1") == 0))
                                        strlcpy(sub.url, value, sizeof(sub.url));
       -                        }
       -                        if ((strcmp(curclass, "a5") == 0)) {
       +                        else if ((strcmp(curclass, "a5") == 0))
                                        strlcpy(sub.authorurl, value, sizeof(sub.authorurl));
       -                        }
                        }
                }
        }