[systemd-devel] [PATCH] systemd-analyze: filter dot output with a regular expression

Lennart Poettering lennart at poettering.net
Mon Mar 25 08:48:47 PDT 2013


On Sun, 24.03.13 13:32, Łukasz Stelmach (stlman at poczta.fm) wrote:

> Make "systemd-analyze dot" output only lines matching a regular
> expression passed on the command line. Without the regular expression
> print everything.

So far we mostly used globs everywhere in system. Does it really make
sense to use regexes here?

I mean, unit file names on purpose are "file-name like", and generally
even show up in the file system, so it sounds more natural to me to use
fnmatch here?

>          static const char * const colors[] = {
>                  "Requires",              "[color=\"black\"]",
> @@ -591,6 +594,7 @@ static int graph_one_property(const char *name, const char *prop, DBusMessageIte
>                  "After",                 "[color=\"green\"]"
>          };
>  
> +        char buf[1024];

We generally avoid using fixed size strings like this. Use dynamic
memory for this if you can... i.e. asprintf(), and consider freeing it
with _cleanup_free_...

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list