[Merge] lp:~vicamo/upstart/xenial-escape-systemd-strings into lp:~ubuntu-core-dev/upstart/xenial
Łukasz Zemczak
lukasz.zemczak at canonical.com
Mon Oct 3 11:21:20 UTC 2016
Diff comments:
> === modified file 'extra/upstart-local-bridge.c'
> --- extra/upstart-local-bridge.c 2015-01-16 23:55:17 +0000
> +++ extra/upstart-local-bridge.c 2016-09-29 09:06:04 +0000
> @@ -912,6 +912,46 @@
>
> }
>
> +static char
> +hexchar (char c)
> +{
> + static const char table[16] = "0123456789abcdef";
> +
> + return table[c & 0xf];
> +}
> +
> +static char*
> +escape_string (const char *f)
> +{
> + char *r = NULL;
> + char *t = NULL;
> +
> + nih_assert (f);
> +
> + r = t = NIH_MUST (nih_alloc (NULL, strlen(f) * 4 + 1));
> +
> +#define VALID_CHARS \
> + "0123456789" \
> + "abcdefghijklmnopqrstuvwxyz" \
> + "ABCDEFGHIJKLMNOPQRSTUVWXYX" \
> + ":_."
> + for (; *f; f++) {
> + if (*f == '/')
Stylization request: could we add { } here and in the else { case too? The upstart code style uses brackets for single-line conditionals if there's an 'else' or 'else if' clause.
> + *(t++) = '-';
> + else if (!strchr(VALID_CHARS, *f)) {
> + *(t++) = '\\';
> + *(t++) = 'x';
> + *(t++) = hexchar(*f >> 4);
> + *(t++) = hexchar(*f);
> + } else
> + *(t++) = *f;
> + }
> +
> + *t = '\0';
> +
> + return r;
> +}
> +
> static void
> systemd_launch_instance (ClientConnection *client,
> const char *pair,
--
https://code.launchpad.net/~vicamo/upstart/xenial-escape-systemd-strings/+merge/307140
Your team Ubuntu Core Development Team is subscribed to branch lp:~ubuntu-core-dev/upstart/xenial.
More information about the Ubuntu-reviews
mailing list