]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Merge branch 'refs/heads/t/base64'
authorAndre Noll <maan@tuebingen.mpg.de>
Tue, 20 Dec 2016 14:40:09 +0000 (15:40 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Tue, 20 Dec 2016 14:42:23 +0000 (15:42 +0100)
A couple of patches which move the base64 code to a separate file,
and improve on it. Was cooking for several months.

* refs/heads/t/base64:
  base64: Speed up decoder by using a table.
  base64: Use para_isspace() everywhere.
  base64: Trivial whitespace fixes.
  base64: Replace Pad64 variable by macro.
  base64: Remove unnecessary overflow checks.
  base64: Saner semantics for base64_decode() and uudecode().
  Move base64 implementation to own file.

13 files changed:
Makefile.real
NEWS.md
afs.c
audiod.c
client_common.c
command.c
error.h
filter.c
filter.h
net.c
play.c
t/test-lib.sh
web/documentation.in.html

index a226df1ba5713bc77b1744ed560c5eda0af6aa26..ce4881d29c90c8626e44d384dab14c81e15b11b8 100644 (file)
@@ -65,9 +65,8 @@ tarball_pfx := $(PACKAGE_TARNAME)-$(GIT_VERSION)
 tarball_delete := $(addprefix $(tarball_pfx)/, web .gitignore)
 tarball := $(tarball_pfx).tar.bz2
 
-.PHONY: dep all clean clean2 distclean maintainer-clean install man tarball
-all: dep $(prefixed_executables) $(man_pages)
-dep: $(deps)
+.PHONY: all clean clean2 distclean maintainer-clean install man tarball
+all: $(prefixed_executables) $(man_pages)
 man: $(man_pages)
 tarball: $(tarball)
 
diff --git a/NEWS.md b/NEWS.md
index 71eb6cb26d3a333f8840f78848ad74986f689754..b0862d5f392ee33504255eab1d0d43e3ee157067 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,6 +1,16 @@
 NEWS
 ====
 
+------------------------------------------
+0.5.7 (to be announced) "semantic density"
+------------------------------------------
+- Speedup of the base64 decoder.
+- One of the two source browsers has been removed from the web pages.
+  The doxygen API reference still contains an HTML version of each
+  source file.
+
+Download: [tarball](./releases/paraslash-git.tar.bz2)
+
 ---------------------------------------
 0.5.6 (2016-07-10) "cascading gradient"
 ---------------------------------------
diff --git a/afs.c b/afs.c
index 016329841fe87255cdc68c1191e8661124c1c326..0accc45108f7c6ba0c2a3a89595d957d8a566920 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -607,14 +607,17 @@ static int com_select_callback(struct afs_callback_arg *aca)
        if (ret >= 0)
                goto out;
        /* ignore subsequent errors (but log them) */
-       para_printf(&aca->pbout, "could not activate %s: %s\n"
-               "switching back to %s\n",
-               arg, para_strerror(-ret), current_mop? current_mop : "dummy");
-       ret = activate_mood_or_playlist(current_mop, &num_admissible);
-       if (ret >= 0)
-               goto out;
-       para_printf(&aca->pbout, "could not activate %s: %s\nswitching to dummy\n",
-               current_mop, para_strerror(-ret));
+       para_printf(&aca->pbout, "could not activate %s\n", arg);
+       if (current_mop) {
+               int ret2;
+               para_printf(&aca->pbout, "switching back to %s\n", current_mop);
+               ret2 = activate_mood_or_playlist(current_mop, &num_admissible);
+               if (ret2 >= 0)
+                       goto out;
+               para_printf(&aca->pbout, "could not reactivate %s: %s\n",
+                       current_mop, para_strerror(-ret2));
+       }
+       para_printf(&aca->pbout, "activating dummy mood\n");
        activate_mood_or_playlist(NULL, &num_admissible);
 out:
        para_printf(&aca->pbout, "activated %s (%d admissible files)\n",
index fedeff7af880a009d938e73087edb7ca6c83f267..285d2762fa1093baf3e49211eab73ca631f605db 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -596,7 +596,8 @@ static void open_filters(struct slot_info *s)
                        EMBRACE(.name = f->name, .parent = parent,
                                .handler = f->execute, .context = fn));
 
-               f->open(fn);
+               if (f->open)
+                       f->open(fn);
                sprintf(buf, "%s (slot %d)", f->name, (int)(s - slot));
                fn->task = task_register(&(struct task_info) {
                        .name = buf,
index cd1ccc619ce06710d9fad42652d6868942fc17d8..eea7510fd0589e86fb4058dd7f4361f3c79901aa 100644 (file)
@@ -292,11 +292,6 @@ static int client_post_select(struct sched *s, void *context)
                if (ret < 0 || n == 0)
                        goto out;
                ct->features = parse_features(buf);
-               if (!has_feature("sideband", ct)) {
-                       PARA_ERROR_LOG("server has no sideband support\n");
-                       ret = -E_INCOMPAT_FEAT;
-                       goto out;
-               }
                ct->status = CL_RECEIVED_WELCOME;
                return 0;
        case CL_RECEIVED_WELCOME: /* send auth command */
index 93de2d2d99d9f75cb041211e8c4f45dfef28c6a1..0eb4efc22fa564fd2c055aa0753392696ad49a2f 100644 (file)
--- a/command.c
+++ b/command.c
@@ -807,7 +807,6 @@ static void reset_signals(void)
 }
 
 struct connection_features {
-       bool sideband_requested;
        bool aes_ctr128_requested;
 };
 
@@ -835,8 +834,8 @@ static int parse_auth_request(char *buf, int len, struct user **u,
                create_argv(p, ",", &features);
                for (i = 0; features[i]; i++) {
                        if (strcmp(features[i], "sideband") == 0)
-                               cf->sideband_requested = true;
-                       else if (strcmp(features[i], "aes_ctr128") == 0)
+                               continue;
+                       if (strcmp(features[i], "aes_ctr128") == 0)
                                cf->aes_ctr128_requested = true;
                        else {
                                ret = -E_BAD_FEATURE;
@@ -949,11 +948,6 @@ __noreturn void handle_connect(int fd, const char *peername)
        ret = parse_auth_request(buf, ret, &cc->u, &cf);
        if (ret < 0)
                goto net_err;
-       if (!cf.sideband_requested) { /* sideband is mandatory */
-               PARA_ERROR_LOG("client did not request sideband\n");
-               ret = -E_BAD_FEATURE;
-               goto net_err;
-       }
        if (cc->u) {
                get_random_bytes_or_die(rand_buf, sizeof(rand_buf));
                ret = pub_encrypt(cc->u->pubkey, rand_buf, sizeof(rand_buf),
diff --git a/error.h b/error.h
index ea12469b236530fe3a2786af56e3659dd5d45543..ff85c8d18455e356f6e220c642b776570db86111 100644 (file)
--- a/error.h
+++ b/error.h
@@ -306,7 +306,6 @@ extern const char **para_errlist[];
        PARA_ERROR(SERVER_EOF, "connection closed by para_server"), \
        PARA_ERROR(SERVER_CMD_SUCCESS, "command terminated successfully"), \
        PARA_ERROR(SERVER_CMD_FAILURE, "command failed"), \
-       PARA_ERROR(INCOMPAT_FEAT, "client/server incompatibility"), \
 
 
 #define NET_ERRORS \
index 9378e4695b6b113843d7d1b34a96ded4bdebd79e..804b5e1e569a9c680e309f14738e77481161682a 100644 (file)
--- a/filter.c
+++ b/filter.c
@@ -142,7 +142,8 @@ int main(int argc, char *argv[])
                ti.pre_select = f->pre_select;
                ti.post_select = f->post_select;
                ti.context = fn;
-               f->open(fn);
+               if (f->open)
+                       f->open(fn);
                fn->task = task_register(&ti, &s);
                parent = fn->btrn;
        }
index 937bb42bc610e65d371ff8787a6e701c240c558a..0bd546903927d412fccef946cf8f43783ed8bc70 100644 (file)
--- a/filter.h
+++ b/filter.h
@@ -58,17 +58,18 @@ struct filter {
        /**
         * Open one instance of this filter.
         *
-        * This should allocate the output buffer of the given filter node and do any
-        * other filter-specific preparations like initializing the private_data member
-        * of \a fn suitably. The open function is assumed to succeed.
+        * This should allocate the output buffer of the given filter node and
+        * do any other filter-specific preparations like initializing the
+        * private_data member of \a fn suitably. The open function is
+        * optional, If it is provided, it is assumed to succeed.
         */
        void (*open)(struct filter_node *fn);
        /**
         * Close one instance of this filter.
         *
-        * Free all resources of associated with \a fn that were previously allocated
-        * by the open() function. It's OK to leave this alone if the filter does not
-        * need any cleanups.
+        * Free all resources associated with \a fn that were previously
+        * allocated by the open() function. It's OK to set this to NULL if the
+        * filter does not need to perform any cleanup operation.
         */
        void (*close)(struct filter_node *fn);
        /**
diff --git a/net.c b/net.c
index 1b142a3cd4a25b87fe2e31c86caaf32e4be5f51e..1369498905faa4ab729bac8209a6a03e8b920063 100644 (file)
--- a/net.c
+++ b/net.c
@@ -175,8 +175,7 @@ char *parse_url(const char *url,
        }
 
        if (*o == ':')
-               if (para_atoi32(++o, port) < 0 ||
-                   *port < 0 || *port > 0xffff)
+               if (para_atoi32(++o, port) < 0 || *port < 0 || *port > 0xffff)
                        goto failed;
        if (host_string_ok(host))
                return host;
@@ -187,6 +186,7 @@ failed:
 
 /**
  * Stringify port number, resolve into service name where defined.
+ *
  * \param port 2-byte port number, in host-byte-order.
  * \param transport Transport protocol name (e.g. "udp", "tcp"), or NULL.
  * \return Pointer to static result buffer.
diff --git a/play.c b/play.c
index a7ce563baafae4e39e33de07867669085c648ac3..d2539ee134773614a40bca9941f35dd161007946 100644 (file)
--- a/play.c
+++ b/play.c
@@ -397,7 +397,8 @@ static int load_file(struct play_task *pt)
        pt->fn.btrn = btr_new_node(&(struct btr_node_description)
                EMBRACE(.name = decoder->name, .parent = pt->rn.btrn,
                        .handler = decoder->execute, .context = &pt->fn));
-       decoder->open(&pt->fn);
+       if (decoder->open)
+               decoder->open(&pt->fn);
 
        /* setup default writer */
        pt->wn.conf = check_writer_arg_or_die(NULL, &pt->wn.writer_num);
index 99e575d3b66d0f54e9746647eee1af4eba84fa2c..1f9913e3cf9ba49b4cb76cc5b985d914cb527b69 100644 (file)
@@ -156,7 +156,7 @@ test_require_executables()
 test_duration()
 {
        local t=$(exec 2>&1 1>/dev/null; time -p "$@")
-       result=$(awk '{print $2 * 1000}' <<< $t)
+       result=$(awk '{print $2 * 1000; exit 0}' <<< "$t")
 }
 
 test_expect_success()
index f292af25d723764f18e555e8daac714089f3d7f5..b226943b199a224e6b38e4685235707982e23f11 100644 (file)
 <h2> Source code documentation </h2>
 
 <ul>
-
-       <li> <a href="doxygen/html/index.html">API
-       Reference</a>. </li>
-
-       <li> <a href="HTML/index.html">Browsable source</a>. </li>
-
+       <li> <a href="doxygen/html/index.html">API Reference</a> </li>
 </ul>